Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidDefinitionDescription Rule Check #5208

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

daghack
Copy link
Collaborator

@daghack daghack commented Aug 1, 2024

fixes #5169

Implements a check around definition description comments used by --call=outline and --call=targets.

@daghack daghack changed the title Add rule for arg / stage name comment descriptions InvalidDefinitionDescription Rule Check Aug 1, 2024
@daghack daghack force-pushed the invalid-definition-description-check branch from f2b6718 to 5e1ca11 Compare August 1, 2024 19:32
@daghack daghack self-assigned this Aug 1, 2024
@daghack daghack force-pushed the invalid-definition-description-check branch from 5e1ca11 to 91470a3 Compare August 1, 2024 19:49
@daghack
Copy link
Collaborator Author

daghack commented Aug 5, 2024

@dvdksn Do you mind taking a look at the docs here and shooting me suggestions? I'm not at all happy with them, and I'd love your input. 😍

@crazy-max crazy-max added this to the v0.16.0 milestone Aug 6, 2024
@daghack daghack force-pushed the invalid-definition-description-check branch 2 times, most recently from 5218f04 to ba68288 Compare August 9, 2024 16:11
@@ -233,30 +296,35 @@ COPY $bar .

func testRuleCheckOption(t *testing.T, sb integration.Sandbox) {
dockerfile := []byte(`#check=skip=all
#
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this should be needed. Directives are known comments and not associated with FROM. Probably makes sense to just ignore the whole first comment block(until empty line) as it is more likely about the whole file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree that this particular added comment line is less than ideal. Is there a way to do this from instrutions.Parse? I'd absolutely hate to have to try to move this check to the AST and I'm not sure that there's a sensible way to correlate any given FROM/ARG command's previous comment to the FIRST comment after the AST stage.

Copy link
Member

Choose a reason for hiding this comment

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

I think directives section can be taken out in the AST layer so that they do not appear as PrevComment in the AST. For the very first stage without global ARG we can maybe just ignore the warning.

frontend/dockerfile/dockerfile_lint_test.go Show resolved Hide resolved
@daghack daghack force-pushed the invalid-definition-description-check branch 7 times, most recently from f060309 to 9c3fcea Compare August 15, 2024 13:32
@thompson-shaun thompson-shaun modified the milestones: v0.16.0, v0.17.0 Aug 29, 2024
@github-actions github-actions bot added area/llb area/hack building buildkit itself labels Sep 19, 2024
@daghack daghack force-pushed the invalid-definition-description-check branch from fe59af0 to 4270ddf Compare September 19, 2024 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement InvalidDefinitionDescription Rule Check
5 participants