Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flake8-bugbear] Consider replacing f"'{foo}'" with f"{foo!r}" which is both easier to read and will escape quotes inside foo if that would appear (B907) #13600

Closed
wants to merge 89 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
42c5772
Implement B903 and B907 flake8-bugbear rules
agpt8 Oct 2, 2024
cb89963
Add new rules to `Rule` enum in `codes.rs`
agpt8 Oct 2, 2024
0adb25e
agpt8 Oct 2, 2024
a8acb23
Update registry.rs
agpt8 Oct 2, 2024
651eab4
Update registry.rs
agpt8 Oct 2, 2024
399e518
Update `Rule` enum and imports for new rules B903 and B907
agpt8 Oct 2, 2024
c812272
Rename b903.rs to use_dataclasses_for_data_classes.rs
agpt8 Oct 2, 2024
aa8191b
Rename b907.rs to f_string_single_quotes.rs
agpt8 Oct 2, 2024
d0af490
Update mod.rs
agpt8 Oct 2, 2024
37283a5
add missing semicolon
agpt8 Oct 2, 2024
86dd818
change to rule from crate
agpt8 Oct 2, 2024
b544b41
Update codes.rs
agpt8 Oct 2, 2024
9edb711
revert removed comments
agpt8 Oct 2, 2024
6d91f1e
revert removed comment
agpt8 Oct 2, 2024
2aef2ef
add B907.py and B903.py
agpt8 Oct 2, 2024
7e3894f
Avoid short circuiting `B017` for multiple context managers (#13609)
dhruvmanila Oct 3, 2024
3728d5b
[`pyupgrade`] Fix UP043 to apply to `collections.abc.Generator` and `…
cake-monotone Oct 3, 2024
fdd0a22
Move to maintained mirror of prettier (#13592)
gaborbernat Oct 3, 2024
cc1f766
Preserve trivia (i.e. comments) in PLR5501 (#13573)
zanieb Oct 3, 2024
4aefe52
Support ruff discovery in pip build environments (#13591)
gaborbernat Oct 3, 2024
7ad07c2
Add `allow-unused-imports` setting for `unused-import` rule (`F401`) …
hoxbro Oct 3, 2024
99e4566
Mark `FURB118` fix as unsafe (#13613)
zanieb Oct 3, 2024
975be9c
Bump version to 0.6.9 (#13624)
dhruvmanila Oct 4, 2024
d726f09
Fix `PTH123` false positive when `open` is passed a file descriptor (…
zanieb Oct 4, 2024
888930b
[red-knot] feat: implement integer comparison (#13571)
Slyces Oct 4, 2024
020f4d4
Add test cases for `RUF006` with lambdas (#13628)
zanieb Oct 4, 2024
2a365bb
Mark `PLE1141` fix as unsafe (#13629)
zanieb Oct 4, 2024
7c5a7d9
[red-knot] Improve tests relating to type inference for exception han…
AlexWaygood Oct 5, 2024
1c2cafc
[red-knot] more ergonomic and efficient handling of known builtin cla…
Slyces Oct 5, 2024
f120517
[red-knot] fix: when simplifying union, True & False -> instance(bool…
Slyces Oct 5, 2024
8108f83
[red-knot] feat: add `StringLiteral` and `LiteralString` comparison (…
Slyces Oct 5, 2024
383d9d9
Update Rust crate once_cell to v1.20.2 (#13653)
renovate[bot] Oct 7, 2024
4333022
Update Rust crate serde_with to v3.11.0 (#13655)
renovate[bot] Oct 7, 2024
03fa7f6
Update Rust crate clap to v4.5.19 (#13647)
renovate[bot] Oct 7, 2024
2ab78dd
Update NPM Development dependencies (#13651)
renovate[bot] Oct 7, 2024
824def2
Update dependency ruff to v0.6.9 (#13648)
renovate[bot] Oct 7, 2024
38d872e
Update Rust crate hashbrown to 0.15.0 (#13652)
renovate[bot] Oct 7, 2024
73aa6ea
[`refurb`] implement `hardcoded-string-charset` (FURB156) (#13530)
alex-700 Oct 7, 2024
98878c9
Update dependency tomli to v2.0.2 (#13649)
renovate[bot] Oct 7, 2024
7856e90
Update pre-commit dependencies (#13650)
renovate[bot] Oct 7, 2024
58a11b3
Fixup docs markup for `RUF027` (#13659)
AlexWaygood Oct 7, 2024
646e413
[`flake8-bugbear`] Tweak `B905` message to not suggest setting parame…
qdegraaf Oct 7, 2024
31ca1c3
[`flake8-async`] allow async generators (`ASYNC100`) (#13639)
autinerd Oct 7, 2024
27ac34d
Rework `S606` (`start-process-with-no-shell`) docs to make clear the …
AlexWaygood Oct 7, 2024
14ee5db
[refurb] Count codepoints not bytes for `slice-to-remove-prefix-or-su…
dylwil3 Oct 7, 2024
d7484e6
[red-knot] Improve type inference for except handlers where a tuple o…
AlexWaygood Oct 7, 2024
fb90f5a
Add known limitation to `C416` with dictionaries (#13627)
zanieb Oct 7, 2024
71b52b8
[red-knot] Allow `type[]` to be subscripted (#13667)
AlexWaygood Oct 7, 2024
42fcbef
Fix typo in `allow-unused-imports` documentation (#13669)
zanieb Oct 7, 2024
fc661e1
Normalize implicit concatenated f-string quotes per part (#13539)
MichaReiser Oct 8, 2024
93eff7f
[red-knot] type inference/checking test framework (#13636)
carljm Oct 8, 2024
b9827a4
Remove layout values from `AnyStringPart` (#13681)
MichaReiser Oct 9, 2024
5b4afd3
Harmonise methods for distinguishing different Python source types (#…
AlexWaygood Oct 9, 2024
d6b24b6
[`pycodestyle`] Fix whitespace-related false positives and false nega…
AlexWaygood Oct 10, 2024
a3dc5c0
[red-knot] document test framework (#13695)
carljm Oct 10, 2024
6ae833e
[red-knot] mdtest usability improvements for reveal_type (#13709)
carljm Oct 11, 2024
3209953
[red-knot] clarify mdtest README (#13720)
carljm Oct 11, 2024
46bc69d
[`flake8-pyi`] - fix dropped exprs in `PYI030` autofix (#13727)
diceroll123 Oct 13, 2024
defdc4d
[red-knot] Use colors to improve readability of `mdtest` output (#13725)
AlexWaygood Oct 13, 2024
8445e47
Downgrade benchmarks CI job to ubuntu 22 (#13743)
MichaReiser Oct 14, 2024
3111dce
Fix `mkdocs` CI job (#13744)
MichaReiser Oct 14, 2024
e4c0dd6
Update rust-wasm-bindgen monorepo (#13738)
renovate[bot] Oct 14, 2024
63df94b
Update Rust crate proc-macro2 to v1.0.87 (#13735)
renovate[bot] Oct 14, 2024
dd5018a
Update dependency @miniflare/kv to v2.14.4 (#13736)
renovate[bot] Oct 14, 2024
58bc981
Update Rust crate pathdiff to v0.2.2 (#13734)
renovate[bot] Oct 14, 2024
4ef422d
Update Rust crate clap to v4.5.20 (#13733)
renovate[bot] Oct 14, 2024
c3a3622
Update Rust crate libcst to v1.5.0 (#13739)
renovate[bot] Oct 14, 2024
814ab47
Update dependency @miniflare/storage-memory to v2.14.4 (#13737)
renovate[bot] Oct 14, 2024
5caabe5
Allow `ipytest` cell magic (#13745)
dhruvmanila Oct 14, 2024
9bb4722
[`flake8-todos`] Allow words starting with todo (#13640)
autinerd Oct 14, 2024
93097f1
[red-knot] feat: Inference for `BytesLiteral` comparisons (#13746)
sharkdp Oct 14, 2024
6048f33
[red-knot] Add a build.rs file to `red_knot_python_semantic`, and doc…
AlexWaygood Oct 14, 2024
04b636c
[red knot] Use memmem::find instead of custom version (#13750)
sharkdp Oct 14, 2024
2e8177b
Implement B903 and B907 flake8-bugbear rules
agpt8 Oct 2, 2024
f0f243a
Add new rules to `Rule` enum in `codes.rs`
agpt8 Oct 2, 2024
a10e61e
agpt8 Oct 2, 2024
a9d86c8
Update registry.rs
agpt8 Oct 2, 2024
081b514
Update registry.rs
agpt8 Oct 2, 2024
1599b25
Update `Rule` enum and imports for new rules B903 and B907
agpt8 Oct 2, 2024
cbcba8f
Rename b903.rs to use_dataclasses_for_data_classes.rs
agpt8 Oct 2, 2024
6c1b1a3
Rename b907.rs to f_string_single_quotes.rs
agpt8 Oct 2, 2024
549adc9
Update mod.rs
agpt8 Oct 2, 2024
8efe87b
add missing semicolon
agpt8 Oct 2, 2024
4d874bd
change to rule from crate
agpt8 Oct 2, 2024
2b48f4c
Update codes.rs
agpt8 Oct 2, 2024
141fc5f
revert removed comments
agpt8 Oct 2, 2024
9241b87
revert removed comment
agpt8 Oct 2, 2024
ae5a829
add B907.py and B903.py
agpt8 Oct 2, 2024
7179810
Merge remote-tracking branch 'origin/implement-b903-b907' into implem…
agpt8 Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
# sync, not just public items. Eventually we should do this for all
# crates; for now add crates here as they are warning-clean to prevent
# regression.
- run: cargo doc --no-deps -p red_knot_python_semantic -p red_knot -p ruff_db --document-private-items
- run: cargo doc --no-deps -p red_knot_python_semantic -p red_knot -p red_knot_test -p ruff_db --document-private-items
env:
# Setting RUSTDOCFLAGS because `cargo doc --check` isn't yet implemented (https://github.com/rust-lang/cargo/issues/10025).
RUSTDOCFLAGS: "-D warnings"
Expand Down Expand Up @@ -518,20 +518,24 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: "Add SSH key"
if: ${{ env.MKDOCS_INSIDERS_SSH_KEY_EXISTS == 'true' }}
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.MKDOCS_INSIDERS_SSH_KEY }}
- name: "Install Rust toolchain"
run: rustup show
- name: Install uv
uses: astral-sh/setup-uv@v3
- uses: Swatinem/rust-cache@v2
- name: "Install Insiders dependencies"
if: ${{ env.MKDOCS_INSIDERS_SSH_KEY_EXISTS == 'true' }}
run: pip install -r docs/requirements-insiders.txt
run: uv pip install -r docs/requirements-insiders.txt --system
- name: "Install dependencies"
if: ${{ env.MKDOCS_INSIDERS_SSH_KEY_EXISTS != 'true' }}
run: pip install -r docs/requirements.txt
run: uv pip install -r docs/requirements.txt --system
- name: "Update README File"
run: python scripts/transform_readme.py --target mkdocs
- name: "Generate docs"
Expand Down Expand Up @@ -608,7 +612,7 @@ jobs:
just test

benchmarks:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
needs: determine_changes
if: ${{ github.repository == 'astral-sh/ruff' && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
timeout-minutes: 20
Expand Down
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ repos:
additional_dependencies:
- mdformat-mkdocs
- mdformat-admon
- mdformat-footnote
exclude: |
(?x)^(
docs/formatter/black\.md
Expand All @@ -45,7 +46,7 @@ repos:
)$

- repo: https://github.com/crate-ci/typos
rev: v1.24.6
rev: v1.25.0
hooks:
- id: typos

Expand All @@ -59,7 +60,7 @@ repos:
pass_filenames: false # This makes it a lot faster

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
rev: v0.6.9
hooks:
- id: ruff-format
- id: ruff
Expand All @@ -68,8 +69,8 @@ repos:
require_serial: true

# Prettier
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.3.3
hooks:
- id: prettier
types: [yaml]
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# Changelog

## 0.6.9

### Preview features

- Fix codeblock dynamic line length calculation for indented docstring examples ([#13523](https://github.com/astral-sh/ruff/pull/13523))
- \[`refurb`\] Mark `FURB118` fix as unsafe ([#13613](https://github.com/astral-sh/ruff/pull/13613))

### Rule changes

- \[`pydocstyle`\] Don't raise `D208` when last line is non-empty ([#13372](https://github.com/astral-sh/ruff/pull/13372))
- \[`pylint`\] Preserve trivia (i.e. comments) in `PLR5501` autofix ([#13573](https://github.com/astral-sh/ruff/pull/13573))

### Configuration

- \[`pyflakes`\] Add `allow-unused-imports` setting for `unused-import` rule (`F401`) ([#13601](https://github.com/astral-sh/ruff/pull/13601))

### Bug fixes

- Support ruff discovery in pip build environments ([#13591](https://github.com/astral-sh/ruff/pull/13591))
- \[`flake8-bugbear`\] Avoid short circuiting `B017` for multiple context managers ([#13609](https://github.com/astral-sh/ruff/pull/13609))
- \[`pylint`\] Do not offer an invalid fix for `PLR1716` when the comparisons contain parenthesis ([#13527](https://github.com/astral-sh/ruff/pull/13527))
- \[`pyupgrade`\] Fix `UP043` to apply to `collections.abc.Generator` and `collections.abc.AsyncGenerator` ([#13611](https://github.com/astral-sh/ruff/pull/13611))
- \[`refurb`\] Fix handling of slices in tuples for `FURB118`, e.g., `x[:, 1]` ([#13518](https://github.com/astral-sh/ruff/pull/13518))

### Documentation

- Update GitHub Action link to `astral-sh/ruff-action` ([#13551](https://github.com/astral-sh/ruff/pull/13551))

## 0.6.8

### Preview features
Expand Down
Loading
Loading