Fail build on wildcard imports#18
Fail build on wildcard imports#18dbwiddis merged 2 commits intoopensearch-project:mainfrom dbwiddis:starimport
Conversation
Signed-off-by: Daniel Widdis <widdis@gmail.com>
peternied
left a comment
There was a problem hiding this comment.
What about pulling in checkstyle to enforce this [check] instead of writing it on your own(https://checkstyle.org/config_imports.html#AvoidStarImport)?
We have removed CheckStyle from OpenSearch to have one formatting tool(Spotless) throughout the repo and following the same here as well. |
Signed-off-by: Daniel Widdis <widdis@gmail.com>
|
Ready for review. Initial test failure after adding the check. Tests pass after removing star imports in c0f119d |
|
Note: the error message isn't very informative and I had to hunt down the star imports; however, for future failures they'll likely be part of the diff and much easier to identify. It may be possible to get line numbers but that adds some complexity. |
From opensearch-project/OpenSearch#1362, I see 'it caused issue on plugins side '. Seems like this is a cause of tight build system coupling rather than the tool itself being a problem. While I agree that removing * imports is a good thing, lack of built-in IDE integration and a host of features that might need to be duplicated for future coverage will be the cost of this pattern. |
I'm not familiar with the background of the decision to remove Checkstyle from Opensearch and wonder if it could be considered to be brought back for some specific "style" checks that Spotless doesn't do. Spotless is mostly a formatting tool, while Checkstyle also checks things like redundant modifiers, variable naming conventions, etc.
Not sure how integrated checkstyle is? Don't most IDEs already have an easily toggleable option to remove * imports? |
peternied
left a comment
There was a problem hiding this comment.
Keeping this commit unblocked for merging to keep progress moving on this pull request. If we encounter 'checks' that are already implemented via checkstyle, I think it might be worthwhile to revisit some of these comments.
Thanks for the great back-and-forth @dbwiddis
We wanted to have only one formatting tool for OpenSearch and that's why asked the Plugin teams to follow the same. Does CheckStyle provides more benefits than Spotless? Something we can think of for the future definitely. |
Fail build on wildcard imports
Signed-off-by: Daniel Widdis widdis@gmail.com
Description
Fails the build if a regex matching a wildcard import is encountered.
Issues Resolved
Closes #3
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.