Versions Compared

Key

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

Attention To

Navigation

Table of Contents
absoluteUrltrue

...

Updated procedures should be published in tutorial wiki pages like AAI Tutorial-Making and Testing a Schema Change - Dublin

Bring discussion to AAI Weekly Status Meeting (Cancelled)

Bring discussion to AAI Developers Meeting

...

New schema or EdgeRule changes should be accompanied by updates to AAI R4 Integration Sanity Test Plans

Bring discussion to AAI Weekly Status Meeting (Cancelled)

Bring discussion to AAI Developers Meeting

...

Breaking changes should be accompanied by new documentation for readthedocs

Bring discussion to AAI Weekly Status Meeting (Cancelled)

Bring discussion to AAI Developers Meeting

Bring discussion to PTL Meeting

tbc

Contribution Type New Microservice

...

New microservice should be accompanied by new Helm charts for OOM deployment

Bring discussion to AAI Weekly Status Meeting (Cancelled)

Bring discussion to AAI Developers Meeting

...

New code repository should be accompanied by new Jenkins jobs

Bring discussion to AAI Weekly Status Meeting (Cancelled)

Bring discussion to AAI Developers Meeting

...

New REST URL API should be accompanied by new documentation for readthedocs

Bring discussion to AAI Weekly Status Meeting (Cancelled)

Bring discussion to AAI Developers Meeting

...

Decommissioning existing functions hasn't really happened yet, but it is definitely a "breaking change" (include the actions from section "Contribution Type Breaking Change to Schema or EdgeRule").

Bring discussion to AAI Weekly Status Meeting (Cancelled)

Bring discussion to AAI Developers Meeting

...

Contributing To AAI By Assisting with Maven Warnings


Contributions Coding Style

See also:

ONAP projects are built using maven and include the "checkstyle" plugin that is configured by the "oparent" module.

Developers can see the output of the "checkstyle" audit by explicitly triggering the phase with "mvn process-sources".

Most of the warnings from the "checkstyle" audit are considered to be "Low" priority (as per the JIRA case definitions Tracking Issues with JIRA#JIRAPriorityDefinitionforBugs) and many PTLs do not want to be flooded with these reviews while there are more urgent and important cases to finish.

However, the volume of the warnings can mask real problems, so it is still useful to resolve the underlying issues. Using the tools mentioned below could be a way to resolve many "checkstyle" warnings quickly, efficiently and consistently across the ONAP projects.

Referring to aai-common/pom.xml as configuration for the sub-components:

Code Block
languagexml
titleaai-common/pom.xml
collapsetrue
                <!--
                Using https://code.revelc.net/formatter-maven-plugin/ for Eclipse formatter
                Using https://github.com/diffplug/spotless/tree/master/plugin-maven for import order
                Use in combination to rewrite code and imports, then checkstyle
                
                mvn formatter:format spotless:apply process-sources
                -->
                <plugin>
                     <groupId>net.revelc.code.formatter</groupId>
                     <artifactId>formatter-maven-plugin</artifactId>
                     <version>2.8.1</version>
                     <configuration>
                        <configFile>${project.parent.basedir}/onap-java-formatter.xml</configFile>
                     </configuration>
                     <!-- https://code.revelc.net/formatter-maven-plugin/
                          use mvn formatter:format to rewrite source files
                          use mvn formatter:validate to validate source files -->
                 </plugin>
                <plugin>
                  <groupId>com.diffplug.spotless</groupId>
                  <artifactId>spotless-maven-plugin</artifactId>
                  <version>1.18.0</version>
                  <configuration>
                    <java>
                     <importOrder>
                       <order>com,java,javax,org</order>
                     </importOrder>
                    </java>
                  </configuration>
                <!-- https://github.com/diffplug/spotless/tree/master/plugin-maven
                     use mvn spotless:apply to rewrite source files
                     use mvn spotless:check to validate source files -->
                </plugin>


The "onap-java-formatter.xml" file contains an Eclipse formatter configuration, which can be imported and used in the Eclipse IDE by developers writing new code.

The "net.revelc.code.formatter" plugin uses the Eclipse formatter configuration to re-format the Java source code.

The "com.diffplug.spotless" plugin is used to rewrite the "import" statements in the Java source code. Technically, "com.diffplug.spotless" plugin can also use Eclipse formatter configuration to rewrite the Java source code, but it seemed to throw exceptions on some scenarios, making it a less reliable way than the "net.revelc.code.formatter" plugin.

The "com.diffplug.spotless" plugin also has other language capabilities, which could be useful as well, e.g. Javascript, JSON, YAML, etc, as well as a modular way to add more FormatterSteps.

After using the plugins to rewrite the source files, developers should choose which ones to commit to the repository. There will be several "checkstyle" warnings remaining that cannot be automatically rewritten, so the developers can focus on fixing those few items manually.

Other projects will be able to use this solution by:

  • copying the pom.xml plugin configuration into their own pom.xml (or refer to it from a common module like oparent)
  • copying the "onap-java-formatter.xml" file into their own code repositories (or refer to it from a common module like oparent)
  • training developers to make use of the plugins