Apply SyntaxFormatRules consistently across format and lint with selections. #1333
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 251 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 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
Diff Size
diff_size
0.331
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1333"
general
weight: 0.35
dylansturg
Previously,
SyntaxFormatRule.visitAnycalledContext.shouldFormaton every visited syntax node and returned the node unchanged without visiting children whenevernode.isInsideSelectionfailed. BecauseisInsideSelectionrequires full containment, partial line or offset selections failed atSourceFileSyntax, causingSwiftFormatterto skip allSyntaxFormatRulepasses whileSwiftLinterstill ran them throughLintPipelineand emitted findings.Update
SyntaxFormatRuleandLintPipelineto descend into syntax subtrees that overlap or touch the selection (while respecting range-scoped// swift-format-ignoredirectives) and gate individual rewrites and findings on the specific syntax construct or trivia range being modified:shouldFormaton the rewritten sub-node (such as the semicolon token, return keyword orVoidclause, condition element, declaration modifier/keyword, or bound pattern variable).DoNotUseSemicolons,OneCasePerLine,OneVariableDeclarationPerLine,NoCasesWithOnlyFallthrough,UseEarlyExits,UseWhereClausesInForLoops) checkshouldFormaton each affected statement or list item while continuing to recurse into sibling and nested blocks.UseTripleSlashForDocumentationComments,NoEmptyLinesOpeningClosingBraces) checkshouldFormat(_:triviaRange:)against the trivia piece range rather than the entire declaration or block.OrderedImportsreorders and diagnoses an import span only when all statements in the affected import span are inside the selection, leaving unselected trailing statements intact.SyntaxFormatRulethat modifies the syntax tree inFormatPipeline, updateContext(adjusting resolved selection byte ranges by the tree edit deltas) and pass the transformed source string toPrettyPrinterwhen needed so subsequent rules and token-stream formatting stay byte-offset synchronized.