Unmaintained repository. Development moved to: https://github.com/nordic-institute/X-Road-development
19
stars
8
forks
source link
As a Product Owner I want consistent Java import order to taken into use so that all X-Road Java source code files are using the same import style #183
Problem
Java import order itself is not very significant, but the consistency is (causes merge noise and conflicts). The popular Java style guides (google, twitter, ...) all have different opinions about the order. Here, it was proposed the following ordering:
Organize imports by blocks separated by an empty line:
-- imports from ee.ria.xroad or any subpackages thereof
-- all other imports in one block
-- imports from javax or any subpackages thereof
-- imports from java or any subpackages thereof
-- all static imports in one block
Within each block the lines should be sorted alphabetically
No wildcard imports
-- (see e.g. http://javadude.com/articles/importondemandisevil.html)
-- IDEs tend to collapse long import blocks anyway, and handle adding and removing imports (but a lot of imports can also be a code smell)
The above order can be enforced by checkstyle rules, and implemented by IntelliJ Idea, Eclipse, and Netbeans. The rationale is to have a style that the tools support and place the more interesting imports first.
Actions put to use the above steps needs restructuring some code and changes should be done in one big block: It should be created a new Pull Request including only changes related to Java import order. It was estimated that 70% of files would be changed because of changing import order. One Pull Request dedicated for only the import order changes would be most easiest way to get the changes for all.
Acceptance criteria
Checkstyle rules for Java import order are created
Consistent Java import order is taken into use for every Java source code files of X-Road
New Pull Request for the above changes is created to ria-ee/X-Road development branch
Affected components: All Affected documentation: NFR Estimated delivery: Q4 / 2017 External reference: https://jira.csc.fi/browse/PVAYLADEV-981
Problem Java import order itself is not very significant, but the consistency is (causes merge noise and conflicts). The popular Java style guides (google, twitter, ...) all have different opinions about the order. Here, it was proposed the following ordering:
The above order can be enforced by checkstyle rules, and implemented by IntelliJ Idea, Eclipse, and Netbeans. The rationale is to have a style that the tools support and place the more interesting imports first.
Actions put to use the above steps needs restructuring some code and changes should be done in one big block: It should be created a new Pull Request including only changes related to Java import order. It was estimated that 70% of files would be changed because of changing import order. One Pull Request dedicated for only the import order changes would be most easiest way to get the changes for all.
Acceptance criteria