DBZ-1603 Only run format validation on Travis CI and not auto-format.

This commit is contained in:
Chris Cranford 2019-11-08 14:31:04 -05:00 committed by Jiri Pechanec
parent bb052c0c4b
commit 39226d1865
3 changed files with 30 additions and 8 deletions

View File

@ -4,12 +4,12 @@ cache:
- $HOME/.m2/repository
env:
- MAVEN_CLI: '"clean install -B -pl debezium-connector-sqlserver -am -Passembly"'
- MAVEN_CLI: '"clean install -B -pl debezium-connector-mysql -am -Passembly"'
- MAVEN_CLI: '"clean install -B -pl debezium-connector-postgres -am -Passembly"'
- MAVEN_CLI: '"clean install -B -pl debezium-connector-postgres -am -Passembly,wal2json-decoder"'
- MAVEN_CLI: '"clean install -B -pl debezium-connector-postgres -am -Passembly,pgoutput-decoder,postgres-10 -Ddebezium.test.records.waittime=5"'
- MAVEN_CLI: '"clean install -B -pl debezium-connector-mongodb -am -Passembly"'
- MAVEN_CLI: '"clean install -B -pl debezium-connector-sqlserver -am -Passembly -Dformat.formatter.goal=validate -Dformat.imports.goal=check"'
- MAVEN_CLI: '"clean install -B -pl debezium-connector-mysql -am -Passembly -Dformat.formatter.goal=validate -Dformat.imports.goal=check"'
- MAVEN_CLI: '"clean install -B -pl debezium-connector-postgres -am -Passembly -Dformat.formatter.goal=validate -Dformat.imports.goal=check"'
- MAVEN_CLI: '"clean install -B -pl debezium-connector-postgres -am -Passembly,wal2json-decoder -Dformat.formatter.goal=validate -Dformat.imports.goal=check"'
- MAVEN_CLI: '"clean install -B -pl debezium-connector-postgres -am -Passembly,pgoutput-decoder,postgres-10 -Ddebezium.test.records.waittime=5 -Dformat.formatter.goal=validate -Dformat.imports.goal=check"'
- MAVEN_CLI: '"clean install -B -pl debezium-connector-mongodb -am -Passembly -Dformat.formatter.goal=validate -Dformat.imports.goal=check"'
sudo: required

View File

@ -159,6 +159,24 @@ to the database and use logical decoding to read the transaction log. Several ne
integration test were added.
```
### Code Formatting
This project utilizes a set of code style rules that are automatically applied by the build process. When contributing, it is a good idea to run a build locally to make sure that all code changes you plan to contribute adhere to this style.
In the event that a pull request is submitted with code style violations, continuous integration will fail the pull request build.
To fix pull requests with code style violations, simply run the project's build locally and allow the automatic formatting happen. Once the build completes, you will have some local repository files modified to fix the coding style which can be amended on your pull request. Once the pull request is synchronized with the formatting changes, CI will rerun the build.
To run the build, navigate to the project's root directory and run:
$ mvn clean install
It might be useful to simply run a _validate_ check against the code instead of automatically applying code style changes. If you want to simply run validation, navigate to the project's root directory and run:
$ mvn clean install -Dformat.formatter.goal=validate -Dformat.imports.goal=check
Please note that when running _validate_ checks, the build will stop as soon as it encounters its first violation. This means it is necessary to run the build multiple times until no violations are detected.
### Rebasing
If its been more than a day or so since you created your topic branch, we recommend *rebasing* your topic branch on the latest `master` branch. This requires switching to the `master` branch, pulling the latest changes, switching back to your topic branch, and rebasing:

View File

@ -114,6 +114,10 @@
<!-- Do not skip formatting source code by default -->
<format.skip>false</format.skip>
<!-- Set formatting default goals -->
<format.formatter.goal>format</format.formatter.goal>
<format.imports.goal>sort</format.imports.goal>
<!-- No debug options by default -->
<debug.argline />
@ -529,7 +533,7 @@
<execution>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
<goal>${format.formatter.goal}</goal>
</goals>
</execution>
</executions>
@ -544,7 +548,7 @@
<execution>
<id>sort-imports</id>
<goals>
<goal>sort</goal>
<goal>${format.imports.goal}</goal>
</goals>
</execution>
</executions>