Skip to content

chore: cover flake8-bandit checks with ruff's S rules - #296

Merged
aldbr merged 1 commit into
DIRACGrid:develfrom
fstagni:ruff-bandit-rules
Nov 23, 2026
Merged

aldbr merged 1 commit into
DIRACGrid:develfrom
fstagni:ruff-bandit-rules

Conversation

@fstagni

@fstagni fstagni commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Part of DIRACGrid/.github#5. Replaces #295 (closed).

The repos already linting with ruff get bandit's checks from ruff's S (flake8-bandit) ruleset instead of running bandit separately, like diracx, intercede and signurlarity.

  • add S to the ruff select, with documented ignores mirroring the bandit skips of chore: add bandit (static security analysis) to pre-commit #295: the pilot bootstraps itself on worker nodes, so downloading files over URLs (S310) and starting processes (S602/S603/S605/S607) is its core function by design; S101 (assert) and S110 (try-except-pass, best-effort cleanup must never abort the pilot) are skipped too
  • S311 (pseudo-random) is allowed in tests only, via per-file-ignores
  • migrate lint settings from the deprecated top-level [tool.ruff] layout to [tool.ruff.lint] (as in diracx/intercede), and ignore B905 (zip(strict=) needs Python 3.10, Pilot still supports 3.9)
  • make ruff check clean: fix import sorting and drop an unused import in tests, noqa the retStatus placeholder kept for its TODO

Clean run: ruff check Pilot/ tests/ → All checks passed. pylint -E Pilot/ unaffected.

Replaces the bandit-based approach of DIRACGrid#295 (closed): the repos already
linting with ruff get bandit's checks from ruff's S (flake8-bandit)
ruleset instead, like diracx, intercede and signurlarity.

- add S to the ruff select, with documented ignores mirroring the
  bandit skips: the pilot bootstraps itself on worker nodes, so
  downloading over URLs and starting processes is its core function by
  design; S110 (try-except-pass) is skipped as best-effort cleanup must
  never abort the pilot
- S311 is allowed in tests only (pseudo-random test data)
- migrate lint settings to [tool.ruff.lint] (the old top-level layout
  is deprecated) and ignore B905 (zip strict= needs Python 3.10)
- make ruff check clean: sort imports and drop an unused import in
  tests, noqa the retStatus placeholder kept for its TODO
@aldbr
aldbr merged commit 721c711 into DIRACGrid:devel Nov 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants