99from .config import PoFilePair , RepositoryConfig , UpdateTranslationsConfig
1010from .git import commit_and_push_files , repository_in_clean_state
1111from .html_tags import forbidden_tags
12- from .logging import LOGGER
12+ from .logger import LOGGER
1313from .portable_object import (
1414 remove_header ,
1515 remove_last_translator ,
@@ -47,7 +47,7 @@ def run(config: UpdateTranslationsConfig) -> int:
4747 case _Failure ():
4848 LOGGER .error (
4949 "Encountered an error while processing the .po file pair. "
50- "See the logging output at the end for more information."
50+ "See the logging output at the end for more information." ,
5151 )
5252 failures .append (result )
5353 case _:
@@ -85,26 +85,33 @@ def _process_po_file_pair(
8585 locale_po_file = locale_repo .path / file_pair .locale
8686 LOGGER .info ("Checking for formatting errors in %s" , locale_po_file )
8787 try :
88- run_subprocess (
89- ["msgfmt" , "--check-format" , "-o" , "-" , locale_po_file ],
88+ run_subprocess ( # noqa: S603
89+ [
90+ "/usr/bin/msgfmt" ,
91+ "--check-format" ,
92+ "-o" ,
93+ "-" ,
94+ locale_po_file ,
95+ ],
9096 check = True ,
9197 stdout = DEVNULL ,
9298 stderr = PIPE ,
9399 encoding = "UTF-8" ,
94100 )
95101 except CalledProcessError as e :
96102 return _Failure (
97- error_message = f"Found formatting errors: { e .stderr } " , path = locale_po_file
103+ error_message = f"Found formatting errors: { e .stderr } " ,
104+ path = locale_po_file ,
98105 )
99- except IOError as e :
106+ except OSError as e :
100107 return _Failure (error_message = str (e ), path = locale_po_file )
101108
102109 LOGGER .info ("Reading %s" , locale_po_file )
103110 try :
104111 po_file_content = locale_po_file .read_text ()
105- except IOError as e :
112+ except OSError as e :
106113 return _Failure (
107- error_message = f"Encountered error while reading file: { str ( e ) } " ,
114+ error_message = f"Encountered error while reading file: { e } " ,
108115 path = locale_po_file ,
109116 )
110117
@@ -122,19 +129,19 @@ def _process_po_file_pair(
122129 LOGGER .info ("Writing stripped .po file to checkmk repository: %s" , checkmk_po_file )
123130 try :
124131 checkmk_po_file .write_text (po_file_content )
125- except IOError as e :
132+ except OSError as e :
126133 return _Failure (
127- f"Encountered error while writing po file to checkmk repository: { e } " ,
128- checkmk_po_file ,
134+ error_message = f"Encountered error while writing po file to checkmk repository: { e } " ,
135+ path = checkmk_po_file ,
129136 )
130137 return _Success (checkmk_po_file )
131138
132139
133140def _is_repo_dirty (repo : Repo ) -> bool :
134141 try :
135142 return repo .is_dirty (untracked_files = True )
136- except Exception as e :
143+ except Exception :
137144 LOGGER .error (
138- "Checking if any .po files changed in the checkmk repository failed"
145+ "Checking if any .po files changed in the checkmk repository failed" ,
139146 )
140- raise e
147+ raise
0 commit comments