public NewAdHocRule(ScannerReport.ExternalIssue fromIssue) { Preconditions.checkArgument(isNotBlank(fromIssue.getEngineId()), "'engine id' not expected to be null for an ad hoc rule"); Preconditions.checkArgument(isNotBlank(fromIssue.getRuleId()), "'rule id' not expected to be null for an ad hoc rule"); this.key = RuleKey.of(RuleKey.EXTERNAL_RULE_REPO_PREFIX + fromIssue.getEngineId(), fromIssue.getRuleId()); this.engineId = fromIssue.getEngineId(); this.ruleId = fromIssue.getRuleId(); this.name = null; this.description = null; this.severity = null; this.ruleType = null; this.hasDetails = false; }
assertThat(issue.getMsg()).isEqualTo("fix the issue here"); assertThat(issue.getEngineId()).isEqualTo("externalXoo"); assertThat(issue.getRuleId()).isEqualTo("rule1"); assertThat(issue.getSeverity()).isEqualTo(Severity.MAJOR); assertThat(issue.getEffort()).isEqualTo(50l); assertThat(issue.getMsg()).isEqualTo("fix the bug here"); assertThat(issue.getEngineId()).isEqualTo("externalXoo"); assertThat(issue.getRuleId()).isEqualTo("rule2"); assertThat(issue.getSeverity()).isEqualTo(Severity.CRITICAL); assertThat(issue.getType()).isEqualTo(IssueType.BUG); assertThat(issue.getMsg()).isEqualTo("fix the bug here"); assertThat(issue.getEngineId()).isEqualTo("externalXoo"); assertThat(issue.getRuleId()).isEqualTo("rule3"); assertThat(issue.getSeverity()).isEqualTo(Severity.MAJOR); assertThat(issue.getType()).isEqualTo(IssueType.BUG);
init(issue); RuleKey ruleKey = RuleKey.of(RuleKey.EXTERNAL_RULE_REPO_PREFIX + reportExternalIssue.getEngineId(), reportExternalIssue.getRuleId()); issue.setRuleKey(ruleKey); if (reportExternalIssue.hasTextRange()) {