From 139fabab022a7ef615ab5989d1127fea026efca8 Mon Sep 17 00:00:00 2001 From: Leszek Lugin Date: Wed, 10 Jul 2024 16:39:15 +0200 Subject: [PATCH] Change check for excluded first when updating a file No point for calling _get_modified_year() for excluded files. --- pontos/updateheader/updateheader.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/pontos/updateheader/updateheader.py b/pontos/updateheader/updateheader.py index e6e6843ab..c132405fb 100644 --- a/pontos/updateheader/updateheader.py +++ b/pontos/updateheader/updateheader.py @@ -350,19 +350,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,