This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-net.git


The following commit(s) were added to refs/heads/master by this push:
     new da464b82 Add Checkstyle rules
da464b82 is described below

commit da464b82717f53e87d5017941041f3e9242767e8
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat May 4 15:50:47 2024 -0400

    Add Checkstyle rules
---
 src/conf/checkstyle.xml                                | 18 +++---------------
 .../commons/net/examples/mail/IMAPExportMbox.java      |  2 +-
 .../org/apache/commons/net/examples/unix/rexec.java    |  3 ++-
 .../org/apache/commons/net/examples/unix/rlogin.java   |  3 ++-
 .../org/apache/commons/net/examples/unix/rshell.java   |  3 ++-
 .../apache/commons/net/ftp/parser/MLSxEntryParser.java |  2 +-
 .../commons/net/ftp/parser/MVSFTPEntryParser.java      |  2 +-
 7 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index c3e02933..407714a9 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -19,20 +19,16 @@ 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">
@@ -40,18 +36,15 @@ limitations under the License.
     <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"/>
@@ -59,13 +52,10 @@ limitations under the License.
     <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"/-->
@@ -73,14 +63,11 @@ limitations under the License.
       <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
@@ -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"/>
diff --git 
a/src/main/java/org/apache/commons/net/examples/mail/IMAPExportMbox.java 
b/src/main/java/org/apache/commons/net/examples/mail/IMAPExportMbox.java
index fa54cf56..18cfa9cc 100644
--- a/src/main/java/org/apache/commons/net/examples/mail/IMAPExportMbox.java
+++ b/src/main/java/org/apache/commons/net/examples/mail/IMAPExportMbox.java
@@ -129,7 +129,7 @@ public final class IMAPExportMbox {
                 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(">")) {
diff --git a/src/main/java/org/apache/commons/net/examples/unix/rexec.java 
b/src/main/java/org/apache/commons/net/examples/unix/rexec.java
index ec159054..602887da 100644
--- a/src/main/java/org/apache/commons/net/examples/unix/rexec.java
+++ b/src/main/java/org/apache/commons/net/examples/unix/rexec.java
@@ -63,7 +63,8 @@ public final class rexec {
             try {
                 client.disconnect();
             } catch (final IOException f) {
-                /* ignored */}
+                /* ignored */
+            }
             e.printStackTrace();
             System.err.println("Could not execute command.");
             System.exit(1);
diff --git a/src/main/java/org/apache/commons/net/examples/unix/rlogin.java 
b/src/main/java/org/apache/commons/net/examples/unix/rlogin.java
index 4293cc6d..83a6aa18 100644
--- a/src/main/java/org/apache/commons/net/examples/unix/rlogin.java
+++ b/src/main/java/org/apache/commons/net/examples/unix/rlogin.java
@@ -70,7 +70,8 @@ public final class rlogin {
             try {
                 client.disconnect();
             } catch (final IOException f) {
-                /* ignored */}
+                /* ignored */
+            }
             e.printStackTrace();
             System.err.println("rlogin authentication failed.");
             System.exit(1);
diff --git a/src/main/java/org/apache/commons/net/examples/unix/rshell.java 
b/src/main/java/org/apache/commons/net/examples/unix/rshell.java
index 0ed9fb49..462ce6ed 100644
--- a/src/main/java/org/apache/commons/net/examples/unix/rshell.java
+++ b/src/main/java/org/apache/commons/net/examples/unix/rshell.java
@@ -65,7 +65,8 @@ public final class rshell {
             try {
                 client.disconnect();
             } catch (final IOException f) {
-                /* ignored */}
+                /* ignored */
+            }
             e.printStackTrace();
             System.err.println("Could not execute command.");
             System.exit(1);
diff --git 
a/src/main/java/org/apache/commons/net/ftp/parser/MLSxEntryParser.java 
b/src/main/java/org/apache/commons/net/ftp/parser/MLSxEntryParser.java
index 0687b5ff..73a51c27 100644
--- a/src/main/java/org/apache/commons/net/ftp/parser/MLSxEntryParser.java
+++ b/src/main/java/org/apache/commons/net/ftp/parser/MLSxEntryParser.java
@@ -184,7 +184,7 @@ public class MLSxEntryParser extends FTPFileEntryParserImpl 
{
 
     @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);
diff --git 
a/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java 
b/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java
index fc2bdb56..e0ec87ff 100644
--- a/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java
+++ b/src/main/java/org/apache/commons/net/ftp/parser/MVSFTPEntryParser.java
@@ -462,7 +462,7 @@ public class MVSFTPEntryParser extends 
ConfigurableFTPFileEntryParserImpl {
             } 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 {

Reply via email to