Skip to content

refactor(sight): split oversized static_rules.go for code clarity#12

Merged
Patel230 merged 1 commit into
mainfrom
refactor/code-clarity
Jun 19, 2026
Merged

refactor(sight): split oversized static_rules.go for code clarity#12
Patel230 merged 1 commit into
mainfrom
refactor/code-clarity

Conversation

@Patel230

Copy link
Copy Markdown
Contributor

Summary

Pure mechanical refactor for code clarity only — splitting oversized Go files (>1000 LOC) into smaller, same-package files. Code is moved verbatim; there are no behavior, API, or exported-symbol changes.

File split

File Before After
static_rules.go 1060 206
static_rules_defaults.go (new) 859

static_rules.go retains the StaticRule/StaticAnalyzer types, the Analyze/AnalyzeFile/AnalyzeFileWithPath methods, and the DetectLanguage/parseHunkNewStart helpers. The large built-in defaultRules() rule set (~855 lines) moved verbatim into the new static_rules_defaults.go in the same sight package. A short pointer comment was left where the function used to be.

No files were intentionally left over 1000 LOC.

Verification

All run with the package's standard toolchain (no cgo required):

  • go build ./... — OK
  • go vet ./... — OK
  • go test ./... — all packages pass
  • golangci-lint run ./ — 0 issues
  • goimports / gofumpt — clean

Test plan

  • Module builds
  • go vet clean
  • Full test suite green
  • Lint clean (0 issues)

Made with Cursor

Move the defaultRules() built-in rule set (~855 lines) verbatim into a
new same-package file static_rules_defaults.go, leaving static_rules.go
with the analyzer logic and helpers. No behavior or API changes.
@Patel230 Patel230 force-pushed the refactor/code-clarity branch from 7695ccf to b948250 Compare June 19, 2026 15:52
@Patel230 Patel230 merged commit 0d98d70 into main Jun 19, 2026
11 checks passed
@Patel230 Patel230 deleted the refactor/code-clarity branch June 19, 2026 17:13
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