Skip to content

Expose tree report as standalone cbi-tree utility #167

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 8 commits into from
Apr 3, 2025

Conversation

Pennycook
Copy link
Contributor

Related issues

Proposed changes

  • Remove -R tree option from codebasin, replacing it with a standalone cbi-tree script.
  • Add new --levels option inspired by tree, which gives users control over how deep the tree should be.
  • Add new --prune option inspired by tree, which gives users control over handling of unused files.

@laserkelvin, since you originally requested this functionality, I'd appreciate it if you could download this one and experiment with it a little bit in addition to reviewing the code, to make sure that it behaves the way that you would expect.

I was a little uncertain about the output format, because it's no longer a report that is generated from codebasin. At the time of opening this PR, the output looks like this:

image

...where we lose quite a lot of vertical space to the legend and column headings. Utilities like ls -l and tree don't provide any sort of explanation as part of their default output, and I wonder if we should follow that precedent. For example, is this better:

image

@Pennycook Pennycook added enhancement New feature or request ux Issues and PRs pertaining to user experience labels Mar 3, 2025
@Pennycook Pennycook added this to the 2.0.0 milestone Mar 3, 2025
@Pennycook Pennycook requested a review from laserkelvin March 3, 2025 14:29
This initial commit just moves the existing functionality. Other changes to
reflect the new standalone nature of the utility (e.g., improved formatting,
additional options) will follow in subsequent commits.

Signed-off-by: John Pennycook <[email protected]>
The currently intended workflow for cbi-tree is to run codebasin first, and
ensure that it accurately analyzes the code base.  As such, we do not need to
display the full set of warnings from cbi-tree.

Over time, we can improve this workflow by making the relationship explicit
(e.g., by having codebasin produce a results directory that cbi-tree reads).

Signed-off-by: John Pennycook <[email protected]>
Only printed by cbi-tree.

Signed-off-by: John Pennycook <[email protected]>
Excludes unused files from the output and computed metrics.

Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
Signed-off-by: John Pennycook <[email protected]>
@Pennycook
Copy link
Contributor Author

The new regression test introduced in d37e8c0 resulted in a horrible merge conflict (because the tests look very similar). The easiest solution was just to rebase the new cbi-tree functionality on top of main.

Although --prune is a "long option", that's not what the "long" in
"is_long" refers to. Because --prune doesn't have a shorthand and
doesn't accept an argument, the description of the option is not
long enough to generate an initial newline.

Signed-off-by: John Pennycook <[email protected]>
@Pennycook Pennycook merged commit 36a4b39 into intel:main Apr 3, 2025
4 checks passed
@Pennycook Pennycook deleted the cbi-tree branch April 3, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ux Issues and PRs pertaining to user experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split tree functionality into standalone utility
2 participants