JetBrains, the company behind ReSharper, has a command-line tool package with some of the ReSharper features too. It is a free package to integrate quality analysis into continuous integration systems and can be downloaded from JetBrains’ ReSharper Command Line Tools page.
In this article, we are going to integrate the dupFinder into the Jenkins build process. The installation process uses wget and unzip, these tools have been setup in article Building a Build Server – Installing NAnt.
Installing ReSharper Command Line Tools
Open the Cygwin terminal and execute the following commands:
mkdir /tmp/ReSharperCLT cd /tmp/ReSharperCLT unzip JetBrains.ReSharper.CommandLineTools.2016.3.20170126.124346.zip rm JetBrains.ReSharper.CommandLineTools.2016.3.20170126.124346.zip cd /cygdrive/c mv /tmp/ReSharperCLT /cygdrive/c icacls ReShaperCLT /T /Q /C /RESET |
Installing necessary plugins
From the main page of Jenkins, go to Manage Jenkins / Manage Plugins and install the plugin DRY Plug-in from the Available tab.
Integrating ReSharper Command Line Tools into Jenkins
To try out this tool, we are going to use the repository at https://github.com/atzimler/CodeDuplicates.git.
The test build project has the following build configuration:
Source Code Management
Use Git source code management with
Repositories |
|
Repository URL |
|
Branches to build |
|
Branch specifier (blank for ‘any’) |
*/master |
Repository browser: |
(Auto) |
Build
Execute Windows batch command |
|
Command |
C:\ReSharperCLT\dupfinder.exe –output=DupFinderReport.xml CodeDuplicates.sln |
Post-build Actions
Publish duplicate code analysis results |
|
Duplicate code results |
DupFinderReport.xml |
High priority threshold |
50 |
Normal priority threshold |
25 |
Next time, we are going to explore how to integrate the code inspection checker into the build process. You can connect with me on LinkedIn or Twitter. Share if you found this article useful.
No comments yet.