-
Notifications
You must be signed in to change notification settings - Fork 11
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
Update header #987
Update header #987
Conversation
Conventional Commits Report
🚀 Conventional commits found. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #987 +/- ##
==========================================
+ Coverage 90.21% 90.37% +0.15%
==========================================
Files 103 103
Lines 6961 6958 -3
Branches 986 986
==========================================
+ Hits 6280 6288 +8
+ Misses 479 471 -8
+ Partials 202 199 -3 ☔ View full report in Codecov by Sentry. |
Extend temp_file context manager to support also creating binary files.
Split the tests into separate test cases for each function and use context managers for creating temporary directories and files wherever possible. This avoids leaked files if a test fails.
Strip code from update_header that is related to CLI arguments.
We have a dedicated class for handling git related tasks. Therefore we should use it here too.
Ensure that the defaults are set and parsed correctly.
Extract testing of get_exclude_list into an own test case and simplify parse_args test case.
The update_header function just expect a year, license and company name at the end.
It's more likely that the exclude file doesn't exist. Therefore it is better to check is the file exists then reacting on the file not found exception.
For easy iterations that create a list from a list it's better to use list comprehension and also it should be faster.
List and Tuple are obsolete with PEP 585 and Python 3.9.
Don't pass the cleanup_regexes to the function and instead just add a flag to cleanup the updated file instead.
Improved usage and print also the defaults.
--year is the fallback of --changed if the year of the last git modification can't be calculated. Therefore it should be allowed to be set in conjunction with --changed.
We need a regex that matches all kind of company names not only Greenbone. This also generalizes the code and makes update-header independent of Greenbone specific use cases.
Improve the performance for creating the regexp pattern by caching them. With this change they will be created on demand once and afterwards they are used from the cache.
b5ae3ab
to
2a394c3
Compare
What
Improve
pontos-update-header
CLIWhy
Currently it's not possible to overwrite the company in copyright headers if it doesn't fit to Greenbone.
References
DOS-175
Checklist