Emit issues to the root module instead of each module #396
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request changes on how to handle issues found in modules. For example, consider the following configuration file:
As of v0.10.1, TFLint returns the result:
After this change, you get the following results:
What happens?
Previously issues found inside a module were reported along with the line number for that module. This has the advantage of keeping the implementation simple, but there are various disadvantages in practice.
In a simple example, an issue that already exists in the module cannot be properly ignored by the caller (root module). This is because the
tflint-ignore
annotation needs to be written for the line that reported the issue.Another major reason is the lack of compatibility with editor integration. Since there are no reported lines in the file being edited, it is difficult for the user to find issues caused by module arguments.
By reporting an issue to the root module that declares the module argument, you can easily see what issues the argument causes under the module. To achieve this, it internally knows how the module arguments are propagated to the child module. This means that issues that are not caused by module arguments will be ignored, as in the example above. Such issues should be found by inspecting the module itself.