Skip to content

Conversation

@dylwil3
Copy link
Collaborator

@dylwil3 dylwil3 commented Oct 20, 2025

Closes #20997

This will decrease the number of diagnostics emitted for zip-without-explicit-strict (B905), since previously it triggered on any zip call no matter the number of arguments. It may increase the number of diagnostics for map-without-explicit-strict (B912) since it will now trigger on a single starred argument where before it would not. However, the latter rule is in preview so this is acceptable.

Note - we do not need to make any changes to batched-without-explicit-strict (B911) since that just takes a single iterable.

I am doing this in one PR rather than two because we should keep the behavior of these rules consistent with one another.

For review: apologies for the unreadability of the snapshot for B905. Unfortunately I saw no way of keeping a small diff and a correct fixture (the fixture labeled a whole block as # Error whereas now several in the block became # Ok).Probably simplest to just view the actual snapshot - it's relatively small.

@dylwil3 dylwil3 added the rule Implementing or modifying a lint rule label Oct 20, 2025
@dylwil3 dylwil3 changed the title [flake8-bugbear] Skip B905 and B905 if <2 iterators and no starred arguments [flake8-bugbear] Skip B905 and B905 if <2 iteratables and no starred arguments Oct 20, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 20, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@AlexWaygood AlexWaygood changed the title [flake8-bugbear] Skip B905 and B905 if <2 iteratables and no starred arguments [flake8-bugbear] Skip B905 and B905 if <2 iterables and no starred arguments Oct 20, 2025
@dylwil3 dylwil3 changed the title [flake8-bugbear] Skip B905 and B905 if <2 iterables and no starred arguments [flake8-bugbear] Skip B905 and B912 if <2 iterables and no starred arguments Oct 20, 2025
@dylwil3 dylwil3 merged commit d363d49 into astral-sh:main Oct 20, 2025
95 of 99 checks passed
dcreager added a commit that referenced this pull request Oct 22, 2025
* main: (65 commits)
  [ty] Some more simplifications when rendering constraint sets (#21009)
  [ty] Make `attributes.md` mdtests faster (#21030)
  [ty] Set `INSTA_FORCE_PASS` and `INSTA_OUTPUT` environment variables from mdtest.py (#21029)
  [ty] Fall back to `Divergent` for deeply nested specializations (#20988)
  [`ruff`] Autogenerate TypeParam nodes (#21028)
  [ty] Add assertions to ensure that we never call `KnownClass::Tuple.to_instance()` or similar (#21027)
  [`ruff`] Auto generate ast Pattern nodes (#21024)
  [`flake8-simplify`] Skip `SIM911` when unknown arguments are present (#20697)
  Render a diagnostic for syntax errors introduced in formatter tests (#21021)
  [ty] Support goto-definition on vendored typeshed stubs (#21020)
  [ty] Implement go-to for binary and unary operators (#21001)
  [ty] Avoid ever-growing default types (#20991)
  [syntax-errors] Name is parameter and global (#20426)
  [ty] Disable panicking mdtest (#21016)
  [ty] Fix completions at end of file (#20993)
  [ty] Fix out-of-order semantic token for function with regular argument after kwargs (#21013)
  [ty] Fix auto import for files with `from __future__` import (#20987)
  [`fastapi`] Handle ellipsis defaults in FAST002 autofix (`FAST002`) (#20810)
  [`ruff`] Skip autofix for keyword and `__debug__` path params (#20960)
  [`flake8-bugbear`] Skip `B905` and `B912` if <2 iterables and no starred arguments (#20998)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rule Implementing or modifying a lint rule

Projects

None yet

Development

Successfully merging this pull request may close these issues.

B905 recommends unnecessary strict for less than two iterables

1 participant