当前位置: 首页>>代码示例>>Java>>正文


Java Severity类代码示例

本文整理汇总了Java中org.sonar.api.rule.Severity的典型用法代码示例。如果您正苦于以下问题:Java Severity类的具体用法?Java Severity怎么用?Java Severity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Severity类属于org.sonar.api.rule包,在下文中一共展示了Severity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: define

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Override
public void define(Context context) {
  for (Language language : languages.all()) {
    NewRepository repo = context
        .createRepository(getRepositoryName(language.getKey()), language.getKey());
    repo.setName("Coverage evolution");

    repo.createRule(decreasingLineCoverageRule)
        .setName("Line-coverage on files should not decrease")
        .setMarkdownDescription("Reports if the line-coverage on a file has decreased.")
        .setTags("bad-practice")
        .setSeverity(Severity.BLOCKER)
    ;
    repo.createRule(decreasingOverallLineCoverageRule)
        .setName("Project-wide line-coverage should not decrease")
        .setMarkdownDescription("Reports if the line-coverage on the project has decreased.")
        .setTags("bad-practice")
        .setSeverity(Severity.BLOCKER)
    ;

    repo.done();
  }
}
 
开发者ID:AmadeusITGroup,项目名称:sonar-coverage-evolution,代码行数:24,代码来源:CoverageRule.java

示例2: define

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Override
public void define(Context context)
{
    NewRepository repository = context.createRepository(LicenseCheckMetrics.LICENSE_CHECK_KEY, "java");
    repository.setName("License Check");

    repository
        .createRule(LicenseCheckMetrics.LICENSE_CHECK_UNLISTED_KEY)
        .setName("Dependency has unknown license [license-check]")
        .setHtmlDescription("The dependencies license could not be determined!")
        .setSeverity(Severity.BLOCKER);

    repository
        .createRule(LicenseCheckMetrics.LICENSE_CHECK_NOT_ALLOWED_LICENSE_KEY)
        .setName("License is not allowed [license-check]")
        .setHtmlDescription("Violation because the license of the dependency is not allowed.")
        .setSeverity(Severity.BLOCKER);

    repository.done();
}
 
开发者ID:porscheinformatik,项目名称:sonarqube-licensecheck,代码行数:21,代码来源:LicenseCheckRulesDefinition.java

示例3: define

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Override
public void define(final Context context) {
	

	final NewRepository repository = context.createRepository(REPOSITORY_KEY, LANGUAGE_KEY)
			.setName(REPOSITORY_NAME);

	for (final GeneratedProblemType problemType : GeneratedProblemType.values()) {
		final NewRule newRule = repository.createRule(problemType.name());
		newRule.setName(problemType.getPresentationName());
		newRule.setHtmlDescription(problemType.getDescription());
		newRule.setSeverity(Severity.MAJOR);
		newRule.setStatus(RuleStatus.READY);
		newRule.setTags(XANITIZER_TAG, SECURITY_TAG);

		if (problemType.getPresentationName().startsWith("Application Server:")) {
			newRule.addTags(SERVER_CONFIG_TAG);
		}
	}

	repository.done();
}
 
开发者ID:RIGS-IT,项目名称:sonar-xanitizer,代码行数:23,代码来源:XanitizerRulesDefinition.java

示例4: testUpdateCountsMustKeepTrackOfAllUniqueSeveritiesAndIncreaseCountForNewIssues

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Test
public void testUpdateCountsMustKeepTrackOfAllUniqueSeveritiesAndIncreaseCountForNewIssues() {
	List<Issue> issues = new ArrayList<>();
	Map<String, SeverityCount> result = new HashMap<>();

	Issue issue = new DummyIssue(Severity.BLOCKER, true);
	issues.add(issue);
	issues.add(issue);

	SlackMessageBuilder.updateCountsWithIssues(result, issues);

	assertThat(result.size(), is(1));
	assertThat(result.get(Severity.BLOCKER).getTotalCount(), is(2L));
	assertThat(result.get(Severity.BLOCKER).getNewCount(), is(2L));
	assertThat(result.get(Severity.BLOCKER).getResolvedCount(), is(0L));
}
 
开发者ID:Leviter,项目名称:sonar-slack-plugin,代码行数:17,代码来源:SlackMessageBuilderTest.java

示例5: testUpdateCountsMustKeepTrackOfAllUniqueSeveritiesAndIncreaseCountForResolvedIssues

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Test
public void testUpdateCountsMustKeepTrackOfAllUniqueSeveritiesAndIncreaseCountForResolvedIssues() {
	List<Issue> issues = new ArrayList<>();
	List<Issue> resolvedIssues = new ArrayList<>();
	Map<String, SeverityCount> result = new HashMap<>();

	issues.add(new DummyIssue(Severity.BLOCKER, false));
	issues.add(new DummyIssue(Severity.BLOCKER, true));
	resolvedIssues.add(new DummyIssue(Severity.BLOCKER, false));

	SlackMessageBuilder.updateCountsWithIssues(result, issues);
	SlackMessageBuilder.updateCountsWithResolvedIssues(result, resolvedIssues);

	assertThat(result.size(), is(1));
	assertThat(result.get(Severity.BLOCKER).getTotalCount(), is(2L));
	assertThat(result.get(Severity.BLOCKER).getNewCount(), is(1L));
	assertThat(result.get(Severity.BLOCKER).getResolvedCount(), is(1L));
}
 
开发者ID:Leviter,项目名称:sonar-slack-plugin,代码行数:19,代码来源:SlackMessageBuilderTest.java

示例6: init

import org.sonar.api.rule.Severity; //导入依赖的package包/类
/**
 * Initialization.
 *
 * @param repo the repository in which the rules is registered
 */
public static void init(RulesDefinition.NewRepository repo) {
    final RulesDefinition.NewRule rule = repo.createRule(RULE_KEY)
            .setName("The exception should be used in the catch block")
            .setHtmlDescription("The exception is not used, this is rather bad. You should use the exception " +
                    "object in your log, or rethrow it.")
            .addTags("error-handling")
            .setSeverity(Severity.MAJOR)
            .setDebtSubCharacteristic(RulesDefinition.SubCharacteristics.LOGIC_RELIABILITY);

    rule.createParam("exceptions").setType(RuleParamType.STRING)
            .setDescription("List of exceptions which should not be checked")
            .setDefaultValue("" + CaughtExceptionTouchedCheck.EXCLUDED_EXCEPTION_TYPE);

    rule.setDebtRemediationFunction(rule.debtRemediationFunctions().constantPerIssue("10min"));
}
 
开发者ID:Axway,项目名称:sonar-rules,代码行数:21,代码来源:CaughtExceptionTouchedCheck.java

示例7: ruleWithoutDebtRemediation

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Test
public void ruleWithoutDebtRemediation() {
    TsLintRule rule = new TsLintRule(
        "key",
        Severity.MAJOR,
        "name",
        "<html></html>"
    );

    assertEquals("key", rule.key);
    assertEquals(Severity.MAJOR, rule.severity);
    assertEquals("name", rule.name);
    assertEquals("<html></html>", rule.htmlDescription);
    assertEquals(false, rule.hasDebtRemediation);
    assertEquals(DebtRemediationFunction.Type.CONSTANT_ISSUE, rule.debtRemediationFunction);
    assertEquals("0min", rule.debtRemediationScalar);
    assertEquals("0min", rule.debtRemediationOffset);
    assertEquals(null, rule.debtType);
}
 
开发者ID:Pablissimo,项目名称:SonarTsPlugin,代码行数:20,代码来源:TsLintRuleTest.java

示例8: ruleWithDebtRemediation

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Test
public void ruleWithDebtRemediation() {
    TsLintRule rule = new TsLintRule(
        "key",
        Severity.MAJOR,
        "name",
        "<html></html>",
        DebtRemediationFunction.Type.LINEAR_OFFSET,
        "1min",
        "2min",
        RuleType.CODE_SMELL.name()
    );

    assertEquals("key", rule.key);
    assertEquals(Severity.MAJOR, rule.severity);
    assertEquals("name", rule.name);
    assertEquals("<html></html>", rule.htmlDescription);
    assertEquals(true, rule.hasDebtRemediation);
    assertEquals(DebtRemediationFunction.Type.LINEAR_OFFSET, rule.debtRemediationFunction);
    assertEquals("1min", rule.debtRemediationScalar);
    assertEquals("2min", rule.debtRemediationOffset);
    assertEquals(RuleType.CODE_SMELL.name(), rule.debtType);
}
 
开发者ID:Pablissimo,项目名称:SonarTsPlugin,代码行数:24,代码来源:TsLintRuleTest.java

示例9: accept

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Override
public boolean accept(FilterableIssue issue, IssueFilterChain chain) {
  if (disabled) {
    return true;
  }

  IssueKey issueKey = new IssueKey(issue.componentKey(), issue.ruleKey().toString(), issue.line());
  dump.add(issueKey);
  Multiset<IssueKey> componentIssues = getByComponentKey(issueKey.componentKey);
  if (componentIssues.contains(issueKey)) {
    // old issue => no need to persist
    componentIssues.remove(issueKey);
    Preconditions.checkState(Severity.INFO.equals(issue.severity()));
    return false;
  } else {
    // new issue => persist
    different = true;
    differences++;
    return true;
  }
}
 
开发者ID:SonarSource,项目名称:sonar-lits,代码行数:22,代码来源:IssuesChecker.java

示例10: define

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Override
public void define(final NewRepository repository) {
	LOGGER.debug("Defining rule in repostiory {}", repository.key());
	final NewRule afferentCouplingsRule = repository.createRule(RULE_KEY).setType(RuleType.CODE_SMELL)
			.setSeverity(Severity.MAJOR).setName("Afferent Coupling").setHtmlDescription(
					"The number of other packages that depend upon classes within the package is an indicator of the package's responsibility.");
	afferentCouplingsRule.createParam(PARAM_MAXIMUM).setName(PARAM_MAXIMUM)
			.setDescription("Maximum number of other packages allowed to depend upon classes within the package")
			.setType(RuleParamType.INTEGER).setDefaultValue("25");
}
 
开发者ID:willemsrb,项目名称:sonar-packageanalyzer-plugin,代码行数:11,代码来源:AfferentCouplingRule.java

示例11: define

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Override
public void define(final NewRepository repository) {
	LOGGER.debug("Defining rule in repostiory {}", repository.key());
	final NewRule numberOfClassesAndInterfacesRule = repository.createRule(RULE_KEY).setType(RuleType.CODE_SMELL)
			.setSeverity(Severity.MAJOR).setName("Number of Classes and Interfaces").setHtmlDescription(
					"The number of concrete and abstract classes (and interfaces) in the package is an indicator of the extensibility of the package.");
	numberOfClassesAndInterfacesRule.createParam(PARAM_MAXIMUM).setName(PARAM_MAXIMUM)
			.setDescription("Maximum number of classes and interfaces allowed in the package")
			.setType(RuleParamType.INTEGER).setDefaultValue("50");
}
 
开发者ID:willemsrb,项目名称:sonar-packageanalyzer-plugin,代码行数:11,代码来源:NumberOfClassesAndInterfacesRule.java

示例12: define

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Override
public void define(final NewRepository repository) {
	LOGGER.debug("Defining rule in repostiory {}", repository.key());
	final NewRule efferentCouplingRule = repository.createRule(RULE_KEY).setType(RuleType.CODE_SMELL)
			.setSeverity(Severity.MAJOR).setName("Efferent Coupling").setHtmlDescription(
					"The number of other packages that the classes in the package depend upon is an indicator of the package's independence.");
	efferentCouplingRule.createParam(PARAM_MAXIMUM).setName(PARAM_MAXIMUM)
			.setDescription(
					"Maximum number of other packages that the classes in the package are allowed to depend upon")
			.setType(RuleParamType.INTEGER).setDefaultValue("25");
}
 
开发者ID:willemsrb,项目名称:sonar-packageanalyzer-plugin,代码行数:12,代码来源:EfferentCouplingRule.java

示例13: define

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Override
public void define(final NewRepository repository) {
	LOGGER.debug("Defining rule in repostiory {}", repository.key());
	final NewRule instabilityRule = repository.createRule(RULE_KEY).setType(RuleType.CODE_SMELL)
			.setSeverity(Severity.MAJOR).setName("Instability").setHtmlDescription(
					"The ratio of efferent coupling (Ce) to total coupling (Ce + Ca) such that I = Ce / (Ce + Ca). This metric is an indicator of the package's resilience to change.<br/>"
							+ "The range for this metric is 0 to 100%, with I=0% indicating a completely stable package and I=100% indicating a completely instable package.");
	instabilityRule.createParam(PARAM_MAXIMUM).setName(PARAM_MAXIMUM)
			.setDescription("Maximum instability (%) of a package allowed").setType(RuleParamType.INTEGER)
			.setDefaultValue("75");
}
 
开发者ID:willemsrb,项目名称:sonar-packageanalyzer-plugin,代码行数:12,代码来源:InstabilityRule.java

示例14: define

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Override
public void define(final NewRepository repository) {
	LOGGER.debug("Defining rule in repostiory {}", repository.key());
	final NewRule abstractnessRule = repository.createRule(RULE_KEY).setType(RuleType.CODE_SMELL)
			.setSeverity(Severity.MAJOR).setName("Abstractness").setHtmlDescription(
					"The ratio of the number of abstract classes (and interfaces) in the analyzed package compared to the total number of classes in the analyzed package.<br/>"
							+ "The range for this metric is 0% to 100%, with A=0% indicating a completely concrete package and A=100% indicating a completely abstract package.");
	abstractnessRule.createParam(PARAM_MAXIMUM).setName(PARAM_MAXIMUM)
			.setDescription("Maximum abstractness of a package allowed").setType(RuleParamType.INTEGER)
			.setDefaultValue("75");
}
 
开发者ID:willemsrb,项目名称:sonar-packageanalyzer-plugin,代码行数:12,代码来源:AbstractnessRule.java

示例15: define

import org.sonar.api.rule.Severity; //导入依赖的package包/类
@Override
public void define(final NewRepository repository) {
	LOGGER.debug("Defining rule in repostiory {}", repository.key());
	repository.createRule(RULE_KEY).setType(RuleType.CODE_SMELL).setSeverity(Severity.BLOCKER)
			.setName("Missing package-info.java").setHtmlDescription(
					"When a package-info.java file is missing, no issues can be reported on the package level.");
}
 
开发者ID:willemsrb,项目名称:sonar-packageanalyzer-plugin,代码行数:8,代码来源:MissingPackageInfoRule.java


注:本文中的org.sonar.api.rule.Severity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。