Skip to main content

Sonar

  • http://www.sonarsource.org/

  • archi.png
  • What is Sonar ?
    • Sonar는 Codehaus에서 개발한 코드 품질 관리 플랫폼으로, 오픈소스
    • PMD, CheckStyle, Findbugs, Cobertura등을 이용해서 코드검사, 코드커버리지, 중복도, 복잡도 등의 데이터를 추출해주고,그 외 품질관련 데이터도 뽑아주기 때문에 수월하게 좋은 데이터를 얻을 수 있다.

      • PMD : source quality assurence

    • 프로젝트 내의 규칙을 추가로 적용하여 반영할 수 있다.
  • Download Sonar
  • MySql

    • show databases;
      +--------------------+
      | Database           |
      +--------------------+
      | information_schema | 
      | mysql              | 
      | redmine            | 
      | test               | 
      +--------------------+
      4 rows in set (0.13 sec)
      mysql> create user 'sonar_usr'@'localhost' identified by 'sonar_usr';
      Query OK, 0 rows affected (0.00 sec)
      
      mysql> grant all privileges on sonar_db.* to 'sonar_usr'@'localhost' with grant  option;
      Query OK, 0 rows affected (0.00 sec)
      
      mysql> 
  • Sonar config
    • #----- MySQL 5.x/6.x
      # Comment the embedded database and uncomment the following lines to use MySQL
      sonar.jdbc.url:                            jdbc:mysql://localhost:3306/sonar_db?useUnicode=true&characterEncoding=utf8
      sonar.jdbc.driverClassName:                com.mysql.jdbc.Driver
      sonar.jdbc.validationQuery:                select 1
      
      
      #----- Global database settings
      sonar.jdbc.username:                       sonar_usr
      sonar.jdbc.password:                       sonar_usr
      sonar.jdbc.maxActive:                      10
      sonar.jdbc.maxIdle:                        5
      sonar.jdbc.minIdle:                        2
      sonar.jdbc.maxWait:                        5000
      sonar.jdbc.minEvictableIdleTimeMillis:     600000
      sonar.jdbc.timeBetweenEvictionRunsMillis:  30000
  • Start
    • /apps/sonar-2.7/bin/linux-x86-32/sonar.sh start
  • Stop
    • /apps/sonar-2.7/bin/linux-x86-32/sonar.sh stop