
Use Sonarqube Code Quality Analysis
Your workflow already has all the right pieces - it just need a little turbocharging. SonarLint catches issues right in your IDE while SonarQube analyzes pull requests and branches. The combination forms a continuous code quality analysis solution that keeps your codebase clean.Create a build.gradle file under /Packt/Chapter06/CodeQualityChapter06.
It currently supports more than 20+ programming languages including support on C#, JavaScript, C/ C++, TypeScript, Go, Python, etc., and other languages. We were already using Checkstyle, PMD and SpotBugs before, but decided that an 'in-depth' analysis after those three tools already submitted their reports would be a welcomed addition for the presentation of found issues.SonarQube is an open platform for managing continuous inspection of the code quality, which can locate potential errors in the codebase. We use SonarQube because of the big inbuilt database of code-smells, pitfalls and best-practices. This generator can be called from Bazel, which is a recommended way of using it inside a continuous integration build or any other automated pipeline.
...
Use Sonarqube Download Sonar Scanner
Properties file in your project directory sonar.python.coverage.reportPaths=./coverage.xml# project metadata (used to be required, optional since SonarQube 6.1)# path to test source directories (optional)Switch to the project path and execute sonar-scanner sonar-scanner \-Dsonar. Download Sonar Scanner commands to execute a Scanner on your code.Add a sonar-project. Give your token a name, click the Generate button, and click Continue.Select your project’s main language under Run analysis on your project, and Operating System. /libexecExport SONAR=$SONAR_HOME/bin export PATH=$SONAR:$PATH Start SonarQubeBrew services start sonarqube Log in to SonarQube DasboardEnter in the browser to enter the following page.Log in to SonarQube and enter the account and password admin/admin Create new project in SonarQube DashboardProvide -> Project key and a Display name and click the Set Up button.Under Provide a token, select Generate a token.
