Sunday, 16 February 2020

Sonar Qube

1. Using CommandLine:

Sonar Qube Installation on Mac using Homebrew

Prerequisites: Installation of Homebrew would be ready
http://brew.sh/

For installation of SonarQube
  1. Java would be installed on your machine. Installation link: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
  2. On terminal window type "brew install sonar". After completion.
  3. On terminal window type "brew install sonar-runner". After completion
  4. On terminal window type "sonar console". This would start sonar server. For checking type http://localhost:9000/ .  or command →  run:sonar console
  5. Once done for your  Projects create the sonar-project.properties file. A dummy sonar-project.properties file is created here:
    # Required metadatasonar.projectKey=spring_boot_s3bucketsonar.projectName=My first Project to be analyzedsonar.projectVersion=1.0
    # Comma-separated paths to directories with sources (required)sonar.sources=src
    # Languagesonar.language=java
    # Encoding of the source filessonar.sourceEncoding=UTF-8
  6. Now go to the project directory in terminal type the command "sonar-runner" to execute SonarQube for your project
  7. The output would be shown as below:

2. In IntelliJ Idea IDE :

Add a plugin of sonar in pom.xml 

 org.sonarsource.scanner.maven

sonar-maven-plugin
3.3.0.603
After adding plugin do clean and install before running sonar:sonar

after ANALYSIS SUCCESSFUL, you can browse http://localhost:9000/dashboard/index/


3: SonarLint

Step 1: Install SonarLint plugin in intelli

After restart you can see SonarLint near to status bar cliack on that and run . It will show the results like beloew.

For SVN scan we need permission which is not there so getting below error:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project pcressentials-id-web: Error when executing blame for file src/main/java/com/thermofisher/pcressentials/id/api/impl/HeaderLoggerFilter.java: svn: E170001: Authentication required for '<https://svn.amer.thermo.com:443> SONIA :: SCM Manager' -> [Help 1]