Skip to content

Commit

Permalink
Add Checkstyle rules
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed May 4, 2024
1 parent febb621 commit da464b8
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 21 deletions.
18 changes: 3 additions & 15 deletions src/conf/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,68 +19,55 @@ limitations under the License.
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!-- Commons Net customization of default Checkstyle behavior -->
<module name="Checker">

<property name="localeLanguage" value="en"/>
<module name="JavadocPackage">
<!-- setting allowLegacy means it will check for package.html instead of just package-info.java -->
<property name="allowLegacy" value="true"/>
</module>

<module name="FileTabCharacter">
<property name="fileExtensions" value="java,xml"/>
</module>

<!-- Checks for white space at the end of the line -->
<!-- See http://checkstyle.sourceforge.net/config_regexp.html -->
<module name="RegexpSingleline">
<property name="format" value="\s+$" />
<property name="message" value="Line has trailing spaces." />
<property name="fileExtensions" value="java" />
</module>

<!-- @author tags are deprecated -->
<module name="RegexpSingleline">
<property name="format" value="^\s+\*\s+@author\s" />
<property name="message" value="Deprecated @author tag" />
<property name="fileExtensions" value="java" />
</module>

<module name="LineLength">
<property name="max" value="160"/>
</module>

<module name="TreeWalker">
<module name="AvoidStarImport">
<property name="excludes" value="org.junit.Assert"/>
</module>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<module name="NeedBraces"/>

<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>

<!--module name="RedundantModifier"/-->

<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<!--module name="AvoidNestedBlocks"/-->
<module name="EmptyBlock">
<property name="option" value="text"/>
</module>
<module name="EmptyCatchBlock"></module>

<module name="JavadocMethod">
<property name="accessModifiers" value="public"/>
<property name="allowMissingParamTags" value="true"/>
</module>

<module name="SuppressionCommentFilter"/>

<!--
Allow comment to suppress checkstyle for a single line
e.g. // CHECKSTYLE IGNORE MagicNumber
Expand All @@ -95,9 +82,10 @@ limitations under the License.
<property name="ordered" value="true"/>
<property name="separated" value="true"/>
</module>

<module name="WhitespaceAfter" />
<module name="WhitespaceAround" />
<module name="WhitespaceAroundCheck" />
</module>

<module name="SuppressionFilter">
<!-- config_loc is used by Eclipse plugin -->
<property name="file" value="${config_loc}/checkstyle-suppressions.xml"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public boolean chunkReceived(final IMAP imap) {
final String line = replyStrings[i];
if (line.startsWith("Return-Path: ")) {
final String[] parts = line.split(" ", 2);
if (!parts[1].equals("<>")) {// Don't replace default with blank
if (!parts[1].equals("<>")) { // Don't replace default with blank
replyTo = parts[1];
if (replyTo.startsWith("<")) {
if (replyTo.endsWith(">")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public static void main(final String[] args) {
try {
client.disconnect();
} catch (final IOException f) {
/* ignored */}
/* ignored */
}
e.printStackTrace();
System.err.println("Could not execute command.");
System.exit(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public static void main(final String[] args) {
try {
client.disconnect();
} catch (final IOException f) {
/* ignored */}
/* ignored */
}
e.printStackTrace();
System.err.println("rlogin authentication failed.");
System.exit(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public static void main(final String[] args) {
try {
client.disconnect();
} catch (final IOException f) {
/* ignored */}
/* ignored */
}
e.printStackTrace();
System.err.println("Could not execute command.");
System.exit(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private void doUnixPerms(final FTPFile file, final String valueLowerCase) {

@Override
public FTPFile parseFTPEntry(final String entry) {
if (entry.startsWith(" ")) {// leading space means no facts are present
if (entry.startsWith(" ")) { // leading space means no facts are present
if (entry.length() > 1) { // is there a path name?
final FTPFile file = new FTPFile();
file.setRawListing(entry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ public List<String> preParse(final List<String> orig) {
} else if (header.indexOf("Spool Files") >= 30) {
setType(JES_LEVEL_1_LIST_TYPE);
super.setRegex(JES_LEVEL_1_LIST_REGEX);
} else if (header.startsWith("JOBNAME") && header.indexOf("JOBID") > 8) {// header contains JOBNAME JOBID OWNER // STATUS CLASS
} else if (header.startsWith("JOBNAME") && header.indexOf("JOBID") > 8) { // header contains JOBNAME JOBID OWNER // STATUS CLASS
setType(JES_LEVEL_2_LIST_TYPE);
super.setRegex(JES_LEVEL_2_LIST_REGEX);
} else {
Expand Down

0 comments on commit da464b8

Please sign in to comment.