Skip to content

Commit 048700c

Browse files
authored
Enable ruff's flake8-bandit (S) rules (#2892)
1 parent 1cc2681 commit 048700c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pygmt/helpers/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ def launch_external_viewer(fname, waiting=0):
501501
elif os_name == "darwin": # Darwin is macOS
502502
subprocess.run([shutil.which("open"), fname], check=False, **run_args)
503503
elif os_name == "win32":
504-
os.startfile(fname)
504+
os.startfile(fname) # noqa: S606
505505
else:
506506
webbrowser.open_new_tab(f"file://{fname}")
507507
if waiting > 0:

pyproject.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ select = [
118118
"PIE", # flake8-pie
119119
"PL", # pylint
120120
"RSE", # flake8-raise
121+
"S", # flake8-bandit
121122
"SIM", # flake8-simplify
122123
"TCH", # flake8-type-checking
123124
"TID", # flake8-tidy-imports
@@ -126,18 +127,20 @@ select = [
126127
"YTT", # flake8-2020
127128
]
128129
ignore = [
129-
"E501", # Avoid enforcing line-length violations
130-
"ISC001", # Single-line-implicit-string-concatenation, conflict with formatter
131-
"PD901", # Allow using the generic variable name `df` for DataFrames
130+
"E501", # Avoid enforcing line-length violations
131+
"ISC001", # Single-line-implicit-string-concatenation, conflict with formatter
132+
"PD901", # Allow using the generic variable name `df` for DataFrames
132133
"PLR2004", # Allow any magic values
133-
"SIM117", # Allow nested `with` statements
134+
"S603", # Allow method calls that initiate a subprocess without a shell
135+
"SIM117", # Allow nested `with` statements
134136
]
135137

136138
[tool.ruff.lint.isort]
137139
known-third-party = ["pygmt"]
138140

139141
[tool.ruff.lint.per-file-ignores]
140142
"__init__.py" = ["F401"] # Ignore `F401` (unused-import) in all `__init__.py` files
143+
"*/tests/test_*.py" = ["S101"] # Ignore `S101` (use of assert) in all tests files
141144

142145
[tool.ruff.lint.pycodestyle]
143146
max-doc-length = 79

0 commit comments

Comments
 (0)