Skip to content

join split lines, blank lines between steps across the linter - #70

Merged
katbyte merged 1 commit into
mainfrom
kt/join-split-lines-blank-after-brace
Oct 9, 2026
Merged

katbyte merged 1 commit into
mainfrom
kt/join-split-lines-blank-after-brace

Conversation

@katbyte

@katbyte katbyte commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Readability pass over every rule and lib: calls, conditions and signatures that were split across lines are joined back onto one line, and blank lines separate the steps inside longer function bodies.

Why: there is no maximum line length here. A report message split from its call hides what the rule says, and an if block run straight into the next statement hides where one step ends and the next begins. Both had crept in across the repo.

Calls and conditions split across lines. 59 places, mostly Reportf calls and t.Fatalf messages with the message on a continuation line, and a few || conditions and the category list in checks.go.

-				t.Fatalf("ParseDirective(%q) = %v, %q, %v; want %v, %q, %v",
-					tc.text, rules, reason, ok, tc.rules, tc.reason, tc.ok)
+				t.Fatalf("ParseDirective(%q) = %v, %q, %v; want %v, %q, %v", tc.text, rules, reason, ok, tc.rules, tc.reason, tc.ok)

Steps run together. 198 places. Inside a body with more than five statements, a blank line now separates a block (an if, for or switch) from the step that follows it, so a guard reads with the statement it protects and the next "get it, check it" step starts on its own. Short bodies of five statements or fewer are one group and get no blank lines, and a run of one-line guards stays together.

 			if !ok || runs[fn] == nil {
 				continue
 			}
+
 			fn, ok := pass.TypesInfo.Defs[fd.Name].(*types.Func)

Things that are fine as they are. Blank lines that were already there stay. Comments keep the repo's usual wrap width. Composite literals and function literals that span lines are untouched, since those are vertical by design. Test fixtures under testdata are untouched, as they encode exact shapes. Four files owned by the open PRs #67, #68 and #69 are left out here and fixed inside those PRs instead, so nothing conflicts: AZT003.go, AZP002.go, lib/tf/registration.go and checks/AZT/AZT.go.

No behaviour change: build, every test and lint pass.

@katbyte
katbyte force-pushed the kt/join-split-lines-blank-after-brace branch from 38c546f to 4f3b1ec Compare October 9, 2026 21:19
@katbyte katbyte changed the title join split lines, blank line after closing braces across the linter join split lines, blank lines between steps across the linter Oct 9, 2026
@katbyte
katbyte merged commit cff56d6 into main Oct 9, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant