• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

psf / black / 27309064471
96%
master: 96%

Build:
Build:
LAST BUILD BRANCH: fix-line-ranges-preserve-outside-prefix
DEFAULT BRANCH: master
Ran 10 Jun 2026 10:00PM UTC
Jobs 6
Files 43
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Jun 2026 09:58PM UTC coverage: 95.79% (-0.002%) from 95.792%
27309064471

push

github

web-flow
Fix unnecessary parentheses in indexed assignment RHS (#5095)

* Fix unnecessary parentheses in indexed assignment RHS (#4349)

When an assignment target contains brackets (e.g. indexed access like
`x[key] = expr`), Black would wrap the right-hand side expression in
unnecessary parentheses when the line was too long. For example:

    dictionary["key"][idx] = (10 - 5)

This happened because `can_omit_invisible_parens` returned False for
simple expressions with operators (like `10 - 5`) that don't start or
end with brackets. The function was too conservative: it didn't consider
that the line could instead be split at the LHS brackets, producing:

    dictionary["key"][
        idx
    ] = 10 - 5

The fix allows omitting optional parens when the RHS body is short
enough and the LHS contains brackets that can absorb the split. The
downstream `_prefer_split_rhs_oop_over_rhs` still decides whether the
resulting layout is actually better.

Fixes #4349.

* Gate indexed assignment parens fix behind preview mode and add CHANGES.md

Move the fix for unnecessary parentheses in indexed assignment RHS
behind a Preview flag to avoid unintentional stable style changes.
Test cases moved to a preview-specific test file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address review feedback: make mode required, use AST-based length check, add docs

- Make `mode` parameter required in `can_omit_invisible_parens` to prevent
  accidental omission at call sites (fixes flake8 B008)
- Replace `str_width(str(line))` with `enumerate_with_length()` for an
  AST-only body length calculation (avoids expensive string conversion)
- Document `fix_unnecessary_parens_in_indexed_assignment` in
  `docs/the_black_code_style/future_style.md` (fixes test_feature_lists_are_up_to_date)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Regenerate schema to include fix_unnecessary_parens_in_indexed_assignment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Ad... (continued)

5749 of 6072 branches covered (94.68%)

18 of 19 new or added lines in 2 files covered. (94.74%)

8555 of 8931 relevant lines covered (95.79%)

5.73 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
94.32
0.0% src/black/lines.py
Jobs
ID Job ID Ran Files Coverage
1 py3.10-ubuntu-latest - 27309064471.1 10 Jun 2026 10:03PM UTC 43
95.69
2 py3.15-ubuntu-latest - 27309064471.2 10 Jun 2026 10:03PM UTC 43
95.03
3 py3.13-ubuntu-latest - 27309064471.3 10 Jun 2026 10:03PM UTC 43
95.71
4 py3.11-ubuntu-latest - 27309064471.4 10 Jun 2026 10:03PM UTC 43
95.7
5 py3.14-ubuntu-latest - 27309064471.5 10 Jun 2026 10:03PM UTC 43
95.25
6 py3.12.10-ubuntu-latest - 27309064471.6 10 Jun 2026 10:03PM UTC 43
95.71
Source Files on build 27309064471
  • Tree
  • List 43
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 00cd1e4a on github
  • Prev Build on main (#27307640003)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc