Summary
The pkg/parser package contains approximately 80 functions exceeding the 60-line limit. These should be broken down into smaller, more testable units.
Affected Functions (Sample - See full list in logs)
frontmatter_content.go:67 — ExtractFrontmatterFromContent (99 lines)
frontmatter_hash.go:46 — marshalSorted (69 lines)
frontmatter_hash.go:317 — extractImportsFromText (74 lines)
github_urls.go:56 — ParseGitHubURL (134 lines)
import_bfs.go:21 — processImportsFromFrontmatterWithManifestAndSource (492 lines)
import_field_extractor.go:152 — prepareFrontmatter (123 lines)
import_field_extractor.go:417 — extractActivationFields (93 lines)
import_field_extractor.go:565 — extractFeatureAndObservabilityFields (84 lines)
import_field_extractor.go:1136 — substituteImportInputsInContent (84 lines)
- And 70+ more functions...
Refactoring Strategy
- Identify responsibilities — Group logic by domain (imports, validation, extraction)
- Extract helper functions — Break long functions into 40-60 line components
- Maintain readability — Use descriptive function names that clarify intent
- Preserve behavior — No functional changes, only structure
- Add tests — Ensure new helpers have dedicated unit tests
Validation
Run make golint-custom after refactoring to verify all pkg/parser lint violations are resolved.
Expected Outcome
All functions in pkg/parser reduced to ≤60 lines without functional changes.
Zero new lint errors introduced.
Generated by 🧌 LintMonster · ● 77.9K · ◷
Summary
The
pkg/parserpackage contains approximately 80 functions exceeding the 60-line limit. These should be broken down into smaller, more testable units.Affected Functions (Sample - See full list in logs)
frontmatter_content.go:67— ExtractFrontmatterFromContent (99 lines)frontmatter_hash.go:46— marshalSorted (69 lines)frontmatter_hash.go:317— extractImportsFromText (74 lines)github_urls.go:56— ParseGitHubURL (134 lines)import_bfs.go:21— processImportsFromFrontmatterWithManifestAndSource (492 lines)import_field_extractor.go:152— prepareFrontmatter (123 lines)import_field_extractor.go:417— extractActivationFields (93 lines)import_field_extractor.go:565— extractFeatureAndObservabilityFields (84 lines)import_field_extractor.go:1136— substituteImportInputsInContent (84 lines)Refactoring Strategy
Validation
Run
make golint-customafter refactoring to verify all pkg/parser lint violations are resolved.Expected Outcome
All functions in
pkg/parserreduced to ≤60 lines without functional changes.Zero new lint errors introduced.