-
Notifications
You must be signed in to change notification settings - Fork 340
Description
This issue is intended to act as a tracking issue for an effort to standardize code style and formatting across the Security repository.
As things stand, there is a mix of styles being used in different parts of the repository. This can lead to confusion on the reader's behalf and also makes PRs challenging to review. If a reviewer does not check the "hide whitespace" option when reviewing, code changes can show as almost entirely made of indentation adjustments based on the settings of the contributor's IDE.
In order to correct this trend and provide further support to contributors, we should create a standardized stye policy which outlines the expected formatting of changes and provides a basic settings file users can copy to their IDE configurations.
Because standardizing the format of the code is such as large task this issue will be used to track incremental changes made to the PR all implementing the preferred style. Only after merging the first incremental PR will subsequent PRs be created since any changes to the style should be made to all code not just a given subsection.
The proposed guidelines planned to be introduced are:
- Use the same
spotlessApplypolicy as JobScheduler and other repositories as requested by @cwperks - Don't use mid-line linebreaks in markdown files as requested by @peternied
- Indentations should use 1 tab (of size 4 spaces) in Java files
- Indentations should be 2 spaces in YAML files
- There should be a preceding space before all 'if', 'for', 'while', 'switch', 'try', 'catch', and 'synchronized'
parentheses - There should be a preceding space before all non-unary operators
- Imports should use single class names (no wildcards)
- JavaDocs should use fully qualified class names
- Java.* imports should be placed at the top, followed by Javax.*, then all other imports, and finally static imports
Style Categories:
- Java Style
- YAML Style
- Markdown Style
Style PRs:
- Update non java files #2812
- Updates the style of all java files under the */dlic/util/ dir. #2823
- Updates all java files under security/* and test/security/a* -> test/security/m* #2826
- Update test/security/s* java files #2836
- Format all *.java files tests under test/security #2837
- Update the formatting of all *.java file under **/test/ #2840
- Update formatting of all *.java files under **/integrationTest #2863
- Finishes reformatting files by formatting all *.java files outside of **/test && **/integrationTest #2866
This is the branch with all the changes: https://github.com/scrawfor99/security/tree/formattingGuidelines