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

Get total comment count in SloccountReportStatistics

    Details

    • Similar Issues:

      Description

      I'd like to have comment count when I do a getAction in job level and also saw it as a column of the table in the details of a build.
      I already do change on my own in "a custom sloccount plugin" but I would like to set it on the official plugin.
      The change are not quite hard to do if any other developper doesn't take this ticket I will do it myself.

      One of the feature that I'm developping is blocked cause I don't have the variable "count line of comments"

      Change POV user:
      In sloccount result details I added the column "comment".
      Should I had the column in sloccount-table portlet?

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jim
          Path:
          src/main/java/hudson/plugins/sloccount/SloccountResult.java
          src/main/java/hudson/plugins/sloccount/model/File.java
          src/main/java/hudson/plugins/sloccount/model/FileContainer.java
          src/main/java/hudson/plugins/sloccount/model/SloccountLanguageStatistics.java
          src/main/java/hudson/plugins/sloccount/model/SloccountParser.java
          src/main/java/hudson/plugins/sloccount/model/SloccountPublisherReport.java
          src/main/java/hudson/plugins/sloccount/model/SloccountReport.java
          src/main/java/hudson/plugins/sloccount/model/SloccountReportInterface.java
          src/main/java/hudson/plugins/sloccount/model/SloccountReportStatistics.java
          src/main/java/hudson/plugins/sloccount/model/cloc/ClocReport.java
          src/main/resources/hudson/plugins/sloccount/SloccountResult/files.jelly
          src/test/java/hudson/plugins/sloccount/model/SloccountReportTest.java
          http://jenkins-ci.org/commit/sloccount-plugin/0d502be2181b8bac381d0fef6d771a04f1d469dc
          Log:
          JENKINS-31221 Resolved issue - Implement access to comments count

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jim Path: src/main/java/hudson/plugins/sloccount/SloccountResult.java src/main/java/hudson/plugins/sloccount/model/File.java src/main/java/hudson/plugins/sloccount/model/FileContainer.java src/main/java/hudson/plugins/sloccount/model/SloccountLanguageStatistics.java src/main/java/hudson/plugins/sloccount/model/SloccountParser.java src/main/java/hudson/plugins/sloccount/model/SloccountPublisherReport.java src/main/java/hudson/plugins/sloccount/model/SloccountReport.java src/main/java/hudson/plugins/sloccount/model/SloccountReportInterface.java src/main/java/hudson/plugins/sloccount/model/SloccountReportStatistics.java src/main/java/hudson/plugins/sloccount/model/cloc/ClocReport.java src/main/resources/hudson/plugins/sloccount/SloccountResult/files.jelly src/test/java/hudson/plugins/sloccount/model/SloccountReportTest.java http://jenkins-ci.org/commit/sloccount-plugin/0d502be2181b8bac381d0fef6d771a04f1d469dc Log: JENKINS-31221 Resolved issue - Implement access to comments count
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jim
          Path:
          src/main/java/hudson/plugins/sloccount/SloccountDiff.java
          src/main/java/hudson/plugins/sloccount/SloccountDiffLanguage.java
          src/main/java/hudson/plugins/sloccount/SloccountDiffSummary.java
          src/main/java/hudson/plugins/sloccount/model/SloccountParser.java
          src/main/resources/hudson/plugins/sloccount/SloccountBuildAction/statistics.jelly
          src/main/resources/hudson/plugins/sloccount/SloccountResult/folders.jelly
          src/main/resources/hudson/plugins/sloccount/SloccountResult/languages.jelly
          src/main/resources/hudson/plugins/sloccount/SloccountResult/modules.jelly
          src/main/resources/hudson/plugins/sloccount/dashboard/SloccountTablePortlet/table.jelly
          http://jenkins-ci.org/commit/sloccount-plugin/3a12ffe493e18ef39aca49a7e3a6244b1acf350f
          Log:
          JENKINS-31221 Resolved issue - Implement access to comments count
          add commentCount in:
          SloccountDiff.java
          SloccountDiffLanguage.java
          SloccountDiffSummary.java

          add column in jelly:
          statistics.jelly
          languages.jelly
          modules.jelly

          SloccountParser: in parseLine remove commentCount and replace in report.add commentCount by 0

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jim Path: src/main/java/hudson/plugins/sloccount/SloccountDiff.java src/main/java/hudson/plugins/sloccount/SloccountDiffLanguage.java src/main/java/hudson/plugins/sloccount/SloccountDiffSummary.java src/main/java/hudson/plugins/sloccount/model/SloccountParser.java src/main/resources/hudson/plugins/sloccount/SloccountBuildAction/statistics.jelly src/main/resources/hudson/plugins/sloccount/SloccountResult/folders.jelly src/main/resources/hudson/plugins/sloccount/SloccountResult/languages.jelly src/main/resources/hudson/plugins/sloccount/SloccountResult/modules.jelly src/main/resources/hudson/plugins/sloccount/dashboard/SloccountTablePortlet/table.jelly http://jenkins-ci.org/commit/sloccount-plugin/3a12ffe493e18ef39aca49a7e3a6244b1acf350f Log: JENKINS-31221 Resolved issue - Implement access to comments count add commentCount in: SloccountDiff.java SloccountDiffLanguage.java SloccountDiffSummary.java add column in jelly: statistics.jelly languages.jelly modules.jelly SloccountParser: in parseLine remove commentCount and replace in report.add commentCount by 0
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Michal Turek
          Path:
          src/main/java/hudson/plugins/sloccount/SloccountDiff.java
          src/main/java/hudson/plugins/sloccount/SloccountDiffLanguage.java
          src/main/java/hudson/plugins/sloccount/SloccountDiffSummary.java
          src/main/java/hudson/plugins/sloccount/SloccountResult.java
          src/main/java/hudson/plugins/sloccount/model/File.java
          src/main/java/hudson/plugins/sloccount/model/FileContainer.java
          src/main/java/hudson/plugins/sloccount/model/SloccountLanguageStatistics.java
          src/main/java/hudson/plugins/sloccount/model/SloccountParser.java
          src/main/java/hudson/plugins/sloccount/model/SloccountPublisherReport.java
          src/main/java/hudson/plugins/sloccount/model/SloccountReport.java
          src/main/java/hudson/plugins/sloccount/model/SloccountReportInterface.java
          src/main/java/hudson/plugins/sloccount/model/SloccountReportStatistics.java
          src/main/java/hudson/plugins/sloccount/model/cloc/ClocReport.java
          src/main/resources/hudson/plugins/sloccount/SloccountBuildAction/statistics.jelly
          src/main/resources/hudson/plugins/sloccount/SloccountResult/files.jelly
          src/main/resources/hudson/plugins/sloccount/SloccountResult/folders.jelly
          src/main/resources/hudson/plugins/sloccount/SloccountResult/languages.jelly
          src/main/resources/hudson/plugins/sloccount/SloccountResult/modules.jelly
          src/main/resources/hudson/plugins/sloccount/dashboard/SloccountTablePortlet/table.jelly
          src/test/java/hudson/plugins/sloccount/model/SloccountReportTest.java
          http://jenkins-ci.org/commit/sloccount-plugin/de3d4b1428c7aaf5b2efedde044793a5498e027a
          Log:
          Merge pull request #46 from Safe0/next

          JENKINS-31221 Resolved issue - Implement access to comments count

          Compare: https://github.com/jenkinsci/sloccount-plugin/compare/a4c8ffc76752...de3d4b1428c7

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Michal Turek Path: src/main/java/hudson/plugins/sloccount/SloccountDiff.java src/main/java/hudson/plugins/sloccount/SloccountDiffLanguage.java src/main/java/hudson/plugins/sloccount/SloccountDiffSummary.java src/main/java/hudson/plugins/sloccount/SloccountResult.java src/main/java/hudson/plugins/sloccount/model/File.java src/main/java/hudson/plugins/sloccount/model/FileContainer.java src/main/java/hudson/plugins/sloccount/model/SloccountLanguageStatistics.java src/main/java/hudson/plugins/sloccount/model/SloccountParser.java src/main/java/hudson/plugins/sloccount/model/SloccountPublisherReport.java src/main/java/hudson/plugins/sloccount/model/SloccountReport.java src/main/java/hudson/plugins/sloccount/model/SloccountReportInterface.java src/main/java/hudson/plugins/sloccount/model/SloccountReportStatistics.java src/main/java/hudson/plugins/sloccount/model/cloc/ClocReport.java src/main/resources/hudson/plugins/sloccount/SloccountBuildAction/statistics.jelly src/main/resources/hudson/plugins/sloccount/SloccountResult/files.jelly src/main/resources/hudson/plugins/sloccount/SloccountResult/folders.jelly src/main/resources/hudson/plugins/sloccount/SloccountResult/languages.jelly src/main/resources/hudson/plugins/sloccount/SloccountResult/modules.jelly src/main/resources/hudson/plugins/sloccount/dashboard/SloccountTablePortlet/table.jelly src/test/java/hudson/plugins/sloccount/model/SloccountReportTest.java http://jenkins-ci.org/commit/sloccount-plugin/de3d4b1428c7aaf5b2efedde044793a5498e027a Log: Merge pull request #46 from Safe0/next JENKINS-31221 Resolved issue - Implement access to comments count Compare: https://github.com/jenkinsci/sloccount-plugin/compare/a4c8ffc76752...de3d4b1428c7
          Hide
          mixalturek Michal Turek added a comment -

          Released in version 1.21, it should appear in Update center in a day or so.

          Show
          mixalturek Michal Turek added a comment - Released in version 1.21, it should appear in Update center in a day or so.
          Hide
          tom_yolo Thomas Carayol added a comment -

          Thanks a lot for this patch. However, I don't see any documentation about how we use it. Do you have any ? Many thanks.

          Show
          tom_yolo Thomas Carayol added a comment - Thanks a lot for this patch. However, I don't see any documentation about how we use it. Do you have any ? Many thanks.
          Hide
          jserra3 Jim SERRA added a comment -

          Hello, sorry for the late answer, I don't know if there is docs for this, but here some a java method that can be useful : (I don't do Jenkins code anymore)

          public SloccountReportStatistics getStatistics(Job<?, ?> job) {
          Run<?, ?> build = job.getLastBuild();
          while(build != null){
          SloccountBuildAction action = build.getAction(SloccountBuildAction.class);
          if (action != null) {
          SloccountResult result = action.getResult();
          if(result != null && !result.isEmpty()) {
          return result.getStatistics();
          }
          }
          build = build.getPreviousBuild();
          }
          return new SloccountReportStatistics(new LinkedList<SloccountLanguageStatistics>());
          }
          

          and then you can do :

          this.getStatistics(j).getLineCount();
          this.getStatistics(j).getFileCount();
          this.getStatistics(j).getLanguageCount();
          

          etc ...

          Hope it's useful

          Show
          jserra3 Jim SERRA added a comment - Hello, sorry for the late answer, I don't know if there is docs for this, but here some a java method that can be useful : (I don't do Jenkins code anymore) public SloccountReportStatistics getStatistics(Job<?, ?> job) { Run<?, ?> build = job.getLastBuild(); while (build != null ){ SloccountBuildAction action = build.getAction(SloccountBuildAction.class); if (action != null ) { SloccountResult result = action.getResult(); if (result != null && !result.isEmpty()) { return result.getStatistics(); } } build = build.getPreviousBuild(); } return new SloccountReportStatistics( new LinkedList<SloccountLanguageStatistics>()); } and then you can do : this .getStatistics(j).getLineCount(); this .getStatistics(j).getFileCount(); this .getStatistics(j).getLanguageCount(); etc ... Hope it's useful

            People

            • Assignee:
              jserra3 Jim SERRA
              Reporter:
              jserra3 Jim SERRA
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: