This checks the files that aren't modified by any of the commits that are in the revision range.
This is not completely failsafe as checkpatch.pl tend to check better what's touched by a patch, in the case of modifications that do not touch C code: - Checking for scripts/spelling.txt with checkpatch.pl -f doesn't raise any errors or warnings. - Checking the patch that adds scripts/spelling.txt raise a lot of warnings. However checkpatch.pl seem to find issues in C code regardless of whether the code is checked as part of individual files or as part of a patch. Signed-off-by: Denis 'GNUtoo' Carikli <gnu...@cyberdimension.org> --- scripts/check_code_style_conversion.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/check_code_style_conversion.py b/scripts/check_code_style_conversion.py index f5e14d3..8f9ad77 100755 --- a/scripts/check_code_style_conversion.py +++ b/scripts/check_code_style_conversion.py @@ -59,6 +59,14 @@ def git_get_commit_list(revision_range): def get_revision_files(revision): return git("ls-tree", "--name-only", '-r', revision).split(os.linesep)[:-1] +def check_file(filepath): + try: + file_report = run("scripts" + os.sep + "checkpatch.pl", + "-f", filepath) + print(" [ OK ] {}".format(filepath)) + except: + print(" [ !! ] {}".format(filepath)) + def checkpatch(revision_range, full_check=False): repository_files = [] if full_check: @@ -78,12 +86,7 @@ def checkpatch(revision_range, full_check=False): # Check the files of the commit modified_files = git_get_diffed_files(commit, commit + "~1") for modified_file in modified_files: - try: - file_report = run("scripts" + os.sep + "checkpatch.pl", - "-f", modified_file) - print(" [ OK ] {}".format(modified_file)) - except: - print(" [ !! ] {}".format(modified_file)) + check_file(modified_file) if full_check: if modified_file in repository_files: repository_files.remove(modified_file) @@ -92,7 +95,7 @@ def checkpatch(revision_range, full_check=False): if len(repository_files) > 0: print("Files not in {}:".format(revision_range)) for path in repository_files: - print(" [ !! ] {}".format(path)) + check_file(path) if __name__ == '__main__': if len(sys.argv) == 2: -- 2.27.0 _______________________________________________ Replicant mailing list Replicant@osuosl.org https://lists.osuosl.org/mailman/listinfo/replicant