-
Notifications
You must be signed in to change notification settings - Fork 456
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
feat(checkers): add pre-commit hook for reformatting checkers table #1290
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1290 +/- ##
==========================================
- Coverage 78.96% 78.16% -0.80%
==========================================
Files 262 263 +1
Lines 4801 4846 +45
Branches 578 589 +11
==========================================
- Hits 3791 3788 -3
- Misses 856 904 +48
Partials 154 154
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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 like that it'll be automated now! 👍
-
Maybe add a remark about this hook in the checkers readme after the line "Once the checker is added, its name should also be added to
__init__.py
", something like "If you havepre-commit
installed your next commit will trigger pre-commit [hook](link to this hook
) to automatically update checkers tables, or you can run it manually withpre-commit run format_checkers
-
Maybe add total number of checkers to the table? Should be easy (it's over 100 now!)
-
I wanted to see how the table with not full last row will look but right now there are exactly 7 * 15 checkers heh. So I went to double check and I see two files for curl,
curl.py
andlibcurl.py
. Both point to the same CVE references but I'm not sure they are different tools or not (one is lib, another is CLI tool?). Onlycurl
is in the checker list though,libcurl
is not there. @terriko, am I missing something? Either this checker should be added to the list or one file removed? -
When I try to run this hook I get an error, any idea what might be wrong?
(cve-bin-tool-venv) molkree@DESKTOP-V2SIETN:~/cve-bin-tool$ python -m cve_bin_tool -V
/home/molkree/cve-bin-tool-venv/bin/python: No module named cve_bin_tool.__main__; 'cve_bin_tool' is a package and cannot be directly executed
(cve-bin-tool-venv) molkree@DESKTOP-V2SIETN:~/cve-bin-tool$ python -m cve_bin_tool.cli -V
2.2
|
||
def max_checker_length(checkers): | ||
"""Returns a list of max length of each column""" | ||
checkers[-1].extend([""] * (CHECKERS_TABLE_SIZE - len(checkers[-1]))) |
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.
@Molkree This should handle the case you mentioned
This is weird. Have you tried running |
Yes. |
Broke this with the other pre-commit merge. I've tried to fix via web interface (which is often a disaster for black because it's hard to see whitespace correctly) so you might want to verify the fix. |
Answer for @Molkree : Yes, libcurl.py and curl.py used to refer to command line tool vs library. I believe they got merged to just curl.py when @Niraj-Kamdar refactored the checkers last year so it should detect both, but I'll open an issue to look at it and likely remove the file. |
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'm not sure why it's not working for @Molkree but it's working for me and seems to be working in CI. We may get some weirdness when I merge it because I merged some checkers before merging this.
Actually, it's not added to CI now, and it probably should be. |
No description provided.