[beman-tidy] Created file.copyright checks (dry-run & fix-inplace) | Added multiple_files_base_check#219
Conversation
Have found a better solution regarding modularity, will refactor after testing this.
|
@neatudarius can you take a look at this? |
neatudarius
left a comment
There was a problem hiding this comment.
Thanks @AndreiDurlea for 1) interest in Beman Project and for 2) this big contribution!
Your PR actually delivers the functionality we need, but I have some suggestions related to the style of code, file organization, and new APIs added:
| @@ -1,10 +1,10 @@ | |||
| version = 1 | |||
| revision = 2 | |||
| revision = 3 | |||
There was a problem hiding this comment.
No, it was accidental when syncing deps. Reverting it
| return True | ||
|
|
||
|
|
||
| @register_beman_standard_check("file.copyright") |
There was a problem hiding this comment.
Please check this is a "recommendation" here https://github.com/AndreiDurlea/beman-tidy/blob/origin/andreidurlea-issue57/beman_tidy/.beman-standard.yml#L130-L131. Seems to be OK.
| if "SPDX-License-Identifier:" in line: | ||
| spdx_index = i | ||
| break | ||
|
|
There was a problem hiding this comment.
it's validation of result from previous loop
| return True | ||
|
|
||
| def fix(self): | ||
| try: |
| return True | ||
|
|
||
| spdx_index = -1 | ||
|
|
| if spdx_index == -1: | ||
| return True | ||
|
|
||
| spdx_line = lines[spdx_index].strip() |
| from .base_check import BaseCheck | ||
|
|
||
|
|
||
| class MultipleFilesBaseCheck(BaseCheck): |
There was a problem hiding this comment.
Final step, let's rename this to BatchFileBaseCheck and move into base/file_base_check.py. We don't need a new file, it's actually connected to FileBaseCheck.
Co-authored-by: Darius Neațu <neatudarius@gmail.com>
Co-authored-by: Darius Neațu <neatudarius@gmail.com>
"source" to cpp Co-authored-by: Darius Neațu <neatudarius@gmail.com>

Solved issue - #57
Introduced a new infrastructure for running
FileBaseCheck's across multiple source files, while registering only one (main) check, that passes if all its checks pass, and fails otherwise.Changes:
MultipleFilesBaseCheckas a new base class to support checks that need to operate on all source files in a repository, handling iteration through files, logging, and check&fix logic.TODO: