Skip to content

Commit 60ac9cf

Browse files
add checkStyle and findBug and fix some problems. Delete empty links from final tree report.
1 parent 1455a9b commit 60ac9cf

33 files changed

+610
-255
lines changed

pom.xml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,41 @@
3939
</dependency>
4040
</dependencies>
4141

42+
<reporting>
43+
<plugins>
44+
<plugin>
45+
<groupId>org.apache.maven.plugins</groupId>
46+
<artifactId>maven-checkstyle-plugin</artifactId>
47+
<version>2.17</version>
48+
<configuration>
49+
<configLocation>settings/checkstyle.xml</configLocation></configuration>
50+
<reportSets>
51+
<reportSet>
52+
<reports>
53+
<report>checkstyle</report>
54+
</reports>
55+
</reportSet>
56+
</reportSets>
57+
</plugin>
58+
<plugin>
59+
<groupId>org.codehaus.mojo</groupId>
60+
<artifactId>findbugs-maven-plugin</artifactId>
61+
<version>3.0.4</version>
62+
<configuration>
63+
<xmlOutput>true</xmlOutput>
64+
</configuration>
65+
</plugin>
66+
</plugins>
67+
</reporting>
68+
4269
<build>
4370
<finalName>${project.artifactId}-${project.version}</finalName>
4471
<plugins>
72+
<plugin>
73+
<groupId>org.apache.maven.plugins</groupId>
74+
<artifactId>maven-project-info-reports-plugin</artifactId>
75+
<version>2.7</version>
76+
</plugin>
4577
<!-- Copy the runtime dependencies to the lib folder. -->
4678
<plugin>
4779
<artifactId>maven-dependency-plugin</artifactId>
@@ -131,6 +163,106 @@
131163
</execution>
132164
</executions>
133165
</plugin>
166+
167+
<plugin>
168+
<groupId>org.apache.maven.plugins</groupId>
169+
<artifactId>maven-checkstyle-plugin</artifactId>
170+
<version>2.17</version>
171+
<executions>
172+
<execution>
173+
<id>checkstyle</id>
174+
<phase>validate</phase>
175+
<goals>
176+
<goal>check</goal>
177+
</goals>
178+
<configuration>
179+
<configLocation>settings/checkstyle.xml</configLocation>
180+
<encoding>UTF-8</encoding>
181+
<consoleOutput>true</consoleOutput>
182+
<failsOnError>true</failsOnError>
183+
<linkXRef>false</linkXRef>
184+
</configuration>
185+
</execution>
186+
</executions>
187+
<dependencies>
188+
<dependency>
189+
<groupId>com.puppycrawl.tools</groupId>
190+
<artifactId>checkstyle</artifactId>
191+
<version>8.1</version>
192+
</dependency>
193+
</dependencies>
194+
</plugin>
195+
196+
<plugin>
197+
<groupId>org.codehaus.mojo</groupId>
198+
<artifactId>findbugs-maven-plugin</artifactId>
199+
<version>3.0.4</version>
200+
<configuration>
201+
<xmlOutput>true</xmlOutput>
202+
</configuration>
203+
<executions>
204+
<execution>
205+
<id>findbugs</id>
206+
<goals><goal>check</goal></goals>
207+
<phase>validate</phase>
208+
</execution>
209+
</executions>
210+
</plugin>
211+
134212
</plugins>
213+
<pluginManagement>
214+
<plugins>
215+
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
216+
<plugin>
217+
<groupId>org.eclipse.m2e</groupId>
218+
<artifactId>lifecycle-mapping</artifactId>
219+
<version>1.0.0</version>
220+
<configuration>
221+
<lifecycleMappingMetadata>
222+
<pluginExecutions>
223+
<pluginExecution>
224+
<pluginExecutionFilter>
225+
<groupId>
226+
org.apache.maven.plugins
227+
</groupId>
228+
<artifactId>
229+
maven-checkstyle-plugin
230+
</artifactId>
231+
<versionRange>
232+
[2.17,)
233+
</versionRange>
234+
<goals>
235+
<goal>check</goal>
236+
</goals>
237+
</pluginExecutionFilter>
238+
<action>
239+
<ignore></ignore>
240+
</action>
241+
</pluginExecution>
242+
<pluginExecution>
243+
<pluginExecutionFilter>
244+
<groupId>
245+
org.codehaus.mojo
246+
</groupId>
247+
<artifactId>
248+
findbugs-maven-plugin
249+
</artifactId>
250+
<versionRange>
251+
[3.0.4,)
252+
</versionRange>
253+
<goals>
254+
<goal>check</goal>
255+
</goals>
256+
</pluginExecutionFilter>
257+
<action>
258+
<ignore></ignore>
259+
</action>
260+
</pluginExecution>
261+
</pluginExecutions>
262+
</lifecycleMappingMetadata>
263+
</configuration>
264+
</plugin>
265+
</plugins>
266+
</pluginManagement>
135267
</build>
136268
</project>

settings/checkstyle.xml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
3+
<!--
4+
Dan:
5+
Resurse:
6+
fisierul pt Google style: https://github.com/checkstyle/checkstyle/blob/97669248fb2402e21cd372380a35d0e312c2a0e8/src/main/resources/google_checks.xml
7+
fisierul pt Sun style: https://github.com/checkstyle/checkstyle/blob/97669248fb2402e21cd372380a35d0e312c2a0e8/src/main/resources/sun_checks.xml
8+
9+
Check-urile disponibile:
10+
http://checkstyle.sourceforge.net/checks.html
11+
-->
12+
<module name="Checker">
13+
<property name="severity" value="warning" />
14+
15+
<module name="TreeWalker">
16+
17+
<!--
18+
Dan: Poate fi folosit pentru a exclude cateva linii de la analiza checkstyle.
19+
20+
// CHECKSTYLE:OFF
21+
// CHECKSTYLE:ON
22+
-->
23+
<module name="SuppressionCommentFilter"/>
24+
25+
<!-- Dan: Asta nu ar trebui sa fie necesar daca Eclipse-ul este configurat cum trebuie, si e oricum foarte greu de rezolvat. -->
26+
<!--
27+
<module name="FileTabCharacter" />
28+
-->
29+
30+
<!-- Dan: Nu mi se pare necesar, e vorba de static vs abstract din definirea unei clase. -->
31+
<module name="ModifierOrder" />
32+
33+
<!-- Dan: Nu mi se pare necesar, e vorba de static inaintea unei field dintr-o interfata sau enumerare. -->
34+
<module name="RedundantModifier" />
35+
36+
<module name="JavadocMethod" >
37+
<!-- Dan: Este bine sa scoatem setterii si geterii, de obicei documentatia nu aduce nimic nou. -->
38+
<property name="allowMissingPropertyJavadoc" value="true"/>
39+
</module>
40+
41+
<!-- Dan: Mi se pare overkill sa tot documentez si in parametrii constructorului si in field-uri acelasi lucru. -->
42+
<module name="JavadocVariable">
43+
<property name="scope" value="public" />
44+
</module>
45+
46+
<!-- Dan: Am adaugat _ pt ca il folosesc in numele stagiilor. E ceva specific Chemistry. -->
47+
<module name="TypeName" >
48+
<property name="format" value="^[A-Z]([a-zA-Z0-9]|_)*$"/>
49+
</module>
50+
51+
<module name="JavadocType" />
52+
53+
<!-- Dan: Este nice to have, dar poate da prea multe erori, nu stiu cat poate dura. -->
54+
<!--
55+
<module name="JavadocStyle">
56+
<property name="checkFirstSentence" value="false"/>
57+
</module>
58+
-->
59+
60+
<module name="ConstantName">
61+
<!-- Dan: Este adaugat si logger-ul. -->
62+
<property name="format" value="^([A-Z][A-Z0-9]*(_[A-Z0-9]+)*|logger)$" />
63+
</module>
64+
65+
<!-- Dan: Astea sunt ok. -->
66+
<module name="LocalFinalVariableName" />
67+
<module name="LocalVariableName" />
68+
<module name="MemberName" />
69+
<module name="MethodName" />
70+
<module name="PackageName" />
71+
<module name="ParameterName" />
72+
<module name="StaticVariableName" />
73+
74+
75+
<!-- Dan: Nu te lasa sa importi clase de implementare din RT, gen sun.* -->
76+
<module name="IllegalImport" />
77+
78+
<!-- Dan: Asta l-as scoate, folosim Eclipse, care nu iti adauga de doua ori un import, si nici nu foloseste * -->
79+
<!--
80+
<module name="RedundantImport" />
81+
<module name="AvoidStarImport" />
82+
>
83+
-->
84+
85+
<module name="UnusedImports" />
86+
87+
<!-- Dan: Peste 200 nu mai poti sa citesti nici chiar pe monitoarele noastre -->
88+
<module name="LineLength">
89+
<property name="max" value="200" />
90+
<property name="ignorePattern" value="^ *\* *@see.*$" />
91+
</module>
92+
93+
<!-- Dan: Iarasi metode f. lungi nu sunt ok, nu mai poti sa le urmaresti. -->
94+
<module name="MethodLength">
95+
<property name="tokens" value="METHOD_DEF" />
96+
<property name="max" value="300" />
97+
<property name="countEmpty" value="false" />
98+
</module>
99+
100+
<!-- Dan: Padding-uri diverse, se ocupa destul de ok Eclipse-ul. Nu are sens sa ingreunam procesul de verificare. -->
101+
<!--
102+
<module name="EmptyForIteratorPad" />
103+
<module name="MethodParamPad" />
104+
<module name="TypecastParenPad" />
105+
106+
<module name="OperatorWrap"/>
107+
<module name="ParenPad"/>
108+
<module name="NoWhitespaceAfter"/>
109+
<module name="NoWhitespaceBefore"/>
110+
<module name="WhitespaceAfter"/>
111+
<module name="WhitespaceAround"/>
112+
<module name="GenericWhitespace"/>
113+
-->
114+
115+
<!-- Dan: Poate crea confuzie, dar le folosim foarte rar. -->
116+
<module name="AvoidNestedBlocks"/>
117+
<!-- Dan: Nu conteaza,
118+
<module name="EmptyBlock">
119+
<property name="option" value="text" />
120+
</module>
121+
-->
122+
123+
<!-- Dan: Este ok. Cere ca paranteza sa fie la sf. linei dupa numele metodei sau dupa for. -->
124+
<module name="LeftCurly" />
125+
<!-- Dan: Este ok. Cere ca if si for sa aiba {} . -->
126+
<module name="NeedBraces" />
127+
<!-- Dan: Este ok. Verifica sa folosesi asa: } else { -->
128+
<module name="RightCurly">
129+
<property name="option" value="same" />
130+
</module>
131+
132+
<!-- Dan: Cred ca putem renunta la asta. -->
133+
<module name="EmptyStatement" />
134+
135+
<!-- Dan: Verifica sa folosesti "str".equals(var). Dar mi se pare peste mana, e greu de citit codul. -->
136+
<!--
137+
<module name="EqualsAvoidNull" />
138+
-->
139+
140+
141+
<module name="EqualsHashCode" />
142+
<module name="IllegalInstantiation" />
143+
<module name="InnerAssignment" />
144+
<module name="MagicNumber" />
145+
<module name="MissingSwitchDefault" />
146+
147+
<!-- Dan: Sunt check-uri slabe, gen: a||true, nu prea apar prin cod. -->
148+
<module name="SimplifyBooleanExpression" />
149+
150+
<!-- Dan: Asta se rezolva daca am putea verifica sa nu avem multe puncte de return. -->
151+
<!-- cum e mai jos.
152+
<module name="SimplifyBooleanReturn" />
153+
-->
154+
155+
<module name="ReturnCount">
156+
<property name="max" value="1"/>
157+
<property name="maxForVoid" value="1"/>
158+
</module>
159+
160+
<!-- Dan: Nu mi se pare important -->
161+
<!--
162+
<module name="ArrayTypeStyle" />
163+
-->
164+
165+
<!-- Dan: Este ok pt ca prinde cod incalcit. -->
166+
<module name="CyclomaticComplexity">
167+
<property name="max" value="15"/>
168+
<property name="switchBlockAsSingleDecisionPoint" value="true"/>
169+
<!-- Dan: Fara tokens insemana ca include tot ce are conditii (switch, case, for, while etc..) -->
170+
<property name="tokens" value="LITERAL_IF"/>
171+
</module>
172+
173+
<module name="TodoComment" />
174+
<module name="UpperEll" />
175+
</module>
176+
<!-- <module name="JavadocPackage"> <property name="allowLegacy" value="true"/>
177+
</module> -->
178+
<!-- Dan: we have huge files in eXml. -->
179+
<!--
180+
<module name="FileLength" />
181+
-->
182+
183+
</module>

src/main/java/com/oxygenxml/docbook/checker/ApplicationInteractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ public interface ApplicationInteractor {
1313
* Set the application when operation is in progress or not.
1414
* @param isInProgress <code>true</code> if the operation is in progress, <code>false</code>otherwise.
1515
*/
16-
public void setOperationInProgress(boolean isInProgress);
16+
void setOperationInProgress(boolean isInProgress);
1717

1818
/**
1919
* Get the frame of application.
2020
* @return The frame.
2121
*/
22-
public JFrame getApplicationFrame();
22+
JFrame getApplicationFrame();
2323

2424
}

src/main/java/com/oxygenxml/docbook/checker/ApplicationSourceDescription.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,18 @@ public class ApplicationSourceDescription {
1818
*
1919
*/
2020
public enum Source {
21-
CONTEXTUAL, TOOLBAR, PROJECT_MANAGER
21+
/**
22+
* From contextual menu.
23+
*/
24+
CONTEXTUAL,
25+
/**
26+
* From toolbar.
27+
*/
28+
TOOLBAR,
29+
/**
30+
* From contextual menu of project manager.
31+
*/
32+
PROJECT_MANAGER
2233
}
2334

2435
/**

0 commit comments

Comments
 (0)