diff options
author | Pierre <pierre.guillot@sonarsource.com> | 2022-07-08 16:28:19 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-07-12 14:30:04 +0000 |
commit | 201d5326c5e4471a1a77243cd2bd4ac71c9d4ada (patch) | |
tree | 59f2e3c3d101f2c2eec3c09eb55c3fd885b071f8 /server/sonar-webserver-core | |
parent | b7337e90fe3a896367ec2f4dda1684e0a2b177a8 (diff) | |
download | sonarqube-201d5326c5e4471a1a77243cd2bd4ac71c9d4ada.tar.gz sonarqube-201d5326c5e4471a1a77243cd2bd4ac71c9d4ada.zip |
SONAR-16598 Rename generic concept to education principles
Diffstat (limited to 'server/sonar-webserver-core')
-rw-r--r-- | server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java | 14 | ||||
-rw-r--r-- | server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java index b7324ab3a3a..d5898eb455d 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/rule/RegisterRules.java @@ -397,7 +397,7 @@ public class RegisterRules implements Startable { .setIsAdHoc(false) .setCreatedAt(system2.now()) .setUpdatedAt(system2.now()) - .setGenericConcepts(ruleDef.genericConceptKeys()); + .setEducationPrinciples(ruleDef.educationPrincipleKeys()); if (isNotEmpty(ruleDef.htmlDescription())) { ruleDto.setDescriptionFormat(Format.HTML); @@ -443,8 +443,8 @@ public class RegisterRules implements Startable { boolean debtDefinitionsMerged = mergeDebtDefinitions(ruleDef, ruleDto); boolean tagsMerged = mergeTags(ruleDef, ruleDto); boolean securityStandardsMerged = mergeSecurityStandards(ruleDef, ruleDto); - boolean genericConceptsMerged = mergeGenericConcepts(ruleDef, ruleDto); - return ruleMerged || debtDefinitionsMerged || tagsMerged || securityStandardsMerged || genericConceptsMerged; + boolean educationPrinciplesMerged = mergeEducationPrinciples(ruleDef, ruleDto); + return ruleMerged || debtDefinitionsMerged || tagsMerged || securityStandardsMerged || educationPrinciplesMerged; } private boolean mergeRule(RulesDefinition.Rule def, RuleDto dto) { @@ -683,11 +683,11 @@ public class RegisterRules implements Startable { return changed; } - private static boolean mergeGenericConcepts(RulesDefinition.Rule ruleDef, RuleDto dto) { + private static boolean mergeEducationPrinciples(RulesDefinition.Rule ruleDef, RuleDto dto) { boolean changed = false; - if (dto.getGenericConcepts().size() != ruleDef.genericConceptKeys().size() || - !dto.getGenericConcepts().containsAll(ruleDef.genericConceptKeys())) { - dto.setGenericConcepts(ruleDef.genericConceptKeys()); + if (dto.getEducationPrinciples().size() != ruleDef.educationPrincipleKeys().size() || + !dto.getEducationPrinciples().containsAll(ruleDef.educationPrincipleKeys())) { + dto.setEducationPrinciples(ruleDef.educationPrincipleKeys()); changed = true; } return changed; diff --git a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java index 164949cb9e4..58e48f4d2cc 100644 --- a/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java +++ b/server/sonar-webserver-core/src/test/java/org/sonar/server/rule/RegisterRulesTest.java @@ -244,7 +244,7 @@ public class RegisterRulesTest { assertThat(rule.getType()).isEqualTo(RuleType.CODE_SMELL.getDbConstant()); assertThat(rule.getPluginKey()).isEqualTo(FAKE_PLUGIN_KEY); assertThat(rule.isAdHoc()).isFalse(); - assertThat(rule.getGenericConcepts()).containsOnly("concept1", "concept2", "concept3"); + assertThat(rule.getEducationPrinciples()).containsOnly("concept1", "concept2", "concept3"); } @Test @@ -414,7 +414,7 @@ public class RegisterRulesTest { assertThat(rule1.getType()).isEqualTo(RuleType.BUG.getDbConstant()); assertThat(rule1.getCreatedAt()).isEqualTo(DATE1.getTime()); assertThat(rule1.getUpdatedAt()).isEqualTo(DATE2.getTime()); - assertThat(rule1.getGenericConcepts()).containsOnly("concept1","concept4"); + assertThat(rule1.getEducationPrinciples()).containsOnly("concept1","concept4"); } @Test @@ -1209,7 +1209,7 @@ public class RegisterRulesTest { .setType(RuleType.CODE_SMELL) .setStatus(RuleStatus.BETA) .setGapDescription("java.S115.effortToFix") - .addGenericConceptKeys("concept1", "concept2", "concept3"); + .addEducationPrincipleKeys("concept1", "concept2", "concept3"); rule1.setDebtRemediationFunction(rule1.debtRemediationFunctions().linearWithOffset("5d", "10h")); rule1.createParam("param1").setDescription("parameter one").setDefaultValue("default1"); @@ -1248,7 +1248,7 @@ public class RegisterRulesTest { .setType(RuleType.BUG) .setStatus(READY) .setGapDescription("java.S115.effortToFix.v2") - .addGenericConceptKeys("concept1", "concept4"); + .addEducationPrincipleKeys("concept1", "concept4"); rule1.setDebtRemediationFunction(rule1.debtRemediationFunctions().linearWithOffset("6d", "2h")); rule1.createParam("param1").setDescription("parameter one v2").setDefaultValue("default1 v2"); rule1.createParam("param2").setDescription("parameter two v2").setDefaultValue("default2 v2"); @@ -1288,7 +1288,7 @@ public class RegisterRulesTest { .setScope(RuleScope.ALL) .setType(RuleType.CODE_SMELL) .setStatus(RuleStatus.BETA) - .addGenericConceptKeys("concept1", "concept2", "concept3"); + .addEducationPrincipleKeys("concept1", "concept2", "concept3"); repo.createRule(EXTERNAL_HOTSPOT_RULE_KEY.rule()) .setName("Hotspot") |