Skip to content

Commit 62a908d

Browse files
Extend C code style check to framework files
Signed-off-by: Ronald Cron <[email protected]>
1 parent 1e05deb commit 62a908d

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

scripts/code_style.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,37 @@ def get_src_files(since: Optional[str]) -> List[str]:
7575
output = subprocess.check_output(["git", "ls-files"] + file_patterns,
7676
universal_newlines=True)
7777
src_files = output.split()
78+
output = subprocess.check_output(["git", "-C", "framework", "ls-files"]
79+
+ file_patterns, universal_newlines=True)
80+
framework_src_files = output.split()
81+
7882
if since:
79-
# get all files changed in commits since the starting point
80-
cmd = ["git", "log", since + "..HEAD", "--name-only", "--pretty=", "--"] + src_files
83+
# get all files changed in commits since the starting point in ...
84+
# ... the main repository
85+
cmd = ["git", "log", since + "..HEAD", "--ignore-submodules",
86+
"--name-only", "--pretty=", "--"] + src_files
8187
output = subprocess.check_output(cmd, universal_newlines=True)
8288
committed_changed_files = output.split()
83-
# and also get all files with uncommitted changes
89+
# ... the framework submodule
90+
cmd = ["git", "-C", "framework", "log", since + "..HEAD",
91+
"--name-only", "--pretty=", "--"] + framework_src_files
92+
output = subprocess.check_output(cmd, universal_newlines=True)
93+
committed_changed_files += ["framework/" + s for s in output.split()]
94+
95+
# and also get all files with uncommitted changes in ...
96+
# ... the main repository
8497
cmd = ["git", "diff", "--name-only", "--"] + src_files
8598
output = subprocess.check_output(cmd, universal_newlines=True)
8699
uncommitted_changed_files = output.split()
87-
src_files = list(set(committed_changed_files + uncommitted_changed_files))
100+
# ... the framework submodule
101+
cmd = ["git", "-C", "framework", "diff", "--name-only", "--"] + \
102+
framework_src_files
103+
output = subprocess.check_output(cmd, universal_newlines=True)
104+
uncommitted_changed_files += ["framework/" + s for s in output.split()]
105+
106+
src_files = committed_changed_files + uncommitted_changed_files
107+
else:
108+
src_files += ["framework/" + s for s in framework_src_files]
88109

89110
generated_files = list_generated_files()
90111
# Don't correct style for third-party files (and, for simplicity,

0 commit comments

Comments
 (0)