aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-06-10 08:53:33 +0200
committerDenis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>2020-06-25 20:05:12 +0200
commit8d42d461b25b7f1e77ad39d3da01bf764eec8f1e (patch)
tree4a2821caddf1c6c449276f126c441475c2be66f1 /scripts
parent1e29d700d2799313f90209c9baccb9c356b509e7 (diff)
downloadhardware_replicant_libsamsung-ipc-8d42d461b25b7f1e77ad39d3da01bf764eec8f1e.tar.gz
hardware_replicant_libsamsung-ipc-8d42d461b25b7f1e77ad39d3da01bf764eec8f1e.tar.bz2
hardware_replicant_libsamsung-ipc-8d42d461b25b7f1e77ad39d3da01bf764eec8f1e.zip
check_code_style_conversion.py: also check files that are not the revision range
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 <GNUtoo@cyberdimension.org> Reviewed-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check_code_style_conversion.py17
1 files 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: