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


Java RuleParamType类代码示例

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


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

示例1: init

import org.sonar.api.server.rule.RuleParamType; //导入依赖的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

示例2: loadParameters

import org.sonar.api.server.rule.RuleParamType; //导入依赖的package包/类
private void loadParameters(RulesDefinition.NewRule rule, Field field) {
	org.sonar.check.RuleProperty propertyAnnotation = field.getAnnotation(org.sonar.check.RuleProperty.class);
	if (propertyAnnotation != null) {
		String fieldKey = StringUtils.defaultIfEmpty(propertyAnnotation.key(), field.getName());
		RulesDefinition.NewParam param = rule.createParam(fieldKey)
				.setDescription(propertyAnnotation.description())
				.setDefaultValue(propertyAnnotation.defaultValue());

		if (!StringUtils.isBlank(propertyAnnotation.type())) {
			try {
				param.setType(RuleParamType.parse(propertyAnnotation.type().trim()));
			} catch (IllegalArgumentException e) {
				throw new IllegalArgumentException("Invalid property type [" + propertyAnnotation.type() + "]", e);
			}
		} else {
			param.setType(guessType(field.getType()));
		}
	}
}
 
开发者ID:Cognifide,项目名称:AEM-Rules-for-SonarQube,代码行数:20,代码来源:RulesLoader.java

示例3: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的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

示例4: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的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

示例5: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的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

示例6: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的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

示例7: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的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

示例8: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的package包/类
/**
 * Define the rule.
 *
 * @param repository
 */
public static void define(final NewRepository repository) {
	final NewRule distanceFromMainSequenceRule = repository.createRule(RULE_KEY.rule())
			.setName("Distance from the Main Sequence").setHtmlDescription(
					"The perpendicular distance of a package from the idealized line A + I = 1. This metric is an indicator of the package's balance between abstractness and stability.<br/>"
							+ "A package squarely on the main sequence is optimally balanced with respect to its abstractness and stability. Ideal packages are either completely abstract and stable (x=0, y=1) or completely concrete and instable (x=1, y=0).<br/>"
							+ "The range for this metric is 0 to 100%, with D=0% indicating a package that is coincident with the main sequence and D=100% indicating a package that is as far from the main sequence as possible.");
	distanceFromMainSequenceRule.createParam(PARAM_MAXIMUM).setName(PARAM_MAXIMUM)
			.setDescription("Maximum distance of a package allowed").setType(RuleParamType.INTEGER)
			.setDefaultValue("75");
}
 
开发者ID:willemsrb,项目名称:sonar-jdepend-plugin,代码行数:16,代码来源:DistanceFromMainSequenceRule.java

示例9: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的package包/类
/**
 * Define the rule.
 *
 * @param repository
 */
public static void define(final NewRepository repository) {
	final NewRule packageDependencyCyclesRule = repository.createRule(RULE_KEY.rule())
			.setName("Package Dependency Cycles").setHtmlDescription(
					"Package dependency cycles are reported along with the hierarchical paths of packages participating in package dependency cycles.");
	packageDependencyCyclesRule.createParam(PARAM_MAXIMUM).setName(PARAM_MAXIMUM)
			.setDescription("Maximum number of package dependency cycles allowed").setType(RuleParamType.INTEGER)
			.setDefaultValue("0");
}
 
开发者ID:willemsrb,项目名称:sonar-jdepend-plugin,代码行数:14,代码来源:PackageDependencyCyclesRule.java

示例10: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的package包/类
/**
 * Define the rule.
 *
 * @param repository
 */
public static void define(final NewRepository repository) {
	final NewRule numberOfClassesAndInterfacesRule = repository.createRule(RULE_KEY.rule())
			.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-jdepend-plugin,代码行数:14,代码来源:NumberOfClassesAndInterfacesRule.java

示例11: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的package包/类
/**
 * Define the rule.
 *
 * @param repository
 */
public static void define(final NewRepository repository) {
	final NewRule efferentCouplingsRule = repository.createRule(RULE_KEY.rule()).setName("Efferent Couplings")
			.setHtmlDescription(
					"The number of other packages that the classes in the package depend upon is an indicator of the package's independence.");
	efferentCouplingsRule.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-jdepend-plugin,代码行数:15,代码来源:EfferentCouplingsRule.java

示例12: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的package包/类
/**
 * Define the rule.
 *
 * @param repository
 */
public static void define(final NewRepository repository) {
	final NewRule instabilityRule = repository.createRule(RULE_KEY.rule()).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-jdepend-plugin,代码行数:15,代码来源:InstabilityRule.java

示例13: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的package包/类
/**
 * Define the rule.
 *
 * @param repository
 */
public static void define(final NewRepository repository) {
	final NewRule abstractnessRule = repository.createRule(RULE_KEY.rule()).setName("Abstractness")
			.setHtmlDescription(
					"The ratio of the number of abstract classes (and interfaces) in the analyzed package 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-jdepend-plugin,代码行数:15,代码来源:AbstractnessRule.java

示例14: define

import org.sonar.api.server.rule.RuleParamType; //导入依赖的package包/类
/**
 * Define the rule.
 *
 * @param repository
 */
public static void define(final NewRepository repository) {
	final NewRule afferentCouplingsRule = repository.createRule(RULE_KEY.rule()).setName("Afferent Couplings")
			.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-jdepend-plugin,代码行数:14,代码来源:AfferentCouplingsRule.java

示例15: assertParameterProperties

import org.sonar.api.server.rule.RuleParamType; //导入依赖的package包/类
private void assertParameterProperties(Repository repository) {
  // TooManyLinesInFunctionCheck
  Param max = repository.rule("AvoidAnnotation").param("name");
  assertThat(max).isNotNull();
  assertThat(max.defaultValue()).isEqualTo("Inject");
  assertThat(max.description()).isEqualTo("Name of the annotation to avoid, without the prefix @, for instance 'Override'");
  assertThat(max.type()).isEqualTo(RuleParamType.STRING);
}
 
开发者ID:SonarSource,项目名称:sonar-custom-rules-examples,代码行数:9,代码来源:MyJavaRulesDefinitionTest.java


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