Saturday, June 24, 2017

Set Up sonarQube for .Net projects

 1). Download SonarQube

                https://www.sonarqube.org/downloads/
**Recommend that SonarQube 5.5 to download               
              download now
            (You can directly download from here) 

Why we choose 5.5 version


#New SonarQube Quality Model

With 5.5 we’ve boiled quality down to its essentials to make it easier to understand and work with. Now there are Reliability Issues, Vulnerability Issues, and Maintainability Issues. Or, in the plainer talk: bugs, vulnerabilities, and code smells. By drawing bugs and vulnerabilities out of the mass of issues, any operational risks in your projects are highlighted for expedited handling.



#New Measures project page

Also new in this version is a project-level Measures interface, which replaces the old metric drill down. Click a metric from the project home page and you land at the new per-file metric value listing.


#Increased vertical scalability, performance, and stability

The Compute Engine has been moved into a separate process, and the number of worker threads made configurable (SONARQUBE_HOME/conf/sonar.properties), so users will no longer have to deal with a sluggish interface when analysis reports are being processed, and the memory requirements for processing can be handled separately from those for the web application.


 2). Download SonarQube Scanner for MSBuild 2.3.2.573


          Download here
         (You can directly download from here)

3).Download and install Java development kit 8


 4). Setting the Environment Variables
  • To set up the environment variables, you need to go to System Settings
  • press window key+brek button to open System settings or Go to Start->Control Panel->System
  • Click on Advance system settings link. It will open a dialog as shown below:
 

  • Click on Environment Variables button. It will open another dialog box as shown below:

  • Set paths for user variables for JAVA_HOME and SONAR_RUNNER_HOME as follows and for system variables as well.

           JAVA_HOME                                C:\Program Files\Java\jdk1.8.0_101
           SONAR_RUNNER_HOME         C:\MSBuild.SonarQube.Runner



5). Up the sonarQube by navigating to,

      C:\sonarqube-5.5\bin\windows-x86-64 (if your computer 64-bit)
      C:\sonarqube-5.5\bin\windows-x86-32 (if your computer 32-bit)


  • Run the StartSonar.bat batch file


 6). navigate to C:\MSBuild.SonarQube.Runner\bin and change the SonarQube.Analysis file as,


 7). Go to the .Net project folder. Open cmd and enter the folowing command,

MSBuild.SonarQube.Runner begin /n:AnyName /v:1.0 /k:AnyKey

      PS: you can enter any name, key and a version number.

 
 8). Runs MSBuild in cmd after that

 
 9). To completes the SonarQube analysis, and sends the results to the SonarQube server enter the following command.

MSBuild.SonarQube.Runner end



 10). Navigate to http://localhost:9000 and then you can see the project has push to the server.


Now you can analyse the codes.. cheers..!!  :D




No comments:

Post a Comment