-
Notifications
You must be signed in to change notification settings - Fork 367
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
Allow rules to override the declared default severity level #771
Conversation
None of the test have been updated as these changes require ever test to now specify the Before updating all of the tests to check for the This is an example of the test failure:
|
If this approach works the ability to add a custom message per rule would be able to be accomplished in the same manner: #768 |
If you want to extend the severity or message, you should probably extend the To be honest, I'm wondering if TFLint should allow for severity or message extensions, but even if I do, I have a lot to think about and I've been pending. |
I'm still getting familiar with both Go language and TFLint code (so excuse my asking so many questions). I started down that road wasn't able to find a way as all of the information from the configuration is stored in the |
So here is a concrete use case for allowing to override the severity of messages: Our company has a number of teams that are using Terraform and we recently started to enforce some basic standards with regards to formatting and style. We would love to have a consistent set of rules applied to our code, but this is going to take some time and different teams move at a different pace. We need the flexibility to set severity levels for different teams as they make this journey. Any further thoughts? |
Umm... In my opinion, if you want to extend this, I think it's better to write a ruleset plugin and use it. This is because my plan is that sometime I'd like to cut style rules as a plugin. On the other hand, given that famous linters such as ESLint provide extensions of severity as configurations, I think that providing such extensions as a feature of TFLint is not such a bad idea. However, some architectural changes are required to make this happen. First, when initializing the rule, we will need to accept the configuration as an argument. That seems like something we have to do, but nothing has been considered yet. |
This PR has been out of date since it was opened. I'll close this. Messages and severity can be overridden by plugins. If you want to fine-tune the impact of style issues, I recommend extending the plugin. You may want to do this in a simpler way than a plugin, so we may consider a new feature in the future. |
@wata727 with this PR closed, how then do we override severity? This looks like a nice to have. Extending plugins is definitely not practical and maintainable. |
Please don't start conversations on closed PRs. If you have new information to add, you can add a comment to #715. Otherwise, if you just want to indicate that it's a feature that would be important to you, you can 👍🏻 the original post. Yes, modifying the plugin is not a simple intervention. |
This adds the ability for rules to override the severity.
An example usage - this will override the rule's severity to
Error
. By default the severity is declared as "Notice"Fixes #715