Skip to content

Commit a38e4e9

Browse files
author
objectiser
committed
SCRIBBLE-118 Add support for checkstyle and fix all the reported issues
1 parent 9ee56d3 commit a38e4e9

243 files changed

Lines changed: 27586 additions & 25551 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>org.scribble</groupId>
5+
<artifactId>build</artifactId>
6+
<version>2.0.0-SNAPSHOT</version>
7+
<packaging>jar</packaging>
8+
<name>Scribble::Build</name>
9+
10+
<parent>
11+
<groupId>org.scribble</groupId>
12+
<artifactId>parent</artifactId>
13+
<version>2.0.0-SNAPSHOT</version>
14+
</parent>
15+
16+
<dependencies>
17+
</dependencies>
18+
</project>
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
4+
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
5+
6+
<!--
7+
8+
Checkstyle configuration that checks the sun coding conventions from:
9+
10+
- the Java Language Specification at
11+
http://java.sun.com/docs/books/jls/second_edition/html/index.html
12+
13+
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
14+
15+
- the Javadoc guidelines at
16+
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
17+
18+
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
19+
20+
- some best practices
21+
22+
Checkstyle is very configurable. Be sure to read the documentation at
23+
http://checkstyle.sf.net (or in your downloaded distribution).
24+
25+
Most Checks are configurable, be sure to consult the documentation.
26+
27+
To completely disable a check, just comment it out or delete it from the file.
28+
29+
Finally, it is worth reading the documentation.
30+
31+
-->
32+
33+
<module name="Checker">
34+
<!--
35+
If you set the basedir property below, then all reported file
36+
names will be relative to the specified directory. See
37+
http://checkstyle.sourceforge.net/5.x/config.html#Checker
38+
39+
<property name="basedir" value="${basedir}"/>
40+
-->
41+
42+
<!--
43+
<module name="SuppressionFilter">
44+
<property name="file" value="suppressions.xml"/>
45+
</module>
46+
-->
47+
48+
<!-- Checks that each Java package has a Javadoc file used for commenting. -->
49+
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage
50+
<module name="JavadocPackage">
51+
<property name="allowLegacy" value="true"/>
52+
</module>
53+
-->
54+
55+
<!-- Checks whether files end with a new line. -->
56+
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
57+
<module name="NewlineAtEndOfFile"/>
58+
59+
<!-- Checks that property files contain the same keys. -->
60+
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
61+
<module name="Translation"/>
62+
63+
<module name="FileLength"/>
64+
65+
<!-- Following interprets the header file as regular expressions. -->
66+
<!-- <module name="RegexpHeader"/> -->
67+
68+
<module name="FileTabCharacter">
69+
<property name="eachLine" value="true"/>
70+
</module>
71+
72+
<!-- \s matches whitespace character, $ matches end of line.
73+
<module name="RegexpSingleline">
74+
<property name="format" value="\s+$"/>
75+
<property name="message" value="Line has trailing spaces."/>
76+
</module>
77+
-->
78+
79+
<module name="TreeWalker">
80+
81+
<property name="cacheFile" value="${checkstyle.cache.file}"/>
82+
83+
<!-- Checks for Javadoc comments. -->
84+
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
85+
<module name="JavadocMethod">
86+
<property name="scope" value="public"/>
87+
</module>
88+
<module name="JavadocType">
89+
<property name="scope" value="public"/>
90+
</module>
91+
<module name="JavadocVariable">
92+
<property name="scope" value="public"/>
93+
</module>
94+
<module name="JavadocStyle">
95+
<property name="scope" value="public"/>
96+
<property name="checkHtml" value="false"/>
97+
</module>
98+
99+
100+
<!-- Checks for Naming Conventions. -->
101+
<!-- See http://checkstyle.sf.net/config_naming.html -->
102+
<module name="ConstantName"/>
103+
<module name="LocalFinalVariableName">
104+
<property name="format" value="^[a-z_][a-zA-Z0-9_]*$"/>
105+
</module>
106+
<module name="LocalVariableName">
107+
<property name="format" value="^[a-z_][a-zA-Z0-9_]*$"/>
108+
</module>
109+
<module name="MemberName">
110+
<property name="format" value="^_[a-z_][a-zA-Z0-9_]*$"/>
111+
</module>
112+
<module name="MethodName">
113+
<property name="format" value="^[a-z_][a-zA-Z0-9_]*$"/>
114+
</module>
115+
<module name="PackageName"/>
116+
<module name="ParameterName">
117+
<property name="format" value="^[a-z_][a-zA-Z0-9_]*$"/>
118+
</module>
119+
<module name="TypeName"/>
120+
121+
122+
<!-- Checks for Headers -->
123+
<!-- See http://checkstyle.sf.net/config_header.html -->
124+
<!-- <module name="Header"> -->
125+
<!-- The follow property value demonstrates the ability -->
126+
<!-- to have access to ANT properties. In this case it uses -->
127+
<!-- the ${basedir} property to allow Checkstyle to be run -->
128+
<!-- from any directory within a project. See property -->
129+
<!-- expansion, -->
130+
<!-- http://checkstyle.sf.net/config.html#properties -->
131+
<!-- <property -->
132+
<!-- name="headerFile" -->
133+
<!-- value="${basedir}/java.header"/> -->
134+
<!-- </module> -->
135+
136+
137+
<!-- Checks for imports -->
138+
<!-- See http://checkstyle.sf.net/config_import.html -->
139+
<module name="AvoidStarImport"/>
140+
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
141+
<module name="RedundantImport"/>
142+
<module name="UnusedImports"/>
143+
144+
145+
<!-- Checks for Size Violations. -->
146+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
147+
<!--<module name="LineLength"/>-->
148+
<module name="MethodLength"/>
149+
<module name="ParameterNumber"/>
150+
151+
152+
<!-- Checks for whitespace -->
153+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
154+
<module name="EmptyForIteratorPad"/>
155+
<module name="MethodParamPad"/>
156+
<module name="NoWhitespaceAfter"/>
157+
<module name="NoWhitespaceBefore"/>
158+
<module name="OperatorWrap"/>
159+
<module name="ParenPad"/>
160+
<!--<module name="TypecastParenPad"/>-->
161+
<module name="WhitespaceAfter">
162+
<property name="tokens" value="SEMI"/>
163+
</module>
164+
<module name="WhitespaceAround">
165+
<property name="allowEmptyConstructors" value="true"/>
166+
<property name="tokens" value="BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,COLON,DIV_ASSIGN,EQUAL,GE,LAND,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS_ASSIGN,QUESTION,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,TYPE_EXTENSION_AND"/>
167+
</module>
168+
169+
170+
<!-- Modifier Checks -->
171+
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
172+
<!--<module name="ModifierOrder"/>-->
173+
<!--<module name="RedundantModifier"/>-->
174+
175+
176+
<!-- Checks for blocks. You know, those {}'s -->
177+
<!-- See http://checkstyle.sf.net/config_blocks.html -->
178+
<module name="AvoidNestedBlocks"/>
179+
<module name="EmptyBlock"/>
180+
<module name="LeftCurly"/>
181+
<module name="NeedBraces"/>
182+
<module name="RightCurly"/>
183+
184+
185+
<!-- Checks for common coding problems -->
186+
<!-- See http://checkstyle.sf.net/config_coding.html -->
187+
<!--<module name="AvoidInlineConditionals"/>-->
188+
<module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
189+
<module name="EmptyStatement"/>
190+
<module name="EqualsHashCode"/>
191+
<module name="HiddenField"/>
192+
<module name="IllegalInstantiation"/>
193+
<module name="InnerAssignment"/>
194+
<!--<module name="MagicNumber"/>-->
195+
<!--<module name="MissingSwitchDefault"/>-->
196+
<!--<module name="RedundantThrows"/> -->
197+
<module name="SimplifyBooleanExpression"/>
198+
<module name="SimplifyBooleanReturn"/>
199+
200+
<!-- Checks for class design -->
201+
<!-- See http://checkstyle.sf.net/config_design.html -->
202+
<!--<module name="DesignForExtension"/>-->
203+
<module name="FinalClass"/>
204+
<module name="HideUtilityClassConstructor"/>
205+
<!--<module name="InterfaceIsType"/>-->
206+
<module name="VisibilityModifier"/>
207+
208+
209+
<!-- Miscellaneous other checks. -->
210+
<!-- See http://checkstyle.sf.net/config_misc.html -->
211+
<module name="ArrayTypeStyle"/>
212+
<!--<module name="FinalParameters"/>-->
213+
<!--<module name="TodoComment"/>-->
214+
<module name="UpperEll"/>
215+
216+
</module>
217+
218+
</module>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0"?>
2+
3+
<!DOCTYPE suppressions PUBLIC
4+
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
5+
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
6+
7+
<suppressions>
8+
9+
<suppress checks="[a-zA-Z0-9]*"
10+
files="org/scribble/protocol/monitor/model/Annotation.java"/>
11+
<suppress checks="[a-zA-Z0-9]*"
12+
files="org/scribble/protocol/monitor/model/Call.java"/>
13+
<suppress checks="[a-zA-Z0-9]*"
14+
files="org/scribble/protocol/monitor/model/Choice.java"/>
15+
<suppress checks="[a-zA-Z0-9]*"
16+
files="org/scribble/protocol/monitor/model/Decision.java"/>
17+
<suppress checks="[a-zA-Z0-9]*"
18+
files="org/scribble/protocol/monitor/model/Description.java"/>
19+
<suppress checks="[a-zA-Z0-9]*"
20+
files="org/scribble/protocol/monitor/model/Do.java"/>
21+
<suppress checks="[a-zA-Z0-9]*"
22+
files="org/scribble/protocol/monitor/model/MessageNode.java"/>
23+
<suppress checks="[a-zA-Z0-9]*"
24+
files="org/scribble/protocol/monitor/model/MessageType.java"/>
25+
<suppress checks="[a-zA-Z0-9]*"
26+
files="org/scribble/protocol/monitor/model/Node.java"/>
27+
<suppress checks="[a-zA-Z0-9]*"
28+
files="org/scribble/protocol/monitor/model/package-info.java"/>
29+
<suppress checks="[a-zA-Z0-9]*"
30+
files="org/scribble/protocol/monitor/model/ObjectFactory.java"/>
31+
<suppress checks="[a-zA-Z0-9]*"
32+
files="org/scribble/protocol/monitor/model/Parallel.java"/>
33+
<suppress checks="[a-zA-Z0-9]*"
34+
files="org/scribble/protocol/monitor/model/Path.java"/>
35+
<suppress checks="[a-zA-Z0-9]*"
36+
files="org/scribble/protocol/monitor/model/ReceiveMessage.java"/>
37+
<suppress checks="[a-zA-Z0-9]*"
38+
files="org/scribble/protocol/monitor/model/Scope.java"/>
39+
<suppress checks="[a-zA-Z0-9]*"
40+
files="org/scribble/protocol/monitor/model/SendMessage.java"/>
41+
42+
</suppressions>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<FindBugsFilter>
2+
<!-- InputStreamGraph uses this without side effects -->
3+
<Match>
4+
<Class name="org.switchyard.internal.io.graph.InputStreamGraph" />
5+
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2" />
6+
</Match>
7+
</FindBugsFilter>

bundles/org.scribble.command/src/main/java/org/scribble/command/Command.java

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,33 @@
1616
*/
1717
package org.scribble.command;
1818

19+
/**
20+
* This interface represents a command.
21+
*
22+
*/
1923
public interface Command {
2024

21-
public String getName();
22-
23-
public String getDescription();
24-
25-
public boolean execute(String args[]);
26-
27-
}
25+
/**
26+
* This method returns the name of the command.
27+
*
28+
* @return The name
29+
*/
30+
public String getName();
31+
32+
/**
33+
* This method returns the description.
34+
*
35+
* @return The description
36+
*/
37+
public String getDescription();
38+
39+
/**
40+
* This method executes the command with the
41+
* given arguments.
42+
*
43+
* @param args The arguments
44+
* @return Whether the command executed
45+
*/
46+
public boolean execute(String[] args);
47+
48+
}

0 commit comments

Comments
 (0)