2 * SonarQube, open source software quality management tool.
3 * Copyright (C) 2008-2013 SonarSource
4 * mailto:contact AT sonarsource DOT com
6 * SonarQube is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * SonarQube is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 package org.sonar.plugins.core.issue.ignore;
23 import org.sonar.api.PropertyType;
24 import org.sonar.api.config.PropertyFieldDefinition;
25 import org.sonar.api.resources.Qualifiers;
26 import org.sonar.api.CoreProperties;
27 import com.google.common.collect.ImmutableList;
28 import org.sonar.api.config.PropertyDefinition;
30 import java.util.List;
32 public final class IgnoreIssuesConfiguration {
34 public static final String CONFIG_DOCUMENTATION_LINK = "More information on the "
35 + "<a href=\"http://docs.codehaus.org/display/SONAR/Project+Administration#ProjectAdministration-IgnoringIssues\">Project Administration page</a>.<br/>";
37 public static final String SUB_CATEGORY_IGNORE_ISSUES = "Issues";
39 public static final String CORE_KEY_PREFIX = "sonar.issue.ignore";
41 public static final String MULTICRITERIA_SUFFIX = ".multicriteria";
42 public static final String PATTERNS_MULTICRITERIA_KEY = CORE_KEY_PREFIX + MULTICRITERIA_SUFFIX;
43 public static final String RESOURCE_KEY = "resourceKey";
44 public static final String RULE_KEY = "ruleKey";
45 public static final String LINE_RANGE_KEY = "lineRange";
47 public static final String BLOCK_SUFFIX = ".block";
48 public static final String PATTERNS_BLOCK_KEY = CORE_KEY_PREFIX + BLOCK_SUFFIX;
49 public static final String BEGIN_BLOCK_REGEXP = "beginBlockRegexp";
50 public static final String END_BLOCK_REGEXP = "endBlockRegexp";
52 public static final String ALLFILE_SUFFIX = ".allfile";
53 public static final String PATTERNS_ALLFILE_KEY = CORE_KEY_PREFIX + ALLFILE_SUFFIX;
54 public static final String FILE_REGEXP = "fileRegexp";
56 private IgnoreIssuesConfiguration() {
57 // static configuration declaration only
60 static final int LARGE_SIZE = 20;
61 static final int SMALL_SIZE = 10;
63 public static List<PropertyDefinition> getPropertyDefinitions() {
64 return ImmutableList.of(
65 PropertyDefinition.builder(PATTERNS_MULTICRITERIA_KEY)
66 .category(CoreProperties.CATEGORY_EXCLUSIONS)
67 .subCategory(SUB_CATEGORY_IGNORE_ISSUES)
68 .name("File Path Pattern")
69 .description("Patterns used to identify which violations to switch off.<br/>" +
70 CONFIG_DOCUMENTATION_LINK)
71 .onQualifiers(Qualifiers.PROJECT)
74 PropertyFieldDefinition.build(RESOURCE_KEY)
75 .name("File Path Pattern")
76 .description("Pattern used to match files which should be ignored")
77 .type(PropertyType.STRING)
78 .indicativeSize(LARGE_SIZE)
80 PropertyFieldDefinition.build(RULE_KEY)
81 .name("Rule Key Pattern")
82 .description("Pattern used to match rules which should be ignored")
83 .type(PropertyType.STRING)
84 .indicativeSize(LARGE_SIZE)
86 PropertyFieldDefinition.build(LINE_RANGE_KEY)
88 .description("Range of lines that should be ignored.")
89 .type(PropertyType.STRING)
90 .indicativeSize(SMALL_SIZE)
93 PropertyDefinition.builder(PATTERNS_BLOCK_KEY)
94 .category(CoreProperties.CATEGORY_EXCLUSIONS)
95 .subCategory(SUB_CATEGORY_IGNORE_ISSUES)
96 .name("Block exclusion patterns")
97 .description("Patterns used to identify blocks in which violations are switched off.<br/>" +
98 CONFIG_DOCUMENTATION_LINK)
99 .onQualifiers(Qualifiers.PROJECT)
102 PropertyFieldDefinition.build(BEGIN_BLOCK_REGEXP)
103 .name("Regular expression for start of block")
104 .description("If this regular expression is found in a file, then following lines are ignored until end of block.")
105 .type(PropertyType.STRING)
106 .indicativeSize(LARGE_SIZE)
108 PropertyFieldDefinition.build(END_BLOCK_REGEXP)
109 .name("Regular expression for end of block")
110 .description("If specified, this regular expression is used to determine the end of code blocks to ignore. If not, then block ends at the end of file.")
111 .type(PropertyType.STRING)
112 .indicativeSize(LARGE_SIZE)
115 PropertyDefinition.builder(PATTERNS_ALLFILE_KEY)
116 .category(CoreProperties.CATEGORY_EXCLUSIONS)
117 .subCategory(SUB_CATEGORY_IGNORE_ISSUES)
118 .name("File exclusion patterns")
119 .description("Patterns used to identify files in which violations are switched off.<br/>" +
120 CONFIG_DOCUMENTATION_LINK)
121 .onQualifiers(Qualifiers.PROJECT)
124 PropertyFieldDefinition.build(FILE_REGEXP)
125 .name("Regular expression")
126 .description("If this regular expression is found in a file, then following lines are ignored.")
127 .type(PropertyType.STRING)
128 .indicativeSize(LARGE_SIZE)