Skip to content

[lint-monster] Refactor long functions in pkg/parser package (80+ violations) #34159

@github-actions

Description

@github-actions

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

  1. Identify responsibilities — Group logic by domain (imports, validation, extraction)
  2. Extract helper functions — Break long functions into 40-60 line components
  3. Maintain readability — Use descriptive function names that clarify intent
  4. Preserve behavior — No functional changes, only structure
  5. 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 ·

  • expires on May 30, 2026, 3:49 AM UTC

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions