Skip to content

Maintainability and reliability checks for Java

License

Notifications You must be signed in to change notification settings

codeclimate/codeclimate-sonar-java

Repository files navigation

Code Climate Sonar-Java Engine

Maintainability Test Coverage CircleCI

codeclimate-sonar-java is a Code Climate engine that wraps Sonarlint in standalone mode.

Installation

make image

Tests

make test

Usage

  1. If you haven't already, install the Code Climate CLI.
  2. Configure a .codeclimate.yml file in your repo.
engines:
  sonar-java:
    enabled: true
    config:
      sonar.java.source: 7
      tests_patterns:
        - src/test/**
exclude_paths:
  - build/
  1. Run codeclimate analyze.

Custom configurations

Java source version

It is possible to specifcy a Java version the code should be compliant to, it helps Sonar to use the proper rules.

engines:
  sonar-java:
    enabled: true
    config:
      sonar.java.source: 7

Tests

Specifying where the test classes are helps Sonar to use specific rules for those files.

engines:
  sonar-java:
    enabled: true
    config:
      tests_patterns:
        - src/test/**
        - app/src/test/**

Severity

Ignore issues with severity below the minimum:

engines:
  sonar-java:
    enabled: true
    config:
      minimum_severity: critical  # default: major
                                  # valid values are: info, minor, major, critical, blocker

Sonar Documentation

http://www.sonarlint.org/commandline

http://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner

Issue Tracker: http://jira.sonarsource.com/browse/SLCLI

Copyright

This engine is developed by Code Climate using SonarLint, it is not endorsed by SonarSoruce.

See LICENSE