Skip to content

Commit 601e245

Browse files
author
cjp4
committed
add sonar and checkstyle
1 parent 245ff8e commit 601e245

File tree

3 files changed

+62
-54
lines changed

3 files changed

+62
-54
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,36 @@ team help ...
4747
# run jar
4848
java -jar target/github-stats-*.jar
4949
```
50+
51+
## CheckStyle
52+
53+
```sh
54+
# compile the code
55+
mvn clean site
56+
57+
# file configuration
58+
checkStyle.xml
59+
60+
# file route
61+
\target\site\checkstyle.html
62+
```
63+
64+
## Sonar
65+
66+
```sh
67+
68+
# execute docker
69+
docker run -d --name sonarqube -p 9000:9000 sonarqube
70+
71+
# first time
72+
- crear un usuario
73+
- registrar el proyecto en sonar
74+
- seleccionar maven
75+
- copiar codigo de git con credenciales
76+
77+
# example
78+
mvn clean verify sonar:sonar \
79+
-Dsonar.projectKey=github-stats \
80+
-Dsonar.host.url=http://localhost:9000 \
81+
-Dsonar.login=sqp_3767710a555637629d9c6281fbf1bdf5fe87a942
82+
```

checkstyle.xml

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,6 @@
119119
<property name="tokens" value="ARRAY_DECLARATOR"/>
120120
<property name="option" value="EOL"/>
121121
</module>
122-
<!-- <module name="SeparatorWrap"> -->
123-
<!-- <property name="id" value="SeparatorWrapMethodRef"/> -->
124-
<!-- <property name="tokens" value="METHOD_REF"/> -->
125-
<!-- <property name="option" value="nl"/> -->
126-
<!-- </module> -->
127122
<module name="PackageName">
128123
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$"/>
129124
<message key="name.invalidPattern"
@@ -142,11 +137,6 @@
142137
<message key="name.invalidPattern"
143138
value="Parameter name ''{0}'' must match pattern ''{1}''."/>
144139
</module>
145-
<!-- <module name="CatchParameterName"> -->
146-
<!-- <property name="format" value="^[enu-z]([enu-z0-9][enu-zA-Z0-9]*)?$"/> -->
147-
<!-- <message key="name.invalidPattern" -->
148-
<!-- value="Catch parameter name ''{0}'' must match pattern ''{1}''."/> -->
149-
<!-- </module> -->
150140
<module name="LocalVariableName">
151141
<property name="tokens" value="VARIABLE_DEF"/>
152142
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
@@ -217,55 +207,11 @@
217207
<property name="allowSamelineMultipleAnnotations" value="true"/>
218208
</module>
219209
<module name="NonEmptyAtclauseDescription"/>
220-
<module name="JavadocTagContinuationIndentation">
221-
<property name="offset" value="0"/>
222-
</module>
223-
<module name="SummaryJavadoc">
224-
<property name="forbiddenSummaryFragments"
225-
value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
226-
</module>
227-
<module name="JavadocParagraph"/>
228-
<module name="AtclauseOrder">
229-
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
230-
<property name="target"
231-
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
232-
</module>
233-
<module name="JavadocMethod">
234-
<property name="accessModifiers" value="public"/>
235-
<property name="allowMissingParamTags" value="true"/>
236-
<property name="allowMissingReturnTag" value="true"/>
237-
<property name="allowedAnnotations" value="Override, Test"/>
238-
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, COMPACT_CTOR_DEF"/>
239-
</module>
240-
<module name="MissingJavadocMethod">
241-
<property name="scope" value="public"/>
242-
<property name="minLineCount" value="2"/>
243-
<property name="allowedAnnotations" value="Override, Test"/>
244-
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF,
245-
COMPACT_CTOR_DEF"/>
246-
</module>
247-
<module name="MissingJavadocType">
248-
<property name="scope" value="protected"/>
249-
<property name="tokens"
250-
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
251-
RECORD_DEF, ANNOTATION_DEF"/>
252-
<property name="excludeScope" value="nothing"/>
253-
</module>
254-
<module name="JavadocType">
255-
<property name="scope" value="public"/>
256-
<property name="authorFormat" value="\S"/>
257-
<property name="allowMissingParamTags" value="true"/>
258-
<property name="allowUnknownTags" value="false"/>
259-
<property name="tokens" value="INTERFACE_DEF, CLASS_DEF, ENUM_DEF, ANNOTATION_DEF"/>
260-
</module>
261210
<module name="MethodName">
262211
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
263212
<message key="name.invalidPattern"
264213
value="Method name ''{0}'' must match pattern ''{1}''."/>
265214
</module>
266-
<module name="SingleLineJavadoc">
267-
<property name="ignoreInlineTags" value="false"/>
268-
</module>
269215
<module name="EmptyCatchBlock">
270216
<property name="exceptionVariableName" value="expected"/>
271217
</module>

pom.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@
9999

100100
<build>
101101
<plugins>
102+
<plugin>
103+
<groupId>org.apache.maven.plugins</groupId>
104+
<artifactId>maven-site-plugin</artifactId>
105+
<version>3.7</version>
106+
</plugin>
107+
<plugin>
108+
<groupId>org.apache.maven.plugins</groupId>
109+
<artifactId>maven-project-info-reports-plugin</artifactId>
110+
<version>3.0.0</version>
111+
</plugin>
102112
<plugin>
103113
<groupId>org.springframework.boot</groupId>
104114
<artifactId>spring-boot-maven-plugin</artifactId>
@@ -120,4 +130,23 @@
120130
</plugin>
121131
</plugins>
122132
</build>
133+
<reporting>
134+
<plugins>
135+
<plugin>
136+
<groupId>org.apache.maven.plugins</groupId>
137+
<artifactId>maven-checkstyle-plugin</artifactId>
138+
<version>3.2.0</version>
139+
<configuration>
140+
<configLocation>checkstyle.xml</configLocation>
141+
</configuration>
142+
<reportSets>
143+
<reportSet>
144+
<reports>
145+
<report>checkstyle</report>
146+
</reports>
147+
</reportSet>
148+
</reportSets>
149+
</plugin>
150+
</plugins>
151+
</reporting>
123152
</project>

0 commit comments

Comments
 (0)