You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Acts on every concrete finding from the local max-effort review pass
except #5 (linkRefResetter interface duplication), which I'm keeping
local: exposing it from pkg/markdown would surface a goldmark fork
detail on the public surface for less duplication value than it costs.
Bugs
- fix.go (#1): MDS034 Fix was calling flavor.NewPooledParser() per
invocation — same regression I fixed in flavor.Detect last commit,
mirrored at the parallel Fix call site. Move the pool to package
level in flavor and expose a callback API, flavor.WithSharedParser,
used by both Detect's dualFindings and the rule's
fixByteRangeFeatures.
- rule.go fixGitHubAlerts (#7): the type assertion
bq.FirstChild().(*ast.Paragraph) plus lines.At(0) was relying on a
cross-package contract with flavor.IsGitHubAlert. Re-check the
shape locally so a future relax of IsGitHubAlert cannot turn the
walk into a panic.
- fix.go taskCheckBoxEdits (#9): nil-check the
flavor.NearestBlockAncestor return and the block's Lines() before
calling At(0).
- detect.go (#11, #15): IsGitHubAlert nil-guards bq and the
paragraph's Lines.Len(); findHeadingID nil-guards h. Both are
public-API entry points now.
- rule.go ApplySettings (#12): iterate settings keys in sorted order
so the error for multiple unknown settings is deterministic across
Go map randomisation.
Simplifications
- detect.go (#2): drop the taskCheckBoxFinding specialisation; the
TaskCheckBox case in builtinFindingFor calls inlineExtFinding
directly.
- detect.go (#3): promote isGitHubAlert / lineCol /
nearestBlockAncestor to the exported names. The previous private +
one-line public-wrapper pair was duplication; the lowercase
versions are now gone.
- detect.go dualFindings (#4): return nil rather than an
always-allocated empty slice on no findings (CLAUDE.md
allocation-budget rule).
- parser.go (#6): drop NewParser and NewParserWith — they were
one-line wrappers around the pooled forms. The public surface is
now NewPooledParser, NewPooledParserWith, and WithSharedParser.
- contract_test.go (#13): move signature pins to package-scope `var
_ = ...` declarations so the staticcheck "could omit type" rule
does not fight the explicit-type contract.
Reuse
- pkg/markdown.Edit + Splice (#8): added an optional `Repl []byte`
field to Edit; Splice now supports replacement in addition to
deletion. The rule's bespoke `edit` struct and `applyEdits` are
gone; fix.go composes a []markdown.Edit and feeds it through
markdown.Splice. Adjacent-edits-with-Repl behaviour is now pinned
in pkg/markdown's TestSplice.
- lint.UnmarshalFrontMatter (#14): extracted the StripFrontMatter →
trim `---\n` delimiters → yamlutil.UnmarshalSafe pipeline into one
helper in internal/lint/frontmatter.go. internal/integration's
rules_test.go switched to it, dropping its open-coded copy and the
goldmark-frontmatter import.
Test pyramid
- Added unit tests for IsGitHubAlert's nil/empty-Lines branches,
FindHeadingID's nil-heading branch, and TestWithSharedParser for
the new pool callback. Coverage in pkg/markdown/flavor is 100%.
- TestApplyEditsHandlesAdjacentEdits moved into pkg/markdown's
TestSplice as a sub-test covering the new Repl behaviour.
All tests pass, golangci-lint clean, mdsmith check clean.
https://claude.ai/code/session_0144ZKUS2Zrg7xBft54qyoti
0 commit comments