Skip to content

Commit

Permalink
Make code_style.py -s more precise
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
  • Loading branch information
daverodgman committed Jul 27, 2023
1 parent ae68c09 commit b96dbc6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions scripts/code_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ def get_src_files(since: Optional[str]) -> List[str]:
universal_newlines=True)
src_files = output.split()
if since:
output = subprocess.check_output(["git", "diff", "--name-only",
since, "--"] +
src_files,
universal_newlines=True)
src_files = output.split()
# get all files changed in commits since the starting point
cmd = ["git", "log", since + "..HEAD", "--name-only", "--pretty=", "--" ] + src_files
output = subprocess.check_output(cmd, universal_newlines=True)
committed_changed_files = output.split()
# and also get all files with uncommitted changes
cmd = ["git", "diff", "--name-only", "--" ] + src_files
output = subprocess.check_output(cmd, universal_newlines=True)
uncommitted_changed_files = output.split()
src_files = set(committed_changed_files + uncommitted_changed_files)

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

0 comments on commit b96dbc6

Please sign in to comment.