-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add new Ratio output type --output-format=Ratio #167
Conversation
@@ -22,6 +22,7 @@ pub enum OutputFormat { | |||
Json, | |||
GitHubMarkdown, | |||
Utf8, | |||
Ratio, |
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.
Could you order the OutputFormat
types alphabetically here and in the updated help message please?
); | ||
colorize(&status, output_format, output) | ||
match output_format { | ||
OutputFormat::Ratio => { |
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.
Would it be possible to split out two functions here, one for OutputFormat::Ratio
and one for _
with unit tests for each? It might be nice to have a function and tests for the ratio calculation too?
…atio and _ into two functions; adding a test case for regression
Thanks for the suggestions, just committed these changes: reorder |
@jmcconnell26 Thanks for the review! I managed to miss this PR notice. |
Another perspective for future improvements: Perhaps we should have both |
That's a good suggestion, @anderejd. I will work on this after the PR is merged. |
It looks like the review comments have been addressed, merging. |
I work on Huawei's Trusted Programming project, which was recently asked to report for Rust projects the "safe ratios", i.e. percentages of items that are safe. This could be done using
cargo-geiger
; however, currently it counts unsafe items, rather than reports the safety ratios,I've completed a working prototype for this by adding
--output-format=Ratio
as an option to the command. If someone with more experience developing incargo-geiger
can give this an early look and send feedback, that would be really helpful.Apologies in advance for the current lack of tests and limited documentation. I'll be working on this full time for a while, so it will improve rapidly.
Thanks!