The following features are provided by this plug-in:
This plug-in is developed and maintained by Nicolas Piguet. Please use the Mailing Lists or issue tracker to ask questions, create feature request or bug reports, since I don't read the comment section on this page regularly.
If you are not sure which type of report files to use, prefer cloc. It is able to detect more programming languages than SLOCCount (Scala, Ant, CSS, ...) and is able to count also lines with comments that often contain Javadoc or Doxygen documentation. Cloc is also better portable, SLOCCount requires cygwin or similar environment under MS Windows.
Never switch between SLOCCount and cloc inside one job. You would end up with messy trend graph because they name programming languages differently. Delete all affected builds and rebuild the job in such case to fix the issue.
Since SLOCCount does not run on a native Windows machine the setup for Windows requires additional steps. Most of the setup is explained in detail in the SLOCCount documentation.
The target converts Windows paths to Linux style cygdrive paths (C:\ becomes /cygdrive/c/) before SLOCCount runs. The converted paths are passed as environment variables to Cygwin. After SLOCCount has been executed, the results in sloccount.sc are converted back to windows paths.
Add this target to your Jenkins build:
You may have to adjust the paths used in the snippet, if your Jenkins workspace is on another drive than C.
This shell script is called by Cygwin / ANT.
Remote access API (REST API)
Use the URLs below to access the SLOCCount specific data.
Description of possibilities
Example of XML data:
Example of JSON data:
Cloc (Count Lines of Code) is a tool similar to SLOCCount. It provides output to a XML file that can be simply transformed to the SLOCCount format and used in this plugin. Cloc is written in Perl and should be better portable than SLOCCount.
This howto was created and tested on Debian GNU/Linux, Jenkins 1.447, SLOCCount plugin 1.12, cloc 1.60 and xsltproc 1.1.28.
Download cloc from http://cloc.sourceforge.net/ and install it. You need also a whatever tool for XML transformations (xsltproc used) or you can try clokins tool (not tested at all). You can install the packages present in your GNU/Linux distribution.
Copy-paste the script below and store it to cloc2sloccount.xsl file accessible by your Jenkins server. If you are using master and slave machines, store the script to all slaves where the jobs are executed.
Change configuration of your job to execute the following shell script. Update the path to the directory where your source files are stored and optionally pass additional parameters to cloc. Then execute XSLT transformation on cloc output to get a SLOCCount compatible report.
Enable SLOCCount publisher, enter path to the generated SLOCCount report and that's all.
Skip to end of metadata Go to start of metadata