This plug-in generates the trend report for SLOCCount, an open source program which counts the number of lines of codes in over 25 different languages, including C/C++, Ada, COBOL, Fortran, SQL, Ruby, Python, etc...
The SLOCCount plug-in scans for SLOCCount report files in the build workspace and reports the number of lines found.
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.
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.
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