Skip to content

feat: add lint subcommand to validate the config and input files - #355

Merged
losisin merged 1 commit into
losisin:mainfrom
somaz94:feat/lint-command
Jun 6, 2026
Merged

losisin merged 1 commit into
losisin:mainfrom
somaz94:feat/lint-command

Conversation

@somaz94

@somaz94 somaz94 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Which problem does the PR fix?

Closes #260

What's in this PR?

Adds a helm schema lint subcommand that validates the config file and its input values files without generating a schema:

  • Parses the configured input files using the same parsing as schema generation, reporting the same errors.
  • Checks the config file (.schema.yaml) for unknown fields and logs them as warnings (nested fields included). A type mismatch in the config is reported as a hard error rather than a warning.
  • A --strict flag exits with a non-zero code when any warning is reported.
$ helm schema lint
No issues found

$ helm schema lint --strict
warning: line 4: field fooBar is not a known config field
Found 1 warning(s)
Error: found 1 warning(s) in strict mode

To avoid duplicating logic, the parsing/validation pipeline was extracted from GenerateJsonSchema into a shared buildJSONSchema, so generation and linting run the exact same code (pure refactor, existing tests unchanged).

Checklist

  • Tests added (table-driven; new lint functions at 100% coverage)
  • In-repo documentation updated (README "Lint subcommand" section)
  • go test -short ./..., golangci-lint, gosec, go vet and gofmt all clean

@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c2e43a0) to head (9581887).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #355   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        18    +1     
  Lines         1923      2003   +80     
=========================================
+ Hits          1923      2003   +80     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@somaz94
somaz94 marked this pull request as ready for review June 4, 2026 01:53
@somaz94
somaz94 requested review from applejag and losisin as code owners June 4, 2026 01:53
@somaz94

somaz94 commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Gentle ping @losisin 🙏 — green and ready for review. This adds a lint subcommand that validates the config and input schemas. Happy to adjust it to fit the project's direction — thanks for the great tool!

@losisin

losisin commented Jun 5, 2026

Copy link
Copy Markdown
Owner

@somaz94 I have it on my agenda to review. If it's ok, I'll create new release this weekend

@losisin losisin left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@losisin
losisin merged commit 58bd749 into losisin:main Jun 6, 2026
9 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.

Add helm schema lint command to lint the config file

2 participants