Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-13411

Checkstyle suppression by annotation or comment

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha2
    • Fix Version/s: 2.9.0, 3.0.0-alpha2
    • Component/s: None
    • Labels:
      None

      Description

      Suppress checkstyle audit events in a method or a section of code by annotation or comment. This can be achieved by checkstyle module SuppressWarningsFilter, SuppressionCommentFilter, and SuppressWithNearbyCommentFilter.

      Examples:

        @SuppressWarnings("checkstyle:parameternumber")
        // More than 7 parameters
        public Response putRoot(p1, p2, p3, p4, p5, p6, p7, p8)  {
          ...
        }
      
        // CHECKSTYLE:OFF:ParameterNumber
        // More than 7 parameters
        private Response put(p1, p2, p3, p4, p5, p6, p7, p8)  {
          ...
        }
        // CHECKSTYLE:ON:ParameterNumber
      
      private int [] array; // SUPPRESS CHECKSTYLE
      

        Activity

        Hide
        asuresh Arun Suresh added a comment -

        Big +1 to the proposal

        Show
        asuresh Arun Suresh added a comment - Big +1 to the proposal
        Hide
        jzhuge John Zhuge added a comment -

        Patch 001

        • Add checkstyle module SuppressWarningsFilter, SuppressionCommentFilter, and SuppressWithNearbyCommentFilter to checkstyle.xml

        If you'd like to test the patch, apply the patch, then run mvn install in directory hadoop-build-tools first before running any mvn checkstyle:checkstyle.

        Show
        jzhuge John Zhuge added a comment - Patch 001 Add checkstyle module SuppressWarningsFilter , SuppressionCommentFilter , and SuppressWithNearbyCommentFilter to checkstyle.xml If you'd like to test the patch, apply the patch, then run mvn install in directory hadoop-build-tools first before running any mvn checkstyle:checkstyle .
        Hide
        hadoopqa Hadoop QA added a comment -
        -1 overall



        Vote Subsystem Runtime Comment
        0 reexec 0m 16s Docker mode activated.
        +1 @author 0m 0s The patch does not contain any @author tags.
        -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
        +1 mvninstall 7m 1s trunk passed
        +1 compile 0m 8s trunk passed
        +1 mvnsite 0m 9s trunk passed
        +1 mvneclipse 0m 9s trunk passed
        +1 javadoc 0m 12s trunk passed
        +1 mvninstall 0m 7s the patch passed
        +1 compile 0m 6s the patch passed
        +1 javac 0m 6s the patch passed
        +1 mvnsite 0m 6s the patch passed
        +1 mvneclipse 0m 6s the patch passed
        +1 whitespace 0m 0s The patch has no whitespace issues.
        +1 xml 0m 1s The patch has no ill-formed XML file.
        +1 javadoc 0m 6s the patch passed
        +1 unit 0m 7s hadoop-build-tools in the patch passed.
        -1 asflicense 0m 15s The patch generated 2 ASF License warnings.
        9m 23s



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:9560f25
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12819818/HADOOP-13411.001.patch
        JIRA Issue HADOOP-13411
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit xml
        uname Linux 61f05c30ec8a 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
        Build tool maven
        Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
        git revision trunk / 7052ca8
        Default Java 1.8.0_91
        Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10070/testReport/
        asflicense https://builds.apache.org/job/PreCommit-HADOOP-Build/10070/artifact/patchprocess/patch-asflicense-problems.txt
        modules C: hadoop-build-tools U: hadoop-build-tools
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10070/console
        Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 16s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. -1 test4tests 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 mvninstall 7m 1s trunk passed +1 compile 0m 8s trunk passed +1 mvnsite 0m 9s trunk passed +1 mvneclipse 0m 9s trunk passed +1 javadoc 0m 12s trunk passed +1 mvninstall 0m 7s the patch passed +1 compile 0m 6s the patch passed +1 javac 0m 6s the patch passed +1 mvnsite 0m 6s the patch passed +1 mvneclipse 0m 6s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. +1 xml 0m 1s The patch has no ill-formed XML file. +1 javadoc 0m 6s the patch passed +1 unit 0m 7s hadoop-build-tools in the patch passed. -1 asflicense 0m 15s The patch generated 2 ASF License warnings. 9m 23s Subsystem Report/Notes Docker Image:yetus/hadoop:9560f25 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12819818/HADOOP-13411.001.patch JIRA Issue HADOOP-13411 Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit xml uname Linux 61f05c30ec8a 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 7052ca8 Default Java 1.8.0_91 Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/10070/testReport/ asflicense https://builds.apache.org/job/PreCommit-HADOOP-Build/10070/artifact/patchprocess/patch-asflicense-problems.txt modules C: hadoop-build-tools U: hadoop-build-tools Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/10070/console Powered by Apache Yetus 0.4.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
        Hide
        jojochuang Wei-Chiu Chuang added a comment -

        +1. The asflicense warning is due to a generated file. Will commit soon.

        Show
        jojochuang Wei-Chiu Chuang added a comment - +1. The asflicense warning is due to a generated file. Will commit soon.
        Hide
        jojochuang Wei-Chiu Chuang added a comment -

        Committed it to trunk and branch-2. Thanks John Zhuge for contributing the patch and Arun Suresh for the comment!

        Show
        jojochuang Wei-Chiu Chuang added a comment - Committed it to trunk and branch-2. Thanks John Zhuge for contributing the patch and Arun Suresh for the comment!
        Hide
        jzhuge John Zhuge added a comment -

        Thanks Wei-Chiu Chuang for the review and commit, Arun Suresh for the encouragement.

        Show
        jzhuge John Zhuge added a comment - Thanks Wei-Chiu Chuang for the review and commit, Arun Suresh for the encouragement.
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10448 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10448/)
        HADOOP-13411. Checkstyle suppression by annotation or comment. (weichiu: rev 0e68e14d5506288bbda02cfc755babf1e9875187)

        • (edit) hadoop-build-tools/src/main/resources/checkstyle/checkstyle.xml
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #10448 (See https://builds.apache.org/job/Hadoop-trunk-Commit/10448/ ) HADOOP-13411 . Checkstyle suppression by annotation or comment. (weichiu: rev 0e68e14d5506288bbda02cfc755babf1e9875187) (edit) hadoop-build-tools/src/main/resources/checkstyle/checkstyle.xml

          People

          • Assignee:
            jzhuge John Zhuge
            Reporter:
            jzhuge John Zhuge
          • Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development