• Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • sloccount-plugin
    • None
    • All

      Implement Remote access API to SLOCCount plugin, it should be quite simple but very powerful for providing the data in json and xml formats. Export the statistics per language stored in build.xml together with total number of lines.

      See Cppcheck plugin CppcheckResult.getApi(), @ExportedBean and @Exported.

      https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API

          [JENKINS-21922] Remote access API (REST API)

          Code changed in jenkins
          User: Michal Turek
          Path:
          src/main/java/hudson/plugins/sloccount/SloccountResult.java
          src/main/java/hudson/plugins/sloccount/model/SloccountLanguageStatistics.java
          src/main/java/hudson/plugins/sloccount/model/SloccountReportStatistics.java
          http://jenkins-ci.org/commit/sloccount-plugin/4b42fdc0d03cbbc9320c4bc3523d8eba4f4697e3
          Log:
          JENKINS-21922 REST API/Remote access API

          • Total number of lines, files and languages are exported.
          • Number of lines and files are export for each language.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Michal Turek Path: src/main/java/hudson/plugins/sloccount/SloccountResult.java src/main/java/hudson/plugins/sloccount/model/SloccountLanguageStatistics.java src/main/java/hudson/plugins/sloccount/model/SloccountReportStatistics.java http://jenkins-ci.org/commit/sloccount-plugin/4b42fdc0d03cbbc9320c4bc3523d8eba4f4697e3 Log: JENKINS-21922 REST API/Remote access API Total number of lines, files and languages are exported. Number of lines and files are export for each language.

          Code changed in jenkins
          User: Michal Turek
          Path:
          src/main/java/hudson/plugins/sloccount/SloccountResult.java
          src/main/java/hudson/plugins/sloccount/model/SloccountLanguageStatistics.java
          src/main/java/hudson/plugins/sloccount/model/SloccountReportStatistics.java
          http://jenkins-ci.org/commit/sloccount-plugin/2453b1e524c173b8f94442527791fd1e0d6be291
          Log:
          Merge pull request #37 from mixalturek/master

          JENKINS-21922 REST API/Remote access API

          Compare: https://github.com/jenkinsci/sloccount-plugin/compare/7ce277444f49...2453b1e524c1

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Michal Turek Path: src/main/java/hudson/plugins/sloccount/SloccountResult.java src/main/java/hudson/plugins/sloccount/model/SloccountLanguageStatistics.java src/main/java/hudson/plugins/sloccount/model/SloccountReportStatistics.java http://jenkins-ci.org/commit/sloccount-plugin/2453b1e524c173b8f94442527791fd1e0d6be291 Log: Merge pull request #37 from mixalturek/master JENKINS-21922 REST API/Remote access API Compare: https://github.com/jenkinsci/sloccount-plugin/compare/7ce277444f49...2453b1e524c1

          Michal Turek added a comment -

          Use the following URLs to access the REST data:

          Description of Remote API
          http://SERVER/job/JOB_NAME/BUILD_NUMBER/sloccountResult/api

          Data
          http://SERVER/job/JOB_NAME/BUILD_NUMBER/sloccountResult/api/xml
          http://SERVER/job/JOB_NAME/BUILD_NUMBER/sloccountResult/api/xml?depth=1
          http://SERVER/job/JOB_NAME/BUILD_NUMBER/sloccountResult/api/json
          http://SERVER/job/JOB_NAME/BUILD_NUMBER/sloccountResult/api/json?depth=1
          etc.

          Example of XML data:

          <sloccountReportStatistics>
          	<language>
          		<files>14</files>
          		<lines>214</lines>
          		<name>php</name>
          	</language>
          	<language>
          		<files>7</files>
          		<lines>513</lines>
          		<name>xml</name>
          	</language>
          	<language>
          		<files>116</files>
          		<lines>8174</lines>
          		<name>java</name>
          	</language>
          	<language>
          		<files>4</files>
          		<lines>34</lines>
          		<name>sh</name>
          	</language>
          	<totalFiles>141</totalFiles>
          	<totalLanguages>4</totalLanguages>
          	<totalLines>8935</totalLines>
          </sloccountReportStatistics>
          

          Example of JSON data:

          {
          	"languages":
          	[
          		{"files":14,"lines":214,"name":"php"},
          		{"files":7,"lines":513,"name":"xml"},
          		{"files":116,"lines":8174,"name":"java"},
          		{"files":4,"lines":34,"name":"sh"}
          	],
          	"totalFiles":141,
          	"totalLanguages":4,
          	"totalLines":8935
          }
          

          Michal Turek added a comment - Use the following URLs to access the REST data: Description of Remote API http://SERVER/job/JOB_NAME/BUILD_NUMBER/sloccountResult/api Data http://SERVER/job/JOB_NAME/BUILD_NUMBER/sloccountResult/api/xml http://SERVER/job/JOB_NAME/BUILD_NUMBER/sloccountResult/api/xml?depth=1 http://SERVER/job/JOB_NAME/BUILD_NUMBER/sloccountResult/api/json http://SERVER/job/JOB_NAME/BUILD_NUMBER/sloccountResult/api/json?depth=1 etc. Example of XML data: <sloccountReportStatistics> <language> <files>14</files> <lines>214</lines> <name>php</name> </language> <language> <files>7</files> <lines>513</lines> <name>xml</name> </language> <language> <files>116</files> <lines>8174</lines> <name>java</name> </language> <language> <files>4</files> <lines>34</lines> <name>sh</name> </language> <totalFiles>141</totalFiles> <totalLanguages>4</totalLanguages> <totalLines>8935</totalLines> </sloccountReportStatistics> Example of JSON data: { "languages": [ {"files":14,"lines":214,"name":"php"}, {"files":7,"lines":513,"name":"xml"}, {"files":116,"lines":8174,"name":"java"}, {"files":4,"lines":34,"name":"sh"} ], "totalFiles":141, "totalLanguages":4, "totalLines":8935 }

          Michal Turek added a comment -

          Will be released in version 1.16.

          Michal Turek added a comment - Will be released in version 1.16.

            mixalturek Michal Turek
            mixalturek Michal Turek
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: