-
Notifications
You must be signed in to change notification settings - Fork 110
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
Create options for human-readable output formats #437
Conversation
Linting the test file `testdata/utf8ControlX88.pem` results in: ``` +-------+--------------+ | LEVEL | # OCCURANCES | +-------+--------------+ | info | 0 | | warn | 7 | | error | 15 | | fatal | 0 | +-------+--------------+ ```
Running: ```sh testdata/indivValAllBad.pem | ./zlint -longsummary ``` the output is: ``` +-------+--------------+------------------------------------------+ | LEVEL | # OCCURANCES | DETAILS | +-------+--------------+------------------------------------------+ | info | 0 | - | | warn | 1 | w_ext_san_critical_with_subject_dn | | error | 7 | e_ca_crl_sign_not_set | | | | e_sub_ca_crl_distribution_points_missing | | | | e_ca_country_name_missing | | | | e_cert_policy_iv_requires_country | | | | e_sub_cert_not_is_ca | | | | e_ca_key_cert_sign_not_set | | | | e_ca_organization_name_missing | | fatal | 0 | - | +-------+--------------+------------------------------------------+ ```
Wow, this is awesome. Seriously. Thanks for contributing that. I have been wanting something like this for a while but haven't had any time to work on it. |
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.
LGTM. Thanks!
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.
Hi @acaird,
Thanks for the PR! I only had a few minutes this morning and haven't had a chance to do a very thorough review. I did have a few comments worth sharing up front.
I'm not entirely convinced that removing the tablewriter dependency is worth it, but the new output looks like:
and
|
Tests and some consideration of moving the filtering elsewhere will come later. Thanks for all the feedback! |
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.
Thanks for the iteration on this @acaird! I really appreciate that you were able to rework the table code without the new dependency.
I left some review feedback in this round with some suggestions to refactor the outputSummary
func into smaller pieces. If you can handle that & take a crack at some test coverage I think we'll be in a good place to merge. I won't block this PR on trying to consolidate some of the filtering logic back into the ResultSet
type, we track that as a follow-up or a nice to have.
Thanks!
@cpu thanks for the feedback, I'll clean it up and write some tests, hopefully I'll get to it all within the next week or so |
- switched `-longsummary` option to `-longSummary` to be more consistent with existing options - fixed an embarrassing output bug when two categories had the same number of errors
👋 @acaird just wanted to check in on this branch. Do you feel like you'll have a chance to address the last bits of feedback in the next few weeks? If you think you might not have the time I definitely understand and would be happy to adopt this PR to get it across the line. Let me know what you would prefer! |
👋 @cpu. I haven't given up yet! If I can't get something worthwhile by Tuesday I'll put it up for adoption. Sorry for the delays... :/ |
Please don't apologize, take your time :-) I just want to make sure my feedback isn't the only thing keeping this from landed in tree. Thanks for the update! |
author Andrew Caird <acaird@gmail.com> 1590420366 -0400 committer Andrew Caird <acaird@gmail.com> 1593372751 -0400 Add a -summary option to print a short summary of the linting Linting the test file `testdata/utf8ControlX88.pem` results in: ``` +-------+--------------+ | LEVEL | # OCCURANCES | +-------+--------------+ | info | 0 | | warn | 7 | | error | 15 | | fatal | 0 | +-------+--------------+ ``` and a -longSummary option and output Running: ```sh testdata/indivValAllBad.pem | ./zlint -longsummary ``` the output is: ``` +-------+--------------+------------------------------------------+ | LEVEL | # OCCURANCES | DETAILS | +-------+--------------+------------------------------------------+ | info | 0 | - | | warn | 1 | w_ext_san_critical_with_subject_dn | | error | 7 | e_ca_crl_sign_not_set | | | | e_sub_ca_crl_distribution_points_missing | | | | e_ca_country_name_missing | | | | e_cert_policy_iv_requires_country | | | | e_sub_cert_not_is_ca | | | | e_ca_key_cert_sign_not_set | | | | e_ca_organization_name_missing | | fatal | 0 | - | +-------+--------------+------------------------------------------+ ```
Co-authored-by: tld-update-bot <cpu+tldbot@letsencrypt.org>
Co-authored-by: tld-update-bot <cpu+tldbot@letsencrypt.org>
Writing tests in |
@acaird Splitting would be my pref. but it's lightly held. If you find it easier to keep working through main that's OK with me. I don't want to hold you up :-) |
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.
With three other +1 reviews I don't want to hold this useful addition to zlint
up any longer on my request for unit tests. I think there's room for flexibility here, especially given it isn't adding or changing any linting logic so i'll go ahead and stamp + merge.
@acaird If you've already started on tests a follow-up PR to add what you have would be great. Thanks!
@zakird Thanks for merging, was just typing out a squash commit message. |
oh 🤦 sorry about that! |
No worries :-) Happy it's all merged up 🎉 |
Thanks for merging it. I'm glad it's useful. I'm sorry about the tests, they are still forthcoming. |
Added a
-summary
and-longsummary
options tozlint
.The
-summary
option produces output that looks like:and the
-longsummary
produces output that looks like:The only significant changes to zlint was to export
statusLabelToLintStatus
fromresult.go
and to pull intablewriter
.Thanks for considering these changes.