Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-23185

Setting build status to FAILURE for new error when errors were fixed

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • cppcheck-plugin
    • None

      It seems the functionality to mark builds as failed for "new errors" uses the total number of errors in the new result data, rather than the delta of errors.
      Currently, if one of two errors is fixed, the build will be marked as failed with a new error threshold of 1.

      Noticed with new error threshold of 1,
      having 6 errors,
      then checking in a new build with the result of 4 errors and 26 style warnings.
      > [Cppcheck] Setting build status to FAILURE since total number of new errors exceeds the threshold value '1'.

      Jenkins 1.554.1, CPPCheck plugin 1.16

          [JENKINS-23185] Setting build status to FAILURE for new error when errors were fixed

          Michal Turek added a comment -

          Hi Jan,

          I think, the description of the configuration fields is little misleading, which probably confused you. It uses word "errors" in meaning of "whatever type of issue". Cppcheck tool reports "errors" (of several types/severities) instead of "issues" or "violations", please check its manual. So, if I understand your description correctly...

          • "1" is configured for "New" threshold to fail the build (red circle).
          • Build N had 6 errors in total.
          • Build N+1 had 4 errors and 26 warnings in total.
          • 26 + 4 = 30 and 30 - 6 > 1, so the build was marked as failed, which is fully correct.

          I have never used this part of the plugin and I don't know the relevant code much. Did I miss something? If everything I wrote above is correct, do you think I should update the labels and tool tips in the configuration page? The current state is fully OK for me, I'm quite familiar with Cppcheck and the plugin. But new users can have troubles with that. What do you think?

          Thanks,
          Michal

          Michal Turek added a comment - Hi Jan, I think, the description of the configuration fields is little misleading, which probably confused you. It uses word "errors" in meaning of "whatever type of issue". Cppcheck tool reports "errors" (of several types/severities) instead of "issues" or "violations", please check its manual. So, if I understand your description correctly... "1" is configured for "New" threshold to fail the build (red circle). Build N had 6 errors in total. Build N+1 had 4 errors and 26 warnings in total. 26 + 4 = 30 and 30 - 6 > 1, so the build was marked as failed, which is fully correct. I have never used this part of the plugin and I don't know the relevant code much. Did I miss something? If everything I wrote above is correct, do you think I should update the labels and tool tips in the configuration page? The current state is fully OK for me, I'm quite familiar with Cppcheck and the plugin. But new users can have troubles with that. What do you think? Thanks, Michal

          Jan Klass added a comment -

          Thank you for coming back to me, with an explanation to the issue.

          You understood my issue correctly, except the 26 warnings are style warnings. I do not know which manual you are referring to!?

          As CPPCheck has error/issue levels with one level being error, I would definitely name it “issue” there/in the tooltip. I am not sure how consitent CPPCheck itself is in this respect, but it should definitely conciously use this distinction itself (code/documentation/CPPCheck GUI).

          Given your description, I would expect all levels (Error, Warning, Style, Performance, Portability, Information, No category) to effect this then.

          In the previously described situiation, the jobs severity evaluation has marked: Error, Warning, Style, Performance and Information.

          I guess the settings “Severity evaluation” applies only to “Build status” then? Personally, I would expect the severity evaluation settings to be under the label Build status as well then. Not sure if Jenkins has a different guideline on this!?

          In another job and build, I got:
          Error 2
          Warning 677 +1
          Style 3172
          Performance 672
          Portability 22
          Information 2123
          No category 0

          Hence, one new Warning (only).

          The Job is configured with (red bubble) New = 1 as well, and has the severity evaluation marked: Error, Warning

          Given your description, I would expect the build to have been marked as a failure. It did not though. Is there an issue with evaluating Warning-level cppcheck “errors”/issues here? Or is this a misconception again?

          Jan Klass added a comment - Thank you for coming back to me, with an explanation to the issue. You understood my issue correctly, except the 26 warnings are style warnings. I do not know which manual you are referring to!? As CPPCheck has error/issue levels with one level being error, I would definitely name it “issue” there/in the tooltip. I am not sure how consitent CPPCheck itself is in this respect, but it should definitely conciously use this distinction itself (code/documentation/CPPCheck GUI). Given your description, I would expect all levels (Error, Warning, Style, Performance, Portability, Information, No category) to effect this then. In the previously described situiation, the jobs severity evaluation has marked: Error, Warning, Style, Performance and Information. I guess the settings “Severity evaluation” applies only to “Build status” then? Personally, I would expect the severity evaluation settings to be under the label Build status as well then. Not sure if Jenkins has a different guideline on this!? In another job and build, I got: Error 2 Warning 677 +1 Style 3172 Performance 672 Portability 22 Information 2123 No category 0 Hence, one new Warning (only). The Job is configured with (red bubble) New = 1 as well, and has the severity evaluation marked: Error, Warning Given your description, I would expect the build to have been marked as a failure. It did not though. Is there an issue with evaluating Warning-level cppcheck “errors”/issues here? Or is this a misconception again?

          Michal Turek added a comment -

          I will try to simulate the issue and debug the code...

          Michal Turek added a comment - I will try to simulate the issue and debug the code...

          Michal Turek added a comment -

          I was referring to cppcheck manual page, e.g. http://linux.die.net/man/1/cppcheck, but it is not important now. I have updated the GUI under JENKINS-23891, it uses word "issue" instead of "error" now.

          Michal Turek added a comment - I was referring to cppcheck manual page, e.g. http://linux.die.net/man/1/cppcheck , but it is not important now. I have updated the GUI under JENKINS-23891 , it uses word "issue" instead of "error" now.

          Code changed in jenkins
          User: Michal Turek
          Path:
          src/main/java/org/jenkinsci/plugins/cppcheck/util/CppcheckBuildResultEvaluator.java
          http://jenkins-ci.org/commit/cppcheck-plugin/cb4e2040c7a92ac16f8fca293d8e19f313b96fcc
          Log:
          JENKINS-23185 Setting build status to FAILURE for new error when errors were fixed

          • CppcheckBuildResultEvaluator.isErrorCountExceeded() used comparison count > threshold but users expect count >= threshold.
          • For example the threshold had to be set to 0 to change build status on 1 new issue. Setting 1 in threshold configuration to detect 1 issue is much better.
          • Information in build log extended to contain also the value that exceeded the threshold. Word "errors" replaced by "issues".

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Michal Turek Path: src/main/java/org/jenkinsci/plugins/cppcheck/util/CppcheckBuildResultEvaluator.java http://jenkins-ci.org/commit/cppcheck-plugin/cb4e2040c7a92ac16f8fca293d8e19f313b96fcc Log: JENKINS-23185 Setting build status to FAILURE for new error when errors were fixed CppcheckBuildResultEvaluator.isErrorCountExceeded() used comparison count > threshold but users expect count >= threshold. For example the threshold had to be set to 0 to change build status on 1 new issue. Setting 1 in threshold configuration to detect 1 issue is much better. Information in build log extended to contain also the value that exceeded the threshold. Word "errors" replaced by "issues".

          Code changed in jenkins
          User: Michal Turek
          Path:
          src/main/java/org/jenkinsci/plugins/cppcheck/util/CppcheckBuildResultEvaluator.java
          http://jenkins-ci.org/commit/cppcheck-plugin/87401a045be16953d82178c189ddff52d5154407
          Log:
          Merge pull request #20 from mixalturek/master

          JENKINS-23185 Setting build status to FAILURE for new error when error...

          Compare: https://github.com/jenkinsci/cppcheck-plugin/compare/a49002550cbd...87401a045be1

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Michal Turek Path: src/main/java/org/jenkinsci/plugins/cppcheck/util/CppcheckBuildResultEvaluator.java http://jenkins-ci.org/commit/cppcheck-plugin/87401a045be16953d82178c189ddff52d5154407 Log: Merge pull request #20 from mixalturek/master JENKINS-23185 Setting build status to FAILURE for new error when error... Compare: https://github.com/jenkinsci/cppcheck-plugin/compare/a49002550cbd...87401a045be1

          Michal Turek added a comment -

          Fixed, will be released in version 1.19.

          Michal Turek added a comment - Fixed, will be released in version 1.19.

          Jan Klass added a comment -

          Thank you very much Michal!

          Jan Klass added a comment - Thank you very much Michal!

          Michal Turek added a comment -

          You are welcome

          Michal Turek added a comment - You are welcome

            mixalturek Michal Turek
            jk Jan Klass
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: