Skip to content

Add more ruff rules (B, PTH, RSE, SIM, C4, BLE, A)#4034

Merged
mashehu merged 59 commits intonf-core:devfrom
mashehu:new-ruff-rules
Apr 14, 2026
Merged

Add more ruff rules (B, PTH, RSE, SIM, C4, BLE, A)#4034
mashehu merged 59 commits intonf-core:devfrom
mashehu:new-ruff-rules

Conversation

@mashehu
Copy link
Copy Markdown
Contributor

@mashehu mashehu commented Feb 11, 2026

Additional rules we could add:

  • "C4", # flake8-comprehensions - better list/dict/set comprehensions
    - [ ] "RUF", # Ruff-specific rules - includes RUF103/104 for validating suppressions
  • "SIM", # flake8-simplify - simplifies code patterns
    - [ ] "PIE", # flake8-pie - misc lints for common issues
  • "RSE", # flake8-raise - unnecessary parentheses on raised exceptions
    - [ ] "RET", # flake8-return - unnecessary variable assignments before return
    - [ ] "ARG", # flake8-unused-arguments - finds unused function arguments
  • "BLE", # flake8-blind-except - catches blind except clauses
  • "A", # flake8-builtins - catches shadowing of Python builtins
    - [ ] "TRY", # tryceratops - exception handling best practices

Update:
Rest of the rules would need too many exceptions etc. to be applicable for our code

@mashehu mashehu requested a review from a team February 11, 2026 10:14
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 69.81567% with 131 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.09%. Comparing base (3d5d0e8) to head (65d05f6).
⚠️ Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
nf_core/pipelines/schema.py 48.48% 17 Missing ⚠️
nf_core/synced_repo.py 31.25% 11 Missing ⚠️
nf_core/components/update.py 65.21% 8 Missing ⚠️
nf_core/pipelines/create/githubrepo.py 30.00% 7 Missing ⚠️
nf_core/pipelines/refgenie.py 0.00% 7 Missing ⚠️
nf_core/pipelines/rocrate.py 66.66% 6 Missing ⚠️
nf_core/modules/modules_json.py 77.27% 5 Missing ⚠️
nf_core/modules/modules_repo.py 16.66% 5 Missing ⚠️
nf_core/pipelines/create/create.py 55.55% 4 Missing ⚠️
nf_core/pipelines/launch.py 77.77% 4 Missing ⚠️
... and 32 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mashehu mashehu changed the title Add more ruff rules (B, PTH) Add more ruff rules (B, PTH, RSE) Feb 11, 2026
@mashehu mashehu changed the title Add more ruff rules (B, PTH, RSE) Add more ruff rules (B, PTH, RSE, SIM) Feb 12, 2026
@mashehu mashehu changed the title Add more ruff rules (B, PTH, RSE, SIM) Add more ruff rules (B, PTH, RSE, SIM, C4) Feb 16, 2026
@mashehu mashehu changed the title Add more ruff rules (B, PTH, RSE, SIM, C4) Add more ruff rules (B, PTH, RSE, SIM, C4, BLE) Feb 16, 2026
@mashehu
Copy link
Copy Markdown
Contributor Author

mashehu commented Feb 20, 2026

hah, looks like most of these new rules are anyway part of an upcoming set of default ruff rules: astral-sh/ruff#23203

@mashehu mashehu force-pushed the new-ruff-rules branch 3 times, most recently from b2cd1b3 to dada220 Compare February 26, 2026 20:22
@mashehu mashehu changed the title Add more ruff rules (B, PTH, RSE, SIM, C4, BLE) Add more ruff rules (B, PTH, RSE, SIM, C4, BLE, A) Feb 27, 2026
Comment thread nf_core/synced_repo.py Outdated
Comment thread nf_core/modules/modules_utils.py Outdated
@mashehu mashehu added this to the 4.0.0 milestone Mar 31, 2026
Comment thread nf_core/modules/lint/main_nf.py
Copy link
Copy Markdown
Contributor

@ningyuxin1999 ningyuxin1999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will continue with reviewing tomorrow :))

@mashehu mashehu merged commit dd201a7 into nf-core:dev Apr 14, 2026
116 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.

4 participants