Skip to content

feat: [CG-10650] codebase.codeowners interface #290

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 19 commits into from
Feb 11, 2025

Conversation

clee-codegen
Copy link
Contributor

@clee-codegen clee-codegen commented Feb 5, 2025

Motivation

Easier access to code owners of a codebase and files owned by them.

Content

Introduces CodeOwner class and codeowners property on the Codebase class. Refactored methods around source file inspection into a separate base class for other file container interfaces in the futures.

Testing

Testing WIP.

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

Copy link
Member

@christinewangcw christinewangcw left a comment

Choose a reason for hiding this comment

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

can we add some unit tests?

@clee-codegen
Copy link
Contributor Author

clee-codegen commented Feb 5, 2025

can we add some unit tests?

yep will add tests if this is what we're looking for, but it looks we want to be able to access symbols as well.

for codeowner in codebase.codeowners:
    for symbol in codeowner.symbols:  # behaves like SourceFile or Directory
        ...

@clee-codegen
Copy link
Contributor Author

clee-codegen commented Feb 5, 2025

As a side note, I feel like:

TFile = TypeVar("TFile", bound="File")
TSymbol = TypeVar("TSymbol", bound="Symbol")
TImportStatement = TypeVar("TImportStatement", bound="ImportStatement")
TGlobalVar = TypeVar("TGlobalVar", bound="Assignment")
TClass = TypeVar("TClass", bound="Class")
TFunction = TypeVar("TFunction", bound="Function")
TImport = TypeVar("TImport", bound="Import")

we can have a types module to store and import these from

Copy link

codecov bot commented Feb 6, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
27 1 26 0
View the top 1 failed test(s) by shortest run time
::tests.unit.codegen.sdk.core.test_directory
Stack Traces | 0s run time
ImportError while importing test module '.../sdk/core/test_directory.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
.../sdk/core/test_directory.py:8: in <module>
    from codegen.sdk.codebase.codebase_graph import CodebaseGraph
E   ModuleNotFoundError: No module named 'codegen.sdk.codebase.codebase_graph'

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@clee-codegen
Copy link
Contributor Author

@bagel897 @EdwardJXLi what do ya'll think about this refactor for this "directory-like" API referred to in the ticket ?

@clee-codegen
Copy link
Contributor Author

unit tests are wip

@clee-codegen clee-codegen marked this pull request as ready for review February 7, 2025 00:48
@clee-codegen clee-codegen requested review from codegen-team and a team as code owners February 7, 2025 00:48
@clee-codegen clee-codegen requested a review from bagel897 February 7, 2025 20:23
@clee-codegen clee-codegen merged commit 10b66cf into develop Feb 11, 2025
16 of 17 checks passed
@clee-codegen clee-codegen deleted the clee-cg-10650-for-file-in-codebasecodeowners0 branch February 11, 2025 18:54
Copy link
Contributor

🎉 This PR is included in version 0.7.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.

4 participants