@@ -48,7 +48,8 @@ def commit(cls, message: str, current_version: str, new_version: str, extra_args
48
48
env ["BUMPVERSION_NEW_VERSION" ] = new_version
49
49
50
50
try :
51
- subprocess .run ([* cls ._COMMIT_COMMAND , f .name , * extra_args ], env = env , capture_output = True , check = True )
51
+ cmd = [* cls ._COMMIT_COMMAND , f .name , * extra_args ]
52
+ subprocess .run (cmd , env = env , capture_output = True , check = True ) # noqa: S603
52
53
except subprocess .CalledProcessError as exc : # pragma: no-coverage
53
54
err_msg = f"Failed to run { exc .cmd } : return code { exc .returncode } , output: { exc .output } "
54
55
logger .exception (err_msg )
@@ -60,7 +61,7 @@ def commit(cls, message: str, current_version: str, new_version: str, extra_args
60
61
def is_usable (cls ) -> bool :
61
62
"""Is the VCS implementation usable."""
62
63
try :
63
- result = subprocess .run (cls ._TEST_USABLE_COMMAND , check = True , capture_output = True )
64
+ result = subprocess .run (cls ._TEST_USABLE_COMMAND , check = True , capture_output = True ) # noqa: S603
64
65
return result .returncode == 0
65
66
except (FileNotFoundError , PermissionError , NotADirectoryError , subprocess .CalledProcessError ):
66
67
return False
@@ -89,7 +90,7 @@ def tag(cls, name: str, sign: bool = False, message: Optional[str] = None) -> No
89
90
def get_all_tags (cls ) -> List [str ]:
90
91
"""Return all tags in VCS."""
91
92
try :
92
- result = subprocess .run (cls ._ALL_TAGS_COMMAND , text = True , check = True , capture_output = True )
93
+ result = subprocess .run (cls ._ALL_TAGS_COMMAND , text = True , check = True , capture_output = True ) # noqa: S603
93
94
return result .stdout .splitlines ()
94
95
except (FileNotFoundError , PermissionError , NotADirectoryError , subprocess .CalledProcessError ):
95
96
return []
@@ -189,7 +190,7 @@ def assert_nondirty(cls) -> None:
189
190
"""Assert that the working directory is not dirty."""
190
191
lines = [
191
192
line .strip ()
192
- for line in subprocess .check_output (["git" , "status" , "--porcelain" ]).splitlines ()
193
+ for line in subprocess .check_output (["git" , "status" , "--porcelain" ]).splitlines () # noqa: S603, S607
193
194
if not line .strip ().startswith (b"??" )
194
195
]
195
196
@@ -202,7 +203,7 @@ def latest_tag_info(cls, tag_pattern: str) -> SCMInfo:
202
203
"""Return information about the latest tag."""
203
204
try :
204
205
# git-describe doesn't update the git-index, so we do that
205
- subprocess .run (["git" , "update-index" , "--refresh" , "-q" ], capture_output = True )
206
+ subprocess .run (["git" , "update-index" , "--refresh" , "-q" ], capture_output = True ) # noqa: S603, S607
206
207
except subprocess .CalledProcessError as e :
207
208
logger .debug ("Error when running git update-index: %s" , e .stderr )
208
209
return SCMInfo (tool = cls )
@@ -220,7 +221,7 @@ def latest_tag_info(cls, tag_pattern: str) -> SCMInfo:
220
221
"--abbrev=40" ,
221
222
f"--match={ tag_pattern } " ,
222
223
]
223
- result = subprocess .run (git_cmd , text = True , check = True , capture_output = True )
224
+ result = subprocess .run (git_cmd , text = True , check = True , capture_output = True ) # noqa: S603
224
225
describe_out = result .stdout .strip ().split ("-" )
225
226
except subprocess .CalledProcessError as e :
226
227
logger .debug ("Error when running git describe: %s" , e .stderr )
@@ -243,7 +244,7 @@ def latest_tag_info(cls, tag_pattern: str) -> SCMInfo:
243
244
@classmethod
244
245
def add_path (cls , path : Union [str , Path ]) -> None :
245
246
"""Add a path to the VCS."""
246
- subprocess .check_output (["git" , "add" , "--update" , str (path )])
247
+ subprocess .check_output (["git" , "add" , "--update" , str (path )]) # noqa: S603, S607
247
248
248
249
@classmethod
249
250
def tag (cls , name : str , sign : bool = False , message : Optional [str ] = None ) -> None :
@@ -263,7 +264,7 @@ def tag(cls, name: str, sign: bool = False, message: Optional[str] = None) -> No
263
264
command += ["--sign" ]
264
265
if message :
265
266
command += ["--message" , message ]
266
- subprocess .check_output (command )
267
+ subprocess .check_output (command ) # noqa: S603
267
268
268
269
269
270
class Mercurial (SourceCodeManager ):
@@ -279,23 +280,23 @@ def latest_tag_info(cls, tag_pattern: str) -> SCMInfo:
279
280
current_version = None
280
281
re_pattern = tag_pattern .replace ("*" , ".*" )
281
282
result = subprocess .run (
282
- ["hg" , "log" , "-r" , f"tag('re:{ re_pattern } ')" , "--template" , "{latesttag}\n " ],
283
+ ["hg" , "log" , "-r" , f"tag('re:{ re_pattern } ')" , "--template" , "{latesttag}\n " ], # noqa: S603, S607
283
284
text = True ,
284
285
check = True ,
285
286
capture_output = True ,
286
287
)
287
288
result .check_returncode ()
288
289
if result .stdout :
289
290
current_version = result .stdout .splitlines (keepends = False )[0 ].lstrip ("v" )
290
- is_dirty = len (subprocess .check_output (["hg" , "status" , "-mard" ])) != 0
291
+ is_dirty = len (subprocess .check_output (["hg" , "status" , "-mard" ])) != 0 # noqa: S603, S607
291
292
return SCMInfo (tool = cls , current_version = current_version , dirty = is_dirty )
292
293
293
294
@classmethod
294
295
def assert_nondirty (cls ) -> None :
295
296
"""Assert that the working directory is clean."""
296
297
lines = [
297
298
line .strip ()
298
- for line in subprocess .check_output (["hg" , "status" , "-mard" ]).splitlines ()
299
+ for line in subprocess .check_output (["hg" , "status" , "-mard" ]).splitlines () # noqa: S603, S607
299
300
if not line .strip ().startswith (b"??" )
300
301
]
301
302
@@ -329,7 +330,7 @@ def tag(cls, name: str, sign: bool = False, message: Optional[str] = None) -> No
329
330
raise SignedTagsError ("Mercurial does not support signed tags." )
330
331
if message :
331
332
command += ["--message" , message ]
332
- subprocess .check_output (command )
333
+ subprocess .check_output (command ) # noqa: S603
333
334
334
335
335
336
def get_scm_info (tag_pattern : str ) -> SCMInfo :
0 commit comments