All Projects → luisaveiro → localhost-sonarqube

luisaveiro / localhost-sonarqube

Licence: MIT license
Analysing source code locally with SonarQube in a Docker environment.

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to localhost-sonarqube

sonarqube-action
Integrate SonarQube scanner to GitHub Actions
Stars: ✭ 90 (+429.41%)
Mutual labels:  static-analysis, sonarqube, code-review, code-quality
Sonar Jproperties Plugin
SonarQube Java Properties Analyzer
Stars: ✭ 5 (-70.59%)
Mutual labels:  static-analysis, sonarqube, code-quality
Sonarjs
SonarSource Static Analyzer for JavaScript and TypeScript
Stars: ✭ 696 (+3994.12%)
Mutual labels:  static-analysis, sonarqube, code-quality
Sonarqube
Continuous Inspection
Stars: ✭ 6,365 (+37341.18%)
Mutual labels:  static-analysis, sonarqube, code-quality
Sonarts
Static code analyzer for TypeScript
Stars: ✭ 776 (+4464.71%)
Mutual labels:  static-analysis, sonarqube, code-quality
sonar-css-plugin
SonarQube CSS / SCSS / Less Analyzer
Stars: ✭ 46 (+170.59%)
Mutual labels:  static-analysis, sonarqube, code-quality
inline-plz
Inline your lint messages
Stars: ✭ 32 (+88.24%)
Mutual labels:  static-analysis, code-review, code-quality
Reviewdog
🐶 Automated code review tool integrated with any code analysis tools regardless of programming language
Stars: ✭ 4,541 (+26611.76%)
Mutual labels:  static-analysis, code-review, code-quality
sonar-gherkin-plugin
SonarQube Cucumber Gherkin Analyzer
Stars: ✭ 33 (+94.12%)
Mutual labels:  static-analysis, sonarqube, code-quality
qodana-action
⚙️ Scan your Java, Kotlin, PHP, Python, JavaScript, TypeScript projects at GitHub with Qodana
Stars: ✭ 112 (+558.82%)
Mutual labels:  static-analysis, code-review, code-quality
Sonar Php
🐘 SonarPHP: PHP static analyzer for SonarQube & SonarLint
Stars: ✭ 288 (+1594.12%)
Mutual labels:  static-analysis, sonarqube, code-quality
Sonar Dotnet
Code analyzer for C# and VB.NET projects https://redirect.sonarsource.com/plugins/vbnet.html
Stars: ✭ 466 (+2641.18%)
Mutual labels:  static-analysis, sonarqube, code-quality
Checkstyle
Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. By default it supports the Google Java Style Guide and Sun Code Conventions, but is highly configurable. It can be invoked with an ANT task and a command line program.
Stars: ✭ 6,481 (+38023.53%)
Mutual labels:  static-analysis, code-quality
Sonar Java
☕️ SonarSource Static Analyzer for Java Code Quality and Security
Stars: ✭ 745 (+4282.35%)
Mutual labels:  static-analysis, sonarqube
Sonarondocker
🐳 📡 Docker way of running SonarQube + any DB
Stars: ✭ 25 (+47.06%)
Mutual labels:  static-analysis, sonarqube
Phpqa
Docker image that provides static analysis tools for PHP
Stars: ✭ 853 (+4917.65%)
Mutual labels:  static-analysis, code-quality
Sonar Swift
sonar-swift.SonarQube iOS Plugin, Support Objective-C And Swift, Support Infer (SonarQube iOS 代码扫描插件,支持 Objective-C 和 Swift ,支持 Infer 结果导入 ) base on https://github.com/Idean/sonar-swift
Stars: ✭ 70 (+311.76%)
Mutual labels:  static-analysis, sonarqube
Zpa
A parser and source code analyzer for PL/SQL and Oracle SQL.
Stars: ✭ 124 (+629.41%)
Mutual labels:  static-analysis, sonarqube
Static Analysis
⚙️ A curated list of static analysis (SAST) tools for all programming languages, config files, build tools, and more.
Stars: ✭ 9,310 (+54664.71%)
Mutual labels:  static-analysis, code-quality
Nodejsscan
nodejsscan is a static security code scanner for Node.js applications.
Stars: ✭ 1,874 (+10923.53%)
Mutual labels:  static-analysis, code-review

#StandWithUkraine


Code Review

Analysing source code locally with SonarQube in a Docker environment.

AboutDisclaimerGetting StartedDownloadHow To UseExecuting CommandsFAQ

Useful TipsChangelogContributingSecurity VulnerabilitiesCreditsSponsorLicense

About

This repository offers a light-weight command-line interface for interacting with SonarQube Community Edition and analyse your source code with SonarScanner (CLI) in a Docker environment.

The sonarqube Shell script provides convenient CLI commands for interacting with the Docker containers defined by the compose.yaml file. It also provides a method to copy SonarScanner configuration templates (sonar-project.properties) for easy setup.

SonarQube is an open-source platform developed by SonarSource for continuous inspection of code quality to perform automatic reviews with static analysis of code to detect bugs, code smells, and security vulnerabilities on 20+ programming languages.

Code Review [Source: www.sonarqube.org]

Disclaimer

Note : Localhost SonarQube is not affiliated with SonarSource SA and is not an official product. "SONARQUBE" is a trademark belonging to SonarSource SA.

Localhost SonarQube has been developed to run SonarQube in a local Docker environment. To install a production instance, read the SonarQube Requirements, and then follow the Installation Guide.

Please note: This readme assumes you are familiar with SonarQube and will not be covering on how to set up projects in SonarQube and configure sonar-project.properties files to analyse a project. Please visit Localhost SonarQube Wiki or alternatively visit SonarQube Documentation for additional instructions or SonarSource Community forum for assistance.

Getting Started

You will need to make sure your system meets the following prerequisites:

  • Docker Engine >= 20.10.00

This repository utilizes Docker to run SonarQube and SonarScanner. So, before using the CLI commands, make sure you have Docker installed on your system.

Download

You can clone the latest version of Localhost SonarQube repository for macOS, Linux and Windows (via WSL2).

# Clone this repository.
$ git clone [email protected]:luisaveiro/localhost-sonarqube.git --branch main --single-branch

How To Use

By default, Localhost SonarQube commands are invoked using the path/localhost-sonarqube/sonarqube script, for example:

# Start SonarQube Docker containers.
$ bash ~/localhost-sonarqube/sonarqube up

Configuring A Bash Alias

Instead of you repeatedly typing bash path/localhost-sonarqube/sonarqube to execute Localhost SonarQube Shell script, you can configure a Bash alias in ~/.bashrc or ~/.zshrc that allows you to execute the commands more easily:

alias sonarqube='bash ~/localhost-sonarqube/sonarqube'

Once the Bash alias has been configured, you may execute Localhost SonarQube commands by simply typing sonarqube. The remainder of this readme's examples will assume that you have configured this alias:

# Start SonarQube Docker containers.
$ sonarqube up

Executing Commands

The sonarqube Shell script provides convenient CLI commands for interacting with the Docker containers defined by the compose.yaml file and running SonarScanner Docker image to analyse your project source code. The following commands are available for you to interact with your SonarQube Docker environment.

# Commands Description
1 sonarqube Display a list of all available commands.
2 sonarqube about Shows a short information about Localhost SonarQube.
3 sonarqube config Display Localhost SonarQube Docker Compose config.
4 sonarqube dashboard Open SonarQube dashboard in the browser.
5 sonarqube docs Open Localhost SonarQube documentation in the browser.
6 sonarqube down Stop SonarQube Docker containers.
7 sonarqube fund Display Localhost SonarQube funding information.
8 sonarqube help Display helpful information for a command.
9 sonarqube list List available SonarScanner properties files.
10 sonarqube publish Publish SonarScanner properties file to a project directory.
11 sonarqube restart Restart SonarQube Docker containers.
12 sonarqube scan Scan project source code with SonarScanner.
13 sonarqube self-update Update Localhost SonarQube to the latest version.
14 sonarqube status Get the current status of SonarQube & SonarScanner containers.
15 sonarqube up Start SonarQube Docker containers.
16 sonarqube version Display Localhost SonarQube installed version.

Below I have provided more information on each sonarqube CLI command.

1. sonarqube

You can use the sonarqube Bash alias without providing commands to view a list of all available commands. Alternatively, you can use the usage command or use either the --help or -h option.

# Display a list of all available commands.
$ sonarqube

# Or use usage command.
$ sonarqube usage

# Or use --help option.
$ sonarqube --help

# Or use -h option.
$ sonarqube -h
Preview

Localhost SonarQube CLI

2. About command

The about command displays information including the Localhost SonarQube installed version (Git checked out tag or branch) and the path for /localhost-sonarqube/sonarqube.

# Shows a short information about Localhost SonarQube.
$ sonarqube about

3. Config command

The config command is a pass through command for docker-compose config command. Docker Compose will validate and display Localhost SonarQube Docker Compose file configuration.

# Display Localhost SonarQube Docker Compose config.
$ sonarqube config

4. Dashboard command

Once the SonarQube containers are up and running, you may access SonarQube dashboard in your web browser at: http://localhost:9000 or use the dashboard command to open SonarQube dashboard in your default browser.

# Open SonarQube dashboard in the browser.
$ sonarqube dashboard

The first time you log in to the SonarQube dashboard, you will use the default System Administrator credentials:

  • login: admin
  • password: admin

SonarQube will request you to change your password once you are logged in with the default System Administrator credentials.

5. Docs command

To easily open Localhost SonarQube readme documentation in your web browser, you can use the docs command.

# Open Localhost SonarQube documentation in the browser.
$ sonarqube docs

If you want to view *Localhost SonarQube Wikis documentation you can use the --wiki option for the docs command. Alternatively, you can use the wiki alias command.

# Open Localhost SonarQube Wikis documentation in the browser.
$ sonarqube docs --wiki

# Or use alias command
$ sonarqube wiki

6. Down command

To stop all of the Docker containers defined in Localhost SonarQube compose.yaml file, you may execute the down command. Alternatively, you can use the stop alias command.

# Stop SonarQube Docker containers.
$ sonarqube down

# Or use alias command
$ sonarqube stop

Note : The down command will not stop the SonnarScanner container scanning your projects.

7. Fund command

If you want to support Localhost SonarQube development, the fund command will display the funding information. Alternatively, you can use the support alias command.

# Display Localhost SonarQube funding information.
$ sonarqube fund

# Or use alias command
$ sonarqube support

8. Help command

Localhost SonarQube provides a help command to easily view helpful information for a command including usage, available arguments and options.

# The help command displays help for a given command.
$ sonarqube help publish

9. List command

All SonarScanner configuration templates (sonar-project.properties) are located in the sonarscanner-templates directory. You can use the list command to easily view available SonarScanner configuration templates as a list in your terminal.

# List available SonarScanner properties files.
$ sonarqube list

If you want to contribute a SonarScanner configuration template, please see the contributing section.

10. Publish command

Once the SonarQube Docker containers are up and running, you're ready to use SonarScanner and begin creating projects. To do that, you must configure SonarScanner sonar-project.properties that is most appropriate for your needs.

Localhost SonarQube repository includes a default sonar-project.properties. You can use the publish command to copy the default sonar-project.properties to your project root directory.

$ sonarqube publish

The publish command also accepts a template name as an argument and copy the template sonar-project.properties to your project root directory.

$ sonarqube publish default

Please visit SonarScanner Analysis Parameters Documentation for additional instructions to configure project analysis settings.

11. Restart command

To restart all of the Docker containers defined in Localhost SonarQube compose.yaml file, you may execute the restart command.

# Restart SonarQube Docker containers.
$ sonarqube restart

Note : The restart command will not restart the SonnarScanner Docker container.

12. Scan command

Once you have configured SonarScanner sonar-project.properties file for your project. You can run the scan command in your project root directory to analyse your project source code. Alternatively, you can use the analyse alias command.

# Scan project source code with SonarScanner.
$ sonarqube scan

# Or use alias command
$ sonarqube analyse

13. Self-update command

To ensure you have the latest version of Localhost SonarQube, you can use the self-update command:

# Update Localhost SonarQube to the latest version.
$ sonarqube self-update

The self-update command will also update SonarQube and SonarScanner Docker images to the latest version.

Note : when accessing SonarQube Dashboard and presented with SonarQube is under maintenance. You will need to go to http://localhost:9000/setup and follow the instructions. SonarQube will reanalyze your projects.

14. Status command

Localhost SonarQube provides a status command to easily view the current status of SonarQube & SonarScanner containers.

# Get the current status of SonarQube & SonarScanner containers.
$ sonarqube status

15. Up command

To start all of the Docker containers defined in Localhost SonarQube compose.yaml file, you can execute the up command. Alternatively, you can use the start alias command.

# Start SonarQube Docker containers.
$ sonarqube up

# Or use alias command
$ sonarqube start

The Docker containers will run in the background ("detached" mode). Once the SonarQube Docker containers have been started, you may access the SonarQube dashboard in your web browser at: http://localhost:9000.

Note : The up command will not start the SonnarScanner Docker container.

16. Version command

The version command displays Localhost SonarQube installed version (Git checked out tag or branch). Alternatively, you can use either the --version or -v option.

# Display Localhost SonarQube installed version.
$ sonarqube version

# Or use --version option.
$ sonarqube --version

# Or use -v option.
$ sonarqube -v

FAQ

Q: When accessing the SonarQube Dashboard, I'm presented with the message "SonarQube is under maintenance."
A: You will need to go to http://localhost:9000/setup and follow the instructions. SonarQube will reanalyze your projects.

Q: I need to create a new authentication token.
A: In SonarQube Dashboard, you can generate new tokens at User > My Account > Security.

Useful Tips

SonarCloud enhance your workflow with continuous code quality, SonarCloud automatically analyzes and decorates pull requests on GitHub, Bitbucket, Azure DevOps and GitLab on most programming languages. SonarCloud is free for open-source projects.

SonarSource offers a free IDE extension called SonarLint which helps you to detect and fix code quality issues while you write your code. SonarLint is a support plugin for the following IDEs.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

I encourage you to contribute to Localhost SonarQube! Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

Please check out the contributing to Localhost SonarQube guide for guidelines about how to proceed.

Security Vulnerabilities

Trying to report a possible security vulnerability in Localhost SonarQube? Please check out our security policy for guidelines about how to proceed.

Credits

The illustration used in the project is from unDraw (created by Katerina Limpitsouni). All product names, logos, brands, trademarks and registered trademarks are property of their respective owners.

This software uses the following open source packages:

Sponsor

Do you like this project? Support it by donating.

Code Review

License

The MIT License (MIT). Please see License File for more information.


GitHubLinkedInTwitter

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].