Preview split standalone boolean expressions #5735
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 168 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.307
Real PR Conversation Timeline
1 comments
"Review active on #5735"
general
weight: 0.35
chrikrah
Description
Addresses #3647.
Long standalone expressions using
andororcan stay on one line even when they exceed the configured line length. With--preview, Black can now add parentheses and split these expressions across multiple lines when needed. Short expressions still fit on one line, and the stable behavior is unchanged for the cases I checked.The regression test covers long
andandorexpressions, a short expression that stays on one line, a mixed expression usingand,or, andnot, and a standalone expression inside a function. I also updated the preview documentation and changelog.Testing
tox -e pypassed.tox -e run_selfpassed.pre-commit run -apassed exceptmypy, which reportedStatement is unreachableintests/test_black.py:3669. This PR does not modify that file.Checklist
--previewstyle, following the stability policy?CHANGES.mdif necessary?AI assistance
I used OpenAI Codex to help understand the formatting code, plan the change, and review the verification steps. I made the edits, reproduced the issue, and ran the checks locally myself.