LoginSignup
5
7

More than 5 years have passed since last update.

SonarQubeをdocker上で動かし、ローカルファイルを静的解析する For Mac

Last updated at Posted at 2017-04-19

dockerコンテナ作成

docker pull sonarqube:latest

#今回は起動テストまでなのでオプション --rm 付けました
docker run -d  --rm --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube

コンソールにアクセス

http://localhost:9000/
ログインアカウントとパスワードは admin / admin

プロジェクトを作成する

Administaration > Project > Management 押下

スクリーンショット 2017-04-19 13.42.03.png

Create Project 押下

スクリーンショット 2017-04-19 11.46.30.png

プロジェクトの設定

今回はサンプルなので下記で設定
Name : test
Key : test
スクリーンショット 2017-04-19 11.47.47.png

sonarscanerのインストール

クライアントのファイルを解析するため、ローカルPCにsonarscanerのインストールを行う。

下記にアクセス
https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner

Mac OS X 64 bit リンクからzipファイルをダウンロードし、解凍する

properties の設定
/path/to/解凍ディレクトリ/conf/sonar-scanner.properties

sonar.projectName=test
sonar.projectKey=test:test
sonar.sources=/path/to/ローカルの解析対象ディレクトリ
sonar.exclusions=除外対象

解析実行

/path/to/解凍ディレクトリ/bin/sonar-scanner
5
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
7