Skip to content

Replace flake8, bandit, isort, pyupgrade with ruff#2076

Merged
syssi merged 3 commits into
masterfrom
modernize-tooling
Jun 27, 2026
Merged

Replace flake8, bandit, isort, pyupgrade with ruff#2076
syssi merged 3 commits into
masterfrom
modernize-tooling

Conversation

@syssi

@syssi syssi commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Consolidates all linting into ruff, removing the redundant standalone tools. Three commits:

1. Migrate deprecated poetry dev-dependencies section

Renames [tool.poetry.dev-dependencies] to [tool.poetry.group.dev.dependencies] to silence the deprecation warning emitted on every poetry invocation.

2. Replace flake8, bandit, isort, pyupgrade with ruff

Ruff covers all rules provided by the removed tools via built-in rule sets:

Removed tool Ruff rule set
flake8 + plugins F, B, PT
bandit S
isort I

Also removes the now-redundant [tool.isort] config section and adds --exit-non-zero-on-fix to the ruff hook so CI fails when auto-fixes are applied.

3. Fix violations from expanded ruleset

  • Adds per-file-ignores for test files (S101, S105, S106, B018, B904, PT009, PT012, PT027)
  • Adds global ignore for PT011 (pytest.raises() without match=) — too many existing cases to address in this PR
  • Fixes B904 in 7 production files (raise ... from exc/None)
  • Converts # nosec (bandit) to # noqa: Sxxx (ruff) throughout the codebase

Test plan

  • All 1421 tests pass
  • pre-commit run --all-files runs clean

@syssi syssi requested a review from rytilahti June 27, 2026 13:21
@syssi syssi changed the base branch from drop-python-eol to master June 27, 2026 13:35
@syssi syssi force-pushed the modernize-tooling branch 2 times, most recently from 308b968 to ca937bb Compare June 27, 2026 13:51
@codecov

codecov Bot commented Jun 27, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.91549% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.30%. Comparing base (ae789a7) to head (dc3c099).

Files with missing lines Patch % Lines
miio/devtools/simulators/miotsimulator.py 0.00% 5 Missing ⚠️
miio/cloud.py 0.00% 3 Missing ⚠️
miio/push_server/server.py 33.33% 2 Missing ⚠️
miio/updater.py 0.00% 2 Missing ⚠️
miio/click_common.py 0.00% 1 Missing ⚠️
miio/devtools/pcapparser.py 0.00% 1 Missing ⚠️
miio/devtools/simulators/common.py 0.00% 1 Missing ⚠️
...io/integrations/chuangmi/camera/chuangmi_camera.py 0.00% 1 Missing ⚠️
miio/integrations/chunmi/cooker/cooker.py 0.00% 1 Missing ⚠️
miio/integrations/pwzn/relay/pwzn_relay.py 0.00% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2076      +/-   ##
==========================================
+ Coverage   83.28%   83.30%   +0.01%     
==========================================
  Files         198      198              
  Lines       19417    19437      +20     
  Branches     1056     1056              
==========================================
+ Hits        16172    16192      +20     
  Misses       3063     3063              
  Partials      182      182              

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

syssi added 3 commits June 27, 2026 16:28
- pre-commit-hooks v4.5.0 → v6.0.0
- ruff v0.7.1 → v0.15.20
- mypy v1.8.0 → v2.1.0
- Fix mypy error in extract_tokens.py: return [] → return in Iterator
- Apply ruff-format to 26 files
@syssi syssi force-pushed the modernize-tooling branch from 3122fe0 to dc3c099 Compare June 27, 2026 14:28
@syssi syssi merged commit b2b6ec7 into master Jun 27, 2026
14 checks passed
@syssi syssi deleted the modernize-tooling branch June 27, 2026 14:31
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