Skip to content

Commit 111d37d

Browse files
authored
60 Apply check-style and refactor (#61)
* Apply check-style and refactor * Fix duplication and float parse
1 parent 96c22f8 commit 111d37d

File tree

11 files changed

+2205
-692
lines changed

11 files changed

+2205
-692
lines changed

pom.xml

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>net.coru</groupId>
88
<artifactId>scc-multiapi-converter</artifactId>
9-
<version>2.6.2</version>
9+
<version>2.7.0</version>
1010
<name>SCC-MultiApi-Converter</name>
1111
<description>Generates Spring Cloud Contracts based on an OpenApi and AsyncApi document</description>
1212
<url>https://github.com/corunet/scc-multiapi-converter</url>
@@ -35,7 +35,7 @@
3535
<developer>
3636
<id>jegarcia</id>
3737
<name>Jose Enrique Garcia Maciñeiras</name>
38-
<email>jegarcia@corunet.com</email>
38+
<email>joseenrique.garcia@sngular.com</email>
3939
<organization>Corunet</organization>
4040
<organizationUrl>https://corunet.github.io/</organizationUrl>
4141
<roles>
@@ -47,7 +47,7 @@
4747
<developer>
4848
<id>cmunozgomez</id>
4949
<name>Cesar Munoz Gomez</name>
50-
<email>cmunoz@corunet.com</email>
50+
<email>cesar.munoz@sngular.com</email>
5151
<organization>Corunet</organization>
5252
<organizationUrl>https://corunet.github.io/</organizationUrl>
5353
<roles>
@@ -58,7 +58,7 @@
5858
<developer>
5959
<id>Rivarsal</id>
6060
<name>Pablo José López Rivadulla</name>
61-
<email>plopez@corunet.com</email>
61+
<email>pablo.lopezr@sngular.com</email>
6262
<organization>Corunet</organization>
6363
<organizationUrl>https://corunet.github.io/</organizationUrl>
6464
<roles>
@@ -69,7 +69,7 @@
6969
<developer>
7070
<id>fcampostato</id>
7171
<name>Fernando Campos Tato</name>
72-
<email>fcampos@corunet.com</email>
72+
<email>fernando.campos@sngular.com</email>
7373
<organization>Corunet</organization>
7474
<organizationUrl>https://corunet.github.io/</organizationUrl>
7575
<roles>
@@ -80,7 +80,7 @@
8080
<developer>
8181
<id>jmejutovazquez</id>
8282
<name>Javier Mejuto Vázquez</name>
83-
<email>jmejuto@corunet.com</email>
83+
<email>javier.mejuto@sngular.com</email>
8484
<organization>Corunet</organization>
8585
<organizationUrl>https://corunet.github.io/</organizationUrl>
8686
<roles>
@@ -91,7 +91,7 @@
9191
<developer>
9292
<id>mcabezasp</id>
9393
<name>Miguel Cabezas Puerto</name>
94-
<email>mcabezas@corunet.com</email>
94+
<email>miguel.cabezas@sngular.com</email>
9595
<organization>Corunet</organization>
9696
<organizationUrl>https://corunet.github.io/</organizationUrl>
9797
<roles>
@@ -192,7 +192,43 @@
192192
</dependency>
193193
</dependencies>
194194
<build>
195+
<pluginManagement>
196+
<plugins>
197+
<plugin>
198+
<groupId>org.apache.maven.plugins</groupId>
199+
<artifactId>maven-checkstyle-plugin</artifactId>
200+
<version>3.1.2</version>
201+
<dependencies>
202+
<dependency>
203+
<groupId>com.puppycrawl.tools</groupId>
204+
<artifactId>checkstyle</artifactId>
205+
<version>10.2</version>
206+
</dependency>
207+
</dependencies>
208+
</plugin>
209+
</plugins>
210+
</pluginManagement>
195211
<plugins>
212+
<plugin>
213+
<groupId>org.apache.maven.plugins</groupId>
214+
<artifactId>maven-checkstyle-plugin</artifactId>
215+
<configuration>
216+
<configLocation>styles/checkstyle/OSS_checkstyle.xml</configLocation>
217+
<encoding>UTF-8</encoding>
218+
<consoleOutput>true</consoleOutput>
219+
<failsOnError>true</failsOnError>
220+
<linkXRef>false</linkXRef>
221+
</configuration>
222+
<executions>
223+
<execution>
224+
<id>validate</id>
225+
<goals>
226+
<goal>check</goal>
227+
</goals>
228+
<phase>validate</phase>
229+
</execution>
230+
</executions>
231+
</plugin>
196232
<plugin>
197233
<groupId>org.apache.maven.plugins</groupId>
198234
<artifactId>maven-plugin-plugin</artifactId>
@@ -287,4 +323,16 @@
287323
</plugin>
288324
</plugins>
289325
</build>
326+
327+
<reporting>
328+
<plugins>
329+
<plugin>
330+
<groupId>org.apache.maven.plugins</groupId>
331+
<artifactId>maven-checkstyle-plugin</artifactId>
332+
<configuration>
333+
<configLocation>styles/checkstyle/OSS_checkstyle.xml</configLocation>
334+
</configuration>
335+
</plugin>
336+
</plugins>
337+
</reporting>
290338
</project>

src/main/java/net/coru/multiapi/converter/MultiApiContractConverter.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import org.springframework.cloud.contract.spec.ContractConverter;
2222

2323
@Slf4j
24-
public class MultiApiContractConverter implements ContractConverter<Collection<Contract>> {
24+
public final class MultiApiContractConverter implements ContractConverter<Collection<Contract>> {
2525

2626
private static final OpenApiContractConverter OPEN_API_CONTRACT_CONVERTER = new OpenApiContractConverter();
2727

@@ -35,8 +35,8 @@ public boolean isAccepted(final File file) {
3535
try {
3636
final JsonNode node;
3737
node = BasicTypeConstants.OBJECT_MAPPER.readTree(file);
38-
isAccepted = (node != null && node.size() > 0 && (Objects.nonNull(node.get(BasicTypeConstants.ASYNCAPI)) || Objects.nonNull(node.get(BasicTypeConstants.OPENAPI))));
39-
} catch (IOException e) {
38+
isAccepted = node != null && node.size() > 0 && (Objects.nonNull(node.get(BasicTypeConstants.ASYNCAPI)) || Objects.nonNull(node.get(BasicTypeConstants.OPENAPI)));
39+
} catch (final IOException e) {
4040
isAccepted = false;
4141
}
4242
}
@@ -47,7 +47,7 @@ public boolean isAccepted(final File file) {
4747
public Collection<Contract> convertFrom(final File file) {
4848

4949
Collection<Contract> contracts = null;
50-
JsonNode node;
50+
final JsonNode node;
5151
if (isAccepted(file)) {
5252
try {
5353
node = BasicTypeConstants.OBJECT_MAPPER.readTree(file);
@@ -60,13 +60,15 @@ public Collection<Contract> convertFrom(final File file) {
6060
} else {
6161
throw new MultiApiContractConverterException("Yaml file is not correct");
6262
}
63-
} catch (IOException e) {
63+
} catch (final IOException e) {
6464
throw new MultiApiContractConverterException(e);
6565
}
6666
}
6767
return contracts;
6868
}
6969

7070
@Override
71-
public Collection<Contract> convertTo(final Collection<Contract> contract) {return contract;}
71+
public Collection<Contract> convertTo(final Collection<Contract> contract) {
72+
return contract;
73+
}
7274
}

0 commit comments

Comments
 (0)