Skip to content

Add files report #139

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 7 commits into from
Dec 20, 2024
Merged

Add files report #139

merged 7 commits into from
Dec 20, 2024

Conversation

Pennycook
Copy link
Contributor

Introduces a new files report that visualizes the entire code base as a tree with a format inspired by the "tree" utility.

Information about the platforms and SLOC used by each node in the tree is printed similar to tree's "metafirst" output, in the format:

[Platforms | Used SLOC / Total SLOC | Code Divergence | Code Utilization]

Colors and formatting are all hard-coded in this initial version, but the long-term plan is to allow configuration via the .cbi/config file.

Related issues

N/A

Proposed changes

  • Add a new FileTree object to represent a directory of files + associated platform information hierarchically.
  • Add a new files report that builds a FileTree for a CodeBase and prints a colored version to the terminal.
  • Add a bunch of tests for FileTree and associated functionality.

@laserkelvin - I can only apologize for this being such a big diff... The feature proved really complicated to get right, and even after a bunch of refactoring I couldn't really find a good way to split things up for review. I completely understand if this takes you a while!


Here's an example of the current output:

image

@Pennycook Pennycook added the enhancement New feature or request label Dec 12, 2024
@Pennycook Pennycook added this to the 2.0.0 milestone Dec 12, 2024
return f"{x/10**6:.1f}M"
elif digits <= 12:
return f"{x/10**9:.1f}G"
return "??????"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe ******* instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 987692c.

if not isinstance(x, numbers.Integral):
raise TypeError("x must be Integral")

digits = len(str(x))
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use log10 instead LOL

Introduces a new files report that visualizes the entire code base as a tree
with a format inspired by the "tree" utility.

Information about the platforms and SLOC used by each node in the tree is
printed similar to tree's "metafirst" output, in the format:

[Platforms | Used SLOC / Total SLOC | Code Divergence | Code Utilization]

Colors and formatting are all hard-coded in this initial version, but the
long-term plan is to allow configuration via the .cbi/config file.

Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Listing out the column names in full allows us to convey what the
meta-information shows more clearly than adding short column headers, and does
not require any complicated justification/padding logic for the different
columns.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook merged commit f57bea6 into intel:main Dec 20, 2024
3 checks passed
@Pennycook Pennycook deleted the file-tree branch December 20, 2024 09:18
@Pennycook Pennycook mentioned this pull request Dec 20, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants