Skip to content

Commit 3468032

Browse files
Enable S (flake8-bandit) ruleset and fix violations. (#1404)
Co-authored-by: Matt Fisher <3608264+mfisher87@users.noreply.github.com>
1 parent 343718e commit 3468032

3 files changed

Lines changed: 8 additions & 9 deletions

File tree

earthaccess/store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def make_instance(
183183
# NOTE: This uses the first data_link listed in the granule. That's not
184184
# guaranteed to be the right one.
185185
return earthaccess.open([granule])[0]
186-
return EarthAccessFile(loads(data), granule)
186+
return EarthAccessFile(loads(data), granule) # noqa: S301
187187

188188

189189
def _get_url_granule_mapping(

pyproject.toml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,20 +211,14 @@ ignore = [
211211
"D417",
212212
"E501",
213213
"FIX002",
214-
"PGH003",
215214
"PT006",
216215
"PT007",
217216
"PT009",
218217
"PT011",
219218
"PT012",
220219
"PT017",
221220
"PT027",
222-
"S101",
223-
"S108",
224221
"S113",
225-
"S301",
226-
"S603",
227-
"S607",
228222
"TD002",
229223
"TD003",
230224
"TD004"
@@ -236,7 +230,7 @@ combine-as-imports = true
236230
[tool.ruff.lint.per-file-ignores]
237231
# Allow `print` and `pprint` in notebooks
238232
"*.ipynb" = ["T201", "T203", "N803", "RET504", "ERA001", "PLR2004", "PD002", "PD010", "PD011", "EM", "ARG001", "BLE001", "FBT","TRY003"]
239-
"tests/**/*.py" = ["PLR2004", "FBT", "INP001", "SLF001"]
233+
"tests/**/*.py" = ["PLR2004", "FBT", "INP001", "SLF001", "S101", "S108", "S301", "S603", "S607"]
240234
"scripts/**/*.py" = ["INP001"]
241235

242236
[tool.ruff.lint.pydocstyle]

scripts/yamlfmt.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@
1414
"""
1515

1616
import platform
17+
import shutil
1718
import subprocess
1819
import sys
1920

21+
yamlfmt_path = shutil.which("yamlfmt")
22+
if yamlfmt_path is None:
23+
sys.exit("yamlfmt not found on PATH")
24+
2025
if platform.system() != "Windows":
21-
sys.exit(subprocess.call(["yamlfmt", *sys.argv[1:]]))
26+
sys.exit(subprocess.call([yamlfmt_path, *sys.argv[1:]])) # noqa: S603

0 commit comments

Comments
 (0)