chore: replace flake8 and black with ruff - #1954
Merged
Merged
Conversation
Swap the two separate dev tools -- flake8 (lint) and black (format) -- for
a single ruff binary that does both.
- pyproject.toml: add [tool.ruff] (line-length = 125) and [tool.ruff.lint]
with select = ["E", "W", "F"]; ignore = ["E402"] (the only code that
fires, all in the generated legacy_client.py header region). Drop
[tool.black].
- requirements/tools.txt: replace flake8 and black with ruff==0.16.4.
- delete .flake8 (its only setting, max-line-length, now lives in
[tool.ruff]).
- scripts/format.sh: ruff check --fix + ruff format.
- scripts/lint.sh: ruff format --check + ruff check.
- scripts/{run_tests,run_validation,run_integration_tests}.sh: update the
"Running black" echo to reference ruff.
- scripts/codegen.py: emit `ruff format slack_sdk/` in the generated-file
header; regenerate async_client.py, legacy_client.py, async_chat_stream.py.
- .vscode/settings.json: use the ruff extension for formatting/linting.
- AGENTS.md: update formatter/linter/tooling references to ruff.
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
One-time mechanical reformat from adopting `ruff format` in place of black. Only the documented ruff-vs-black differences (implicit string-concat joining, f-string inner-quote normalization, blank-line-at-block-start removal, subscript/lambda reflow) plus ruff's formatting of Python code blocks inside Markdown. No behavior changes. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (46.15%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #1954 +/- ##
==========================================
- Coverage 84.06% 84.06% -0.01%
==========================================
Files 118 118
Lines 13506 13505 -1
==========================================
- Hits 11354 11353 -1
Misses 2152 2152 ☔ View full report in Codecov by Harness. |
The ruff migration added `ignore = ["E402"]` to silence 13 violations in the generated legacy_client.py, where codegen prepended `from asyncio import Future` above the module docstring (demoting it to a plain statement). Insert it after the docstring instead so all imports stay at the top of the file, then drop the global ignore to keep E402 enforced across slack/ and slack_sdk/. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces flake8 (lint) and black (format) with ruff binary that does both. This mirrors slackapi/bolt-python#1566.
Chosen for the simplest config that changes the source the least: a narrow lint
select = ["E", "W", "F"]Notes for reviewers:
# fmt: skipguards were needed: mypy (warn_unused_ignores) passes clean because the reflow-sensitive# type: ignorelines keep their magic trailing commas..git-blame-ignore-revssogit blameskips the reformat.Testing
./scripts/lint.sh --no-install→455 files already formatted/All checks passed!./scripts/run_mypy.sh --no-install→Successpython scripts/codegen.py --path .+./scripts/format.sh --no-install→ generated files stable and referenceruff formatCategory
tests/integration_tests(Automated tests for this library)/docs(Documents)Requirements
python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.shafter making the changes.🤖 Generated with Claude Code