Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Fixing existing code / PRs

Cleanup via IDEA

Use

...

IntelliJ to perform bulk cleanup

  • First, you MUST follow all the configurations in the IntelliJ configuration section above.  Especially pay attention to the settings marked optional, unless you are doing bulk edits.  Since you want to do bulk edits, those settings are now required.
  • Now open up any Java source file. You'll see Checkstyle warnings appear (if any) in RED.
    • This highlighting is enabled via the checkstyle plugin.
  • Bulk Reformat (an entire module): You can also reformat code in bulk in IDEA: https://www.jetbrains.com/help/idea/editor-basics.html#reformat_rearrange_code
    • Right click on a single directory / module
    • Select "Reformat Code"
      • Check "Optimize imports"  (This will remove any import statements with an asterisk)
      • Leave "Rearrange entries" unchecked (This will rearrange methods/variables based on arrangement settings in IDEA. We don't need this)
      • Under "Filters" → Check "File Masks" and enter in "*.java, *.xml"  (As we'll only bulk reformat Java and XML files)
      • Click Run
  • Finally, run Checkstyle against the module. There likely will still be a few failures to fix manually.

    Code Block
    # mvn install  (Only necessary if checkstyle:check below complains about missing SNAPSHOT dependencies)
    mvn -U checkstyle:check


  • Also double check license headers are still accurate. Sometimes these get "munged" during bulk reformat (as IDEA occasionally tries to merge nearby comments into one larger comment)

    Code Block
    mvn license:check