-
Notifications
You must be signed in to change notification settings - Fork 212
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
Lint for parameters being used in actions to which they don't apply #3034
Conversation
Signed-off-by: Kim Christensen <kimworking@gmail.com>
My initial thought is: "Cool, but are we breaking backward compat with this?" - which I think is a a big yes, but I think it may be okay to do it in this case. |
@schristoff Completely forgot about backwards compability with this change. That said, in my opinion, it is not fully backwards compatible. No matter what happens with this PR, there should probably be some sort of strategy for adding new lints, as all new lints can be considered breaking changes in the sense that they potentially breaks existing builds, at least for errors. Might be worth taking up on a community meeting. |
I agree it's better to hit this at build time than runtime. Any breakages because should only be on already broken bundles I would imagine |
pkg/linter/linter.go
Outdated
} | ||
results = append(results, res...) | ||
} | ||
span.EndSpan() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a defer otherwise this won't get closed if the return on 208 is hit. Any reason to have 2 different spans in here instead of a single one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, in both cases. Also I cannot find any good reasons for 2 spans here. I will change it
Can you add an integration test for this as well? |
Signed-off-by: Kim Christensen <kimworking@gmail.com>
Signed-off-by: Kim Christensen <kimworking@gmail.com>
@sgettys Sure, it has been added |
Since our next release is 1.1.0 (I know, breaking compat should be 2.0+ but this is a small compat thing) I'm fine with merging this sooner rather than later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good once conflicts are resolved
Signed-off-by: Kim Christensen <2461567+kichristensen@users.noreply.github.com>
What does this change
Update linter to check if parameters are being used in actions to which they don't apply, as it would cause a runtime failure.
If a parameter is used in an action to which is doesn't apply
porter lint
will produce the output similar to this:What issue does it fix
Closes #1018
Notes for the reviewer
Put any questions or notes for the reviewer here.
Checklist
Reviewer Checklist