Skip to content

Commit

Permalink
Change check for excluded first when updating a file
Browse files Browse the repository at this point in the history
No point for calling _get_modified_year() for excluded files.
  • Loading branch information
llugin committed Jul 10, 2024
1 parent 405ded6 commit 777e61e
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions pontos/updateheader/updateheader.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,19 +348,20 @@ def main(args: Optional[Sequence[str]] = None) -> None:
sys.exit(1)

for file in files:
if changed:
try:
year = _get_modified_year(file)
except PontosError:
term.warning(
f"{file}: Could not get date of last modification"
f" via git, using {year} instead."
)

try:
if file.absolute() in exclude_list:
term.warning(f"{file}: Ignoring file from exclusion list.")
else:
if changed:
try:
year = _get_modified_year(file)
except PontosError:
term.warning(
f"{file}: Could not get date of last modification"
f" via git, using {year} instead."
)

update_file(
file,
year,
Expand Down

0 comments on commit 777e61e

Please sign in to comment.