/** * @deprecated replaced by {@link #log(org.sonar.api.utils.log.Logger)} since deprecation of slf4j in 5.1 */ @Deprecated public void log(Logger logger) { for (String error : getErrors()) { logger.error(error); } for (String warning : getWarnings()) { logger.warn(warning); } for (String info : getInfos()) { logger.info(info); } }
private static void processValidationMessages(ValidationMessages messages, QProfileResult result) { checkRequest(messages.getErrors().isEmpty(), messages.getErrors()); result.addWarnings(messages.getWarnings()); result.addInfos(messages.getInfos()); }
@Test public void ignore_deprecated_constant_per_file_function() throws Exception { String xml = getFileContent("ignore_deprecated_constant_per_file_function.xml"); List<RuleDebt> results = underTest.importXML(xml, validationMessages); assertThat(results).isEmpty(); assertThat(validationMessages.getWarnings()).isNotEmpty(); }
@Test public void convert_deprecated_linear_with_threshold_function_by_linear_function() throws Exception { String xml = getFileContent("convert_deprecated_linear_with_threshold_function_by_linear_function.xml"); List<RuleDebt> results = underTest.importXML(xml, validationMessages); assertThat(results).hasSize(1); RuleDebt ruleDebt = results.get(0); assertThat(ruleDebt.function()).isEqualTo(DebtRemediationFunction.Type.LINEAR.name()); assertThat(ruleDebt.coefficient()).isEqualTo("3h"); assertThat(ruleDebt.offset()).isNull(); assertThat(validationMessages.getWarnings()).isNotEmpty(); }
/** * @since 5.1 */ public void log(org.sonar.api.utils.log.Logger logger) { for (String error : getErrors()) { logger.error(error); } for (String warning : getWarnings()) { logger.warn(warning); } for (String info : getInfos()) { logger.info(info); } }
@Test public void import_rules() throws Exception { String xml = getFileContent("import_rules.xml"); List<RuleDebt> results = underTest.importXML(xml, validationMessages); assertThat(results).extracting("ruleKey").containsOnly(RuleKey.of("javasquid", "rule1"), RuleKey.of("javasquid", "rule2")); assertThat(validationMessages.getErrors()).isEmpty(); assertThat(validationMessages.getWarnings()).isEmpty(); }
@Test public void import_rules_with_deprecated_quality_model_format() throws Exception { String xml = getFileContent("import_rules_with_deprecated_quality_model_format.xml"); List<RuleDebt> results = underTest.importXML(xml, validationMessages); assertThat(results).extracting("ruleKey").containsOnly(RuleKey.of("javasquid", "rule1"), RuleKey.of("javasquid", "rule2")); assertThat(validationMessages.getErrors()).isEmpty(); assertThat(validationMessages.getWarnings()).isEmpty(); }
@Test public void importProfileWithUnknownRuleParameter() { ValidationMessages validation = ValidationMessages.create(); RulesProfile profile = parse("importProfileWithUnknownRuleParameter.xml", validation); assertThat(validation.getWarnings()).hasSize(1); ActiveRule rule = profile.getActiveRule("checkstyle", "IllegalRegexp"); assertThat(rule.getParameter("unknown")).isNull(); }
/** * @deprecated replaced by {@link #log(org.sonar.api.utils.log.Logger)} since deprecation of slf4j in 5.1 */ @Deprecated public void log(Logger logger) { for (String error : getErrors()) { logger.error(error); } for (String warning : getWarnings()) { logger.warn(warning); } for (String info : getInfos()) { logger.info(info); } }
/** * @deprecated replaced by {@link #log(org.sonar.api.utils.log.Logger)} since deprecation of slf4j in 5.1 */ @Deprecated public void log(Logger logger) { for (String error : getErrors()) { logger.error(error); } for (String warning : getWarnings()) { logger.warn(warning); } for (String info : getInfos()) { logger.info(info); } }
private static void processValidationMessages(ValidationMessages messages, QProfileResult result) { checkRequest(messages.getErrors().isEmpty(), messages.getErrors()); result.addWarnings(messages.getWarnings()); result.addInfos(messages.getInfos()); }
/** * @since 5.1 */ public void log(org.sonar.api.utils.log.Logger logger) { for (String error : getErrors()) { logger.error(error); } for (String warning : getWarnings()) { logger.warn(warning); } for (String info : getInfos()) { logger.info(info); } }
/** * @since 5.1 */ public void log(org.sonar.api.utils.log.Logger logger) { for (String error : getErrors()) { logger.error(error); } for (String warning : getWarnings()) { logger.warn(warning); } for (String info : getInfos()) { logger.info(info); } }