Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

Table of Contents

개요

품질 프로파일(Quality Profile)은 SonarQube의 핵심 서비스입니다. 품질 프로파일은 사용자가 정의한 코딩 규칙의 집합이기 때문입니다(예: Methods must not have a complexity greater than 10).

이상적인 경우, 모든 프로젝트는 특정 언어에 대해 동일한 품질 프로파일을 가져야 하나, 이러한 전제가 항상 현실적인 것은 아닙니다. 예를 들면, 다음과 같은 경우가 있습니다:

  • 어플리케이션 사이에 기술적인 구현이 상이한 경우(예를 들면, Thread 기반 혹은 Non-Threaded 기반의 Java application을 구현하는 경우 코딩 규칙이 상이함)
  • 특정 어플리케이션을 대상으로 더 확고한 기준을 적용하고자 하는 경우(예를 들면, 내부 프레임워크 등)
  • 기타

어느 경우라도 사용자는 원하는 만큼의 품질 프로파일을 정의할 수 있습니다. 프로그래밍 언어별로 설정된 품질 프로파일을 관리하려면, Quality Profiles (top menu) 메뉴를 사용합니다.

모든 프로그래밍 언어 플러그인은 기본 프로파일을 내장하고 있기 때문에("Sonar way"), 특별한 설정 없이도 곧바로 소스 코드를 분석할 수 있습니다. 즉, 새로운 언어 플러그인을 추가하면, 최소한 하나의 품질 플러그인을 사용할 수 있습니다.

모든 프로그래밍 언어는 기본 품질 프로파일을 가집니다("Default" 태그로 표시됨). 특정한 품질 프로파일을 할당하지 않은 프로젝트는 해당 언어의 기본 프로파일을 사용해 분석됩니다.

SonarQube를 처음 사용한다면, Sonar way를 기본 프로파일로 사용하는 것도 좋습니다. Sonar way 프로파일은 해당 언어로 작성된 대부분의 프로젝트들에 적용 가능한 규칙들로 구성되어 있습니다. 하지만, 사용자의 프로젝트에 최적인 프로파일을 사용하고자 하는 경우에는 새로운 프로파일을 만들 것을 권장합니다(Sonar way를 복사하여 프로파일을 생성할 수 있습니다). 이 방법을 사용하면 Sonar way를 품질 프로파일의 기준선으로 활용해, 사용자가 생성한 프로파일의 변경 내역을 추적할 수 있기 때문입니다. 또한, Sonar way에는 플러그인의 신규 버전이 릴리스 될 때마다 새로운 규칙이 추가되기도 하고, 기존 규칙의 심각도가 조정되기도 합니다. Sonar way를 복사해서 생성한 품질 프로파일에 이러한 변경 사항이 자동으로 적용되지는 않지만, 생성한 품질 프로파일을 업데이트했다면, 새로운 Sonar way에 어떤 규칙들이 추가되었는지 비교해볼 수 있습니다("내가 만든 프로파일에 필요한 신규 규칙들을 모두 추가했는지 알고 싶다면?" 항목 참조).

이런 경우에는 어떻게...

한 프로파일에서 다른 프로파일로 규칙들을 복사하고 싶다면?

많은 사용자들이 실제로 내장된 프로파일을 업데이트 하지 않은 채로 해당 프로파일을 사용하고 싶어 합니다. 이러한 경우, Quality Profiles 페이지에서 오리지널 프로파일(Source라고 부릅니다)의 규칙 숫자를 클릭합니다. 이어 나타나는 Rules 페이지는 해당 프로파일에 포함된 규칙들만을 표시합니다. Bulk Activate 버튼을 클릭하고 대상 프로파일을 선택하면 해당 규칙들을 대상 프로파일에서 모두 활성화 할 수 있습니다.

한 프로파일의 변경 사항을 확인하고 싶다면?

SonarQube는 현재 분석에서 사용한 품질 프로파일과, 이전 분석에서 사용한 품질 프로파일이 다르다는 것을 감지하면 Quality Profile 이벤트를 프로젝트의 이벤트 로그에 추가합니다. 프로파일의 변경 사항을 확인하고자 하는 경우, Quality Profiles > 'Project Name'으로 이동해 Changelog를 선택합니다. 프로파일 변경이 분석 결과에 미친 영향을 확인할 수 있습니다으로 인해 분석 결과에 미친 여향을 확인할 수 있습니다. 

한 SonarQube 인스턴스에서 다른 SonarQube 인스턴스로 프로파일을 복사하고 싶다면?

Back up 기능을 사용해 품질 프로파일을 XML 파일로 추출할 수 있습니다. 대상 인스턴스에서 Restore Profile 기능을 사용해 XML 파일을 임포트할 수 있습니다. 다만, Back up/ Restore Profile 기능에는 제한 사항이 있습니다:

SONAR-5366 - Make it possible to back up and restore customizations of rulesOPEN. (사용자 규칙의 백업 및 복원 기능 필요)

프로젝트에 핵심 규칙 셋과 추가 규칙을 적용하고 싶다면?

사용자의 조직에 모든 팀들이 반드시 준수해야 하는 최소한의 코딩 규칙이 존재한다고 가정합니다. 여러분은 여러분이 개발에 참여하는 프로젝트에서 사용하는 특정한 기술과 관련된 규칙들을 추가하기를 원합니다. 해당 규칙들은 여러분의 팀에는 의미있지만, 다름 팀에게는 전혀 의미가 없거나 심지어 잘못된 판단을 야기하도록 할 수도 있습니다. 이러한 경우에는 상속(inheritance) 기능을 사용할 수 있습니다. 핵심적인 규칙 셋으로 베이스라인 프로파일(Root)을 설정합니다. 다음으로 자식 프로파일(Sprout)를 생성합니다. Sprout을 선택하고 Change parent 버튼을 클릭한 후, Root를 선택합니다. 그 후, 필요한 규칙들을 추가합니다.

비-기본 프로파일이 프로젝트에 적용되었는지 확인하고 싶다면?

모든 프로그래밍 언어는 하나의 기본 품질 프로파일(default로 표기)을 가집니다. 특별한 설정이 없는 경우, 프로그래밍 언어는 해당 언어의 기본 품질 프로파일을 사용해 분석됩니다. 비-기본 프로파일을 사용해 프로젝트를 분석하고자 하는 경우, Quality Profiles 메뉴에서 사용하고자 하는 프로파일을 선택합니다. 인터페이스의 Projects 영역에서 해당 프로파일을 적용할 프로젝트를 선택할 수 있습니다.

내가 만든 프로파일에 필요한 신규 규칙들을 모두 추가했는지 확인하고 싶다면?

Each time a language plugin update is released, new rules are added, but they won't appear automatically in your profile. If you're using a built-in profile such as Sonar way, you can use the Restore Built-in Profiles option to update a built-in profile to what it would be in a fresh install.

If you're not using the default profiles, doing a restore is still a good first step. Then you can compare your profile to the built-in profile to see what new on-by-default rules you're missing.

Another option is to go to the Rules space, and use the Available Since search facet to see what rules have been added to the platform since the day you upgraded the relevant plugin.

And finally, the profile interface itself will help you be aware of rules added in a new plugin version in the Latest New Rules section on the right of the interface.

Compare two profiles?

Starting from the Quality Profiles page, click through on one of the profiles you'd like to compare, then use the Actions > Compare interface to select the second profile and see the differences.

Make sure I don't have any deprecated rules in my profile?

The Deprecated Rules section of the rules interface itself is your first warning that a profile contains deprecated rules. This pink-background section gives the total number of instances of deprecated rules that are currently active in profiles, and a breakdown of deprecated count per profile. A click-through here takes you to the Rules page to edit the profile in question.

Alternately, you can perform a Rules search for the rules in a profile (either manually or by clicking-through from Quality Profiles page) and use the Status rule search facet to narrow the list to the ones that need attention.

Security

The Quality Profiles service can be accessed by any user (even anonymous users). All users can view every aspect of a profile. That means anyone can see which rules are included in a profile, and which ones have been left out, see how a profile has changed over time, and compare the rules in any two profiles.

To make rule profile changes (create, edit or delete) users must be granted the Administer Quality Profiles and Gates permission.

A project administrator can choose which profiles his project is associated with. See Project Settings for more.

  • No labels