Skip to content

Commit 147df44

Browse files
committed
Style update
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/branches/cli-1.x@680644 13f79535-47bb-0310-9956-ffa450edef68
1 parent 73b2b5b commit 147df44

25 files changed

Lines changed: 623 additions & 481 deletions

pom.xml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,16 @@
129129
</dependencies>
130130

131131
<properties>
132+
<maven.compile.source>1.3</maven.compile.source>
133+
<maven.compile.target>1.3</maven.compile.target>
132134
<commons.componentid>cli</commons.componentid>
135+
<commons.release.version>1.2</commons.release.version>
136+
<commons.release.name>commons-configuration-${commons.release.version}</commons.release.name>
133137
<commons.osgi.symbolicName>org.apache.commons.cli</commons.osgi.symbolicName>
134-
<commons.release.version>1.1</commons.release.version>
135138
<commons.binary.suffix></commons.binary.suffix>
136139
<commons.jira.id>CLI</commons.jira.id>
137140
<commons.jira.pid>12310463</commons.jira.pid>
138-
</properties>
141+
</properties>
139142

140143
<build>
141144
<sourceDirectory>src/java</sourceDirectory>
@@ -185,6 +188,17 @@
185188
<effort>Default</effort>
186189
</configuration>
187190
</plugin>
191+
<plugin>
192+
<groupId>org.apache.maven.plugins</groupId>
193+
<artifactId>maven-checkstyle-plugin</artifactId>
194+
<configuration>
195+
<configLocation>src/conf/checkstyle.xml</configLocation>
196+
</configuration>
197+
</plugin>
198+
<plugin>
199+
<groupId>org.apache.maven.plugins</groupId>
200+
<artifactId>maven-pmd-plugin</artifactId>
201+
</plugin>
188202
<plugin>
189203
<groupId>org.codehaus.mojo</groupId>
190204
<artifactId>cobertura-maven-plugin</artifactId>

src/conf/HEADER.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/

src/conf/checkstyle.xml

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Puppy Crawl//DTD Check Configuration 1.1//EN"
4+
"http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
5+
6+
<!-- Checkstyle configuration that checks the commons-configuration coding conventions -->
7+
8+
<module name="Checker">
9+
<property name="localeLanguage" value="en"/>
10+
11+
<!-- Checks that a package.html file exists for each package. -->
12+
<!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
13+
<module name="PackageHtml"/>
14+
15+
<!-- Checks whether files end with a new line. -->
16+
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
17+
<module name="NewlineAtEndOfFile"/>
18+
19+
<!-- Checks that property files contain the same keys. -->
20+
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
21+
<module name="Translation"/>
22+
23+
<!-- Exceptions -->
24+
<!--
25+
<module name="SuppressionFilter">
26+
<property name="file" value="conf/checkstyle-suppressions.xml"/>
27+
</module>
28+
-->
29+
30+
<module name="TreeWalker">
31+
32+
<property name="cacheFile" value="${checkstyle.cache.file}"/>
33+
34+
<!-- Checks for Javadoc comments. -->
35+
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
36+
<module name="JavadocMethod">
37+
<property name="scope" value="public"/>
38+
<property name="allowUndeclaredRTE" value="true"/>
39+
<property name="allowMissingJavadoc" value="true"/>
40+
</module>
41+
<module name="JavadocType">
42+
<property name="authorFormat" value="\S"/>
43+
</module>
44+
<module name="JavadocVariable"/>
45+
46+
47+
<!-- Checks for Naming Conventions. -->
48+
<!-- See http://checkstyle.sf.net/config_naming.html -->
49+
<module name="ConstantName"/>
50+
<module name="LocalFinalVariableName"/>
51+
<module name="LocalVariableName"/>
52+
<module name="MemberName"/>
53+
<module name="MethodName"/>
54+
<module name="PackageName"/>
55+
<module name="ParameterName"/>
56+
<module name="StaticVariableName"/>
57+
<module name="TypeName"/>
58+
59+
60+
<!-- Checks for Headers -->
61+
<!-- See http://checkstyle.sf.net/config_header.html -->
62+
<module name="Header">
63+
<property name="headerFile" value="src/conf/HEADER.txt"/>
64+
</module>
65+
66+
<!-- Following interprets the header file as regular expressions. -->
67+
<!-- <module name="RegexpHeader"/> -->
68+
69+
70+
<!-- Checks for imports -->
71+
<!-- See http://checkstyle.sf.net/config_import.html -->
72+
<module name="AvoidStarImport"/>
73+
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
74+
<module name="RedundantImport"/>
75+
<module name="UnusedImports"/>
76+
77+
78+
<!-- Checks for Size Violations. -->
79+
<!-- See http://checkstyle.sf.net/config_sizes.html -->
80+
<!--<module name="FileLength"/>-->
81+
<module name="LineLength">
82+
<property name="max" value="120"/>
83+
</module>
84+
<module name="MethodLength"/>
85+
<module name="ParameterNumber"/>
86+
87+
88+
<!-- Checks for whitespace -->
89+
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
90+
<module name="EmptyForIteratorPad"/>
91+
<module name="NoWhitespaceAfter"/>
92+
<module name="NoWhitespaceBefore"/>
93+
<module name="OperatorWrap"/>
94+
<module name="ParenPad"/>
95+
<module name="TabCharacter"/>
96+
<module name="WhitespaceAfter"/>
97+
<module name="WhitespaceAround">
98+
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/>
99+
</module>
100+
101+
102+
103+
<!-- Modifier Checks -->
104+
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
105+
<module name="ModifierOrder"/>
106+
<module name="RedundantModifier"/>
107+
108+
109+
<!-- Checks for blocks. You know, those {}'s -->
110+
<!-- See http://checkstyle.sf.net/config_blocks.html -->
111+
<module name="AvoidNestedBlocks"/>
112+
<module name="EmptyBlock"/>
113+
<module name="LeftCurly">
114+
<property name="option" value="nl"/>
115+
</module>
116+
<module name="NeedBraces"/>
117+
<module name="RightCurly">
118+
<property name="option" value="alone"/>
119+
</module>
120+
121+
122+
<!-- Checks for common coding problems -->
123+
<!-- See http://checkstyle.sf.net/config_coding.html -->
124+
<module name="CovariantEquals"/>
125+
<module name="DoubleCheckedLocking"/>
126+
<module name="EqualsHashCode"/>
127+
<module name="IllegalInstantiation"/>
128+
<module name="InnerAssignment"/>
129+
<module name="MagicNumber">
130+
<property name="ignoreNumbers" value="-1,0,1,2,3"/>
131+
</module>
132+
<module name="RedundantThrows">
133+
<property name="allowUnchecked" value="true"/>
134+
</module>
135+
<module name="SimplifyBooleanExpression"/>
136+
<module name="SimplifyBooleanReturn"/>
137+
<module name="StringLiteralEquality"/>
138+
<module name="SuperClone"/>
139+
<module name="SuperFinalize"/>
140+
<module name="DeclarationOrder"/>
141+
<module name="ExplicitInitialization"/>
142+
<module name="DefaultComesLast"/>
143+
<module name="FallThrough"/>
144+
<module name="MultipleVariableDeclarations"/>
145+
<module name="UnnecessaryParentheses"/>
146+
147+
<!-- Checks for class design -->
148+
<!-- See http://checkstyle.sf.net/config_design.html -->
149+
<module name="FinalClass"/>
150+
<module name="HideUtilityClassConstructor"/>
151+
<module name="InterfaceIsType"/>
152+
<module name="VisibilityModifier">
153+
<property name="protectedAllowed" value="true"/>
154+
</module>
155+
156+
157+
158+
<!-- Miscellaneous other checks. -->
159+
<!-- See http://checkstyle.sf.net/config_misc.html -->
160+
<module name="ArrayTypeStyle"/>
161+
<!--
162+
<module name="GenericIllegalRegexp">
163+
<property name="format" value="\s+$"/>
164+
<property name="message" value="Line has trailing spaces."/>
165+
</module>
166+
-->
167+
<module name="TodoComment"/>
168+
<module name="UpperEll"/>
169+
170+
</module>
171+
172+
</module>

src/java/org/apache/commons/cli/AlreadySelectedException.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
* has been provided.
2323
*
2424
* @author John Keyes ( john at integralsource.com )
25-
* @see ParseException
25+
* @version $Revision$, $Date$
2626
*/
2727
public class AlreadySelectedException extends ParseException
2828
{
@@ -53,15 +53,16 @@ public AlreadySelectedException(String message)
5353
*/
5454
public AlreadySelectedException(OptionGroup group, Option option)
5555
{
56-
this("The option '" + option.getKey() + "' was specified but an option from this group " +
57-
"has already been selected: '" + group.getSelected() + "'");
56+
this("The option '" + option.getKey() + "' was specified but an option from this group "
57+
+ "has already been selected: '" + group.getSelected() + "'");
5858
this.group = group;
5959
this.option = option;
6060
}
6161

6262
/**
6363
* Returns the option group where another option has been selected.
6464
*
65+
* @return the related option group
6566
* @since 1.2
6667
*/
6768
public OptionGroup getOptionGroup()
@@ -72,6 +73,7 @@ public OptionGroup getOptionGroup()
7273
/**
7374
* Returns the option that was added to the group and triggered the exception.
7475
*
76+
* @return the related option
7577
* @since 1.2
7678
*/
7779
public Option getOption()

src/java/org/apache/commons/cli/BasicParser.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
1718
package org.apache.commons.cli;
1819

1920
/**
2021
* The class BasicParser provides a very simple implementation of
2122
* the {@link Parser#flatten(Options,String[],boolean) flatten} method.
2223
*
2324
* @author John Keyes (john at integralsource.com)
24-
* @see Parser
25+
* @version $Revision$, $Date$
2526
*/
26-
public class BasicParser extends Parser {
27-
27+
public class BasicParser extends Parser
28+
{
2829
/**
2930
* <p>A simple implementation of {@link Parser}'s abstract
30-
* {@link Parser#flatten(Options,String[],boolean) flatten} method.</p>
31+
* {@link Parser#flatten(Options, String[], boolean) flatten} method.</p>
3132
*
3233
* <p><b>Note:</b> <code>options</code> and <code>stopAtNonOption</code>
3334
* are not used in this <code>flatten</code> method.</p>
@@ -38,10 +39,9 @@ public class BasicParser extends Parser {
3839
* when an non option is found.
3940
* @return The <code>arguments</code> String array.
4041
*/
41-
protected String[] flatten(Options options, String[] arguments,
42-
boolean stopAtNonOption)
42+
protected String[] flatten(Options options, String[] arguments, boolean stopAtNonOption)
4343
{
4444
// just echo the arguments
4545
return arguments;
4646
}
47-
}
47+
}

0 commit comments

Comments
 (0)