Skip to content

codeclimate/codeclimate-ss-analyzer-wrapper

Repository files navigation

Code Climate Wrapper for SonarSource Analyzers

CircleCI Maintainability Test Coverage

codeclimate-ss-analyzer-wrapper is the base library for SonarSource based engines. It wraps Sonarlint in standalone mode.

Tests

make test

Usage

You can use the codeclimate-sonar-php repo as an example for building a new sonar based engine. The important aspects are listed below:

  1. Use this wrapper lib. Make sure your build.gradle has the following entries:
repositories {
  jcenter()
  maven { url 'https://jitpack.io' }
}

dependencies {
  compile("com.github.codeclimate:sonar-wrapper:master-SNAPSHOT")
}
  1. Add the plugin lib and make sure it is copied to the build/plugins directory as part of the build task:
task copyPlugins(type: Copy) {
  into "${buildDir}/plugins"
  from configurations.testCompile
  include "sonar-*-plugin*.jar"
}

build.dependsOn(copyPlugins)

dependencies {
  // ...
  compile("org.sonarsource.php:sonar-php-plugin:2.10.0.2087")
}
  1. Running: The wrapper overrides a few classes from the sonar libraries which makes classpath order something very important to pay attention: bin/codeclimate-sonar:
#!/usr/bin/env sh

BUILD_DIR=$(dirname $0)
APP=$(find ${BUILD_DIR}/libs -name "codeclimate-sonar-php.jar" | head -n1)
WRAPPER=$(find ${BUILD_DIR}/libs -name "sonar-wrapper*.jar" | head -n1)
CORE=$(find ${BUILD_DIR}/libs -name "sonarlint-core*.jar" -or -name "sonarlint-client-api*.jar" | tr "\n" ":")
LIBS=$(find ${BUILD_DIR}/libs -name "*.jar" | tr "\n" ":")

CODE_DIR=$1; shift
CONFIG_FILE=$1; shift

java \
  -noverify \
  -cp ${APP}:${WRAPPER}:${CORE}:${LIBS} \
  -Djava.awt.headless=true  \
  -Dsonarlint.home="${BUILD_DIR}"  \
  -Dproject.home="${CODE_DIR}"  \
  -Dconfig="${CONFIG_FILE}"  \
  -Dorg.freemarker.loggerLibrary=none  \
  cc.App $@

bin/codeclimate-sonar /code /config.json

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 repository is maintained by CodeClimate. It uses SonarLint, which is a SonarSource product. This is not endorsed by SonarSource.

See LICENSE

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •