Skip to content

Add git-based codebase language detection #539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 19, 2025

Conversation

EdwardJXLi
Copy link
Contributor

@EdwardJXLi EdwardJXLi commented Feb 18, 2025

Motivation

Legacy most_common strategy is slow and unnecessarily scans through node_modules, current package_json strategy is flakey. The new git_most_common strategy aims to address both of these issues.

Content

Adds git_most_common strategy to determine_project_language
image

Please check the following before marking your PR as ready for review

  • I have added tests for my changes
  • I have updated the documentation or added new documentation as needed

@EdwardJXLi EdwardJXLi requested review from codegen-team and a team as code owners February 18, 2025 23:56
Copy link

codecov bot commented Feb 18, 2025

Codecov Report

Attention: Patch coverage is 71.42857% with 10 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/codegen/git/utils/language.py 71.42% 10 Missing ⚠️
Additional details and impacted files

Copy link
Contributor

@bagel897 bagel897 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests please

from codegen.shared.enums.programming_language import ProgrammingLanguage


def determine_project_language(folder_path: str, strategy: Literal["most_common", "package_json"] = "package_json") -> ProgrammingLanguage:
def determine_project_language(folder_path: str, strategy: Literal["most_common", "git_most_common", "package_json"] = "git_most_common") -> ProgrammingLanguage:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be an Enum please?

@EdwardJXLi EdwardJXLi merged commit b91cdd8 into develop Feb 19, 2025
23 of 26 checks passed
@EdwardJXLi EdwardJXLi deleted the eli-cg-10847-update-fix-language-detection branch February 19, 2025 00:29
Copy link
Contributor

🎉 This PR is included in version 0.22.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants