-
Notifications
You must be signed in to change notification settings - Fork 755
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
Support running linter from CLI separately to build #2811
Comments
@johndowns - would using bicepsettings.json to set all of the rules to |
@MarcusFelling I don't think so. It's a workaround, but I don't think it's the optimal solution. The key thing to me is that:
So to me, it'd be better if I could have a |
@johndowns - does this ask apply purely to linter warnings, or are you looking for any warnings to be treated as errors? For example, the following type validation message is a core compiler warning (not a linter warning): |
@anthony-c-martin In principle it'd be good to apply it to all warnings, but my concern is that there are still some situations where RPs haven't properly documented their schemas, and so compiler warnings will appear that I have no control over. If the |
I came here because I was looking for this exact thing. Having a |
Any plans of this feature, thought it would be a handy one. |
We agree it would be a useful command to add, but don't have the time to implement it ourselves. It would be great if someone could make an external contribution for this one. |
# Contributing a Pull Request If you haven't already, read the full [contribution guide](https://github.com/Azure/bicep/blob/main/CONTRIBUTING.md). The guide may have changed since the last time you read it, so please double-check. Once you are done and ready to submit your PR, run through the relevant checklist below. ## Contributing a feature * [x] I have opened a new issue for the proposal, or commented on an existing one, and ensured that the Bicep maintainers are good with the design of the feature being implemented * [x] I have included "Fixes #{issue_number}" in the PR description, so GitHub can link to the issue and close it when the PR is merged * [ ] I have appropriate test coverage of my new feature Fixes #2811 Added new command `lint` that will return an error exit code when there are any warnings or errors when building the bicep files. The command has a flag `--ignore-warnings` to only react on errors, not sure if this is needed though since you could use the `build` command instead. I also added tests, copied and refactored from `build` command tests, I could use some feedback if the tests cover enough or there are some missing tests that should be added (that's why I didn't check the test checkbox above). ## Checklist/discussion points - [ ] Do we want the `--ignore-warnings` flag? Does it serve a purpose? - [ ] Are there any more tests needed? - [ ] #2811 describes different exit codes depending on warnings/errors, is this wanted? - [ ] Are there any additional flags that are needed for the command? ###### Microsoft Reviewers: [Open in CodeFlow](https://portal.fabricbot.ms/api/codeflow?pullrequest=https://github.com/Azure/bicep/pull/10819) --------- Co-authored-by: Anthony Martin <38542602+anthony-c-martin@users.noreply.github.com>
# Contributing a Pull Request If you haven't already, read the full [contribution guide](https://github.com/Azure/bicep/blob/main/CONTRIBUTING.md). The guide may have changed since the last time you read it, so please double-check. Once you are done and ready to submit your PR, run through the relevant checklist below. ## Contributing a feature * [x] I have opened a new issue for the proposal, or commented on an existing one, and ensured that the Bicep maintainers are good with the design of the feature being implemented * [x] I have included "Fixes #{issue_number}" in the PR description, so GitHub can link to the issue and close it when the PR is merged * [ ] I have appropriate test coverage of my new feature Fixes #2811 Added new command `lint` that will return an error exit code when there are any warnings or errors when building the bicep files. The command has a flag `--ignore-warnings` to only react on errors, not sure if this is needed though since you could use the `build` command instead. I also added tests, copied and refactored from `build` command tests, I could use some feedback if the tests cover enough or there are some missing tests that should be added (that's why I didn't check the test checkbox above). ## Checklist/discussion points - [ ] Do we want the `--ignore-warnings` flag? Does it serve a purpose? - [ ] Are there any more tests needed? - [ ] #2811 describes different exit codes depending on warnings/errors, is this wanted? - [ ] Are there any additional flags that are needed for the command? ###### Microsoft Reviewers: [Open in CodeFlow](https://portal.fabricbot.ms/api/codeflow?pullrequest=https://github.com/Azure/bicep/pull/10819) --------- Co-authored-by: Anthony Martin <38542602+anthony-c-martin@users.noreply.github.com>
Is your feature request related to a problem? Please describe.
When I create a CI/CD pipeline to work with my Bicep templates, I want to run linter rules and fail the build if there are any warnings or errors. Currently, the
bicep build
command executes the linter but shows linter warnings as outputs, and the exit code is 0, so it's not easy to pick up that linter rules failed. Additionally,bicep build
emits a JSON template, which I don't need.Describe the solution you'd like
Please provide a new
bicep lint
command, which will run the same linter rules asbicep build
, but will return a meaningful exit code (perhaps 0 for no linter warnings, 1 for warnings, 2 for errors?) and that doesn't emit a JSON template.The text was updated successfully, but these errors were encountered: