Skip to content

Conversation

@cpuguy83
Copy link
Collaborator

This was only ever intended to lint dalec.Spec, but is linting everything.
For some cases we got hit by the linter for a type that is unrelated to the spec and just went ahead and fixed it to pass CI and just never got around to fixing the linter.

This was only ever intended to lint dalec.Spec, but is linting
everything.
For some cases we got hit by the linter for a type that is unrelated to
the spec and just went ahead and fixed it to pass CI and just never got
around to fixing the linter.

Signed-off-by: Brian Goff <[email protected]>
Copilot AI review requested due to automatic review settings January 23, 2026 19:25
@cpuguy83 cpuguy83 self-assigned this Jan 23, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the struct tag linter to scope its validation to only types reachable from dalec.Spec, rather than checking all structs in all packages. Previously, the linter was incorrectly validating struct tags in unrelated types, which was not the intended behavior.

Changes:

  • Implements type reachability analysis to only validate structs transitively referenced from dalec.Spec
  • Adds package-level filtering to skip validation for packages that don't import or define the root type
  • Adds comprehensive tests for the new scoping behavior

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
linters/yaml_json_tags.go Implements type reachability analysis, adds flag support for configurable root type, and refactors analyzer creation into a factory function
linters/yaml_json_tags_test.go Adds new tests for type scoping and updates existing tests to use pointer receiver syntax
cmd/lint/main.go Updates to use the new analyzer factory function

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