-
Notifications
You must be signed in to change notification settings - Fork 5
Add analyze references cmd #86
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
Conversation
dacharyc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At a high level, this seems like useful functionality, but is missing some considerations that would make it function as-advertised. It's currently going to miss references via a few different avenues.
dacharyc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Back to you for some fixups - mainly related to the changes to the analyze includes command.
e92aaa5 to
1f63808
Compare
dacharyc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, LGTM - just a couple of small comments/requests.
audit-cli/README.md
Outdated
|
|
||
| #### `analyze file-references` | ||
|
|
||
| Find all files that reference a target file through RST directives. This performs reverse dependency analysis, showing which files reference the target file through `include`, `literalinclude`, `io-code-block`, or `toctree` directives. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we note in here somewhere near the beginning that "file references" does not include :ref:s? I could see some writers interpreting "references" as including the "ref" role and I'm wondering if we should call out that it doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per Slack convo, renamed to analyze usages
Added missing flags to the NewFileReferencesCommand comment: - --summary - --include-toctree - --exclude These flags were added during improvements but the comment wasn't updated.
4c1cde0 to
5782b7c
Compare
- Rename directory from file-references/ to usage/ - Update package name from filereferences to usage - Change command from 'file-references' to 'usage' (shorter, clearer) - Update all documentation and help text - Update README with new command examples - All tests pass The new 'analyze usage' command is shorter (13 vs 24 chars) and more accurately describes what it does: finding where a file is used.
- Rename file_references.go to usage.go - Rename file_references_test.go to usage_test.go - Update README to reflect correct filenames - All tests still pass
- Change 'REFERENCE ANALYSIS' to 'USAGE ANALYSIS' in output header - Change 'Total References' to 'Total Usages' throughout output - Update 'No files reference' to 'No files use' in messages - Update README examples to show 'Total Usages' instead of 'Total References' - Keep internal type names (ReferenceAnalysis, FileReference) unchanged for API stability - Keep JSON field names unchanged for backward compatibility
- Rename AnalyzeReferences() to AnalyzeUsage() - Rename findReferencesInFile() to findUsagesInFile() - Rename GroupReferencesByFile() to GroupUsagesByFile() - Rename runReferences() to runUsage() - Update all type names: - ReferenceAnalysis -> UsageAnalysis - FileReference -> FileUsage - ReferenceNode -> UsageNode - GroupedFileReference -> GroupedFileUsage - Update all field names: - ReferencingFiles -> UsingFiles - ReferenceTree -> UsageTree - TotalReferences -> TotalUsages - ReferencePath -> UsagePath - References -> Usages - Update JSON field names for consistency: - total_references -> total_usages - referencing_files -> using_files - reference_path -> usage_path - Update all test functions and test data - Update all comments and documentation All tests pass. No backward compatibility concerns per user request.
- Change 'REFERENCE ANALYSIS' header to 'USAGE ANALYSIS' - Update '4 references' to '4 usages' in example output - Update JSON field names in examples: - total_references -> total_usages - referencing_files -> using_files - reference_path -> usage_path - Update command examples to use 'usages' instead of 'references' - Update jq example to query '.total_usages' instead of '.total_references'
|
@dacharyc not sure if you wanted to take another look, but I've renamed to |
dacharyc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't check it out and run it, but with a cursory scan, it looks like the rename pass has caught everything, so I think this is good to merge!
Adds a new
analyze referencescommand that finds all files that reference a target file.internal/pathresolverinclude,literalinclude,io-code-block