SonarLint offers the ability to scan code for issues before checking it in, with minimal configuration.

SonarLint for Command Line is free and open source.

SonarLint for Command Line

Installation

  1. Download the latest release and extract the zip file.
  2. Add <extraction_path>/bin to your PATH.

Usage

With the SonarLint executable in the PATH, simply run on the base directory of your project:
sonarlint

For Windows:
sonarlint.bat

SonarLint will produce an HTML issues report and will show a short summary in the console:
Console summary

SonarLint CLI arguments

You can list the accepted arguments with

sonarlint -h

Example

  • --src - refers to the directory containing the source code in your project
sonarlint --src **/my_source_dir/**

News

  • February 12, 2016 - First release of SonarLint CLI.

FAQ

  • Which languages are supported? - Currently, SonarLint CLI will analyze Java, Javascript, PHP source files.
  • How do I configure which files to analyze? - By default, SonarLint analyzes all source code that it finds under the current directory. You can configure the location of source and test files using --src and --tests, respectively.
  • How to configure rules? - You can't for now. We might implement this feature in upcoming versions, probably by allowing to "point" SonarLint to a SonarQube server instance.
  • How to keep updated about future releases? - Releases are announced in the SonarLint group. You can also subscribe to atom feed on github or to the newsletter in http://www.sonarsource.com.

Contribute

SonarLint for Command Line is open source under the LGPL v3 license. You can fork us on GitHub, and submit Pull Requests. Feel free to fix bugs or to implement new features.

Feedback

The preferred way to discuss about SonarLint is by posting on the SonarLint Google Group. We are also constantly monitoring questions posted to StackOverflow. For faster answers mark your StackOverflow questions with the [SonarLint] tag.