Skip to content

Commit 5835dcb

Browse files
authored
Validate code format when building on travis (OpenFeign#767)
* Validate code format when building on travis * Fix code format
1 parent e4743d4 commit 5835dcb

File tree

3 files changed

+41
-8
lines changed

3 files changed

+41
-8
lines changed

jaxb/src/test/java/feign/jaxb/JAXBCodecTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ public void encodesXmlWithCustomJAXBNoNamespaceSchemaLocation() throws Exception
123123

124124
assertThat(template)
125125
.hasBody(
126-
"<?xml version=\"1.0\" encoding=\"UTF-8\" " +
127-
"standalone=\"yes\"?><mockObject xsi:noNamespaceSchemaLocation=\"http://apihost/schema.xsd\" " +
128-
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" +
129-
"<value>Test</value></mockObject>");
126+
"<?xml version=\"1.0\" encoding=\"UTF-8\" "
127+
+ "standalone=\"yes\"?><mockObject xsi:noNamespaceSchemaLocation=\"http://apihost/schema.xsd\" "
128+
+ "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
129+
+ "<value>Test</value></mockObject>");
130130
}
131131

132132
@Test
@@ -180,9 +180,9 @@ public void decodesXml() throws Exception {
180180
public void doesntDecodeParameterizedTypes() throws Exception {
181181
thrown.expect(feign.codec.DecodeException.class);
182182
thrown.expectMessage(
183-
"java.util.Map is an interface, and JAXB can't handle interfaces.\n"+
184-
"\tthis problem is related to the following location:\n"+
185-
"\t\tat java.util.Map");
183+
"java.util.Map is an interface, and JAXB can't handle interfaces.\n"
184+
+ "\tthis problem is related to the following location:\n"
185+
+ "\t\tat java.util.Map");
186186

187187
class ParameterizedHolder {
188188

pom.xml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,39 @@
472472
<module>jaxb</module>
473473
</modules>
474474
</profile>
475+
476+
<profile>
477+
<id>validateCodeFormat</id>
478+
<activation>
479+
<property>
480+
<name>validateFormat</name>
481+
</property>
482+
</activation>
483+
484+
<build>
485+
<plugins>
486+
<plugin>
487+
<groupId>com.marvinformatics.formatter</groupId>
488+
<artifactId>formatter-maven-plugin</artifactId>
489+
<version>2.2.0</version>
490+
<configuration>
491+
<lineEnding>LF</lineEnding>
492+
<configFile>${main.basedir}/src/config/eclipse-java-style.xml</configFile>
493+
</configuration>
494+
<executions>
495+
<execution>
496+
<id>validate-only</id>
497+
<goals>
498+
<goal>validate</goal>
499+
</goals>
500+
<phase>initialize</phase>
501+
</execution>
502+
</executions>
503+
</plugin>
504+
</plugins>
505+
</build>
506+
</profile>
507+
475508
<profile>
476509
<id>release</id>
477510
<build>

travis/publish.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ if ! is_pull_request && build_started_by_tag; then
159159
fi
160160

161161
# skip license on travis due to #1512
162-
./mvnw install -nsu -Dlicense.skip=true
162+
./mvnw install -nsu -Dlicense.skip=true -DvalidateFormat
163163

164164
# If we are on a pull request, our only job is to run tests, which happened above via ./mvnw install
165165
if is_pull_request; then

0 commit comments

Comments
 (0)