UserSession.get().checkProjectPermission(UserRole.USER, project.getKey());
if (!ruleKey.isManual()) {
throw new IllegalArgumentException("Issues can be created only on rules marked as 'manual': " + ruleKey);
}
Rule rule = getNullableRuleByKey(ruleKey);
if (rule == null) {
throw new IllegalArgumentException("Unknown rule: " + ruleKey);
}
DefaultIssue issue = new DefaultIssueBuilder()
.componentKey(component.getKey())
.projectKey(project.getKey())
.line(line)
.message(!Strings.isNullOrEmpty(message) ? message : rule.getName())
.severity(Objects.firstNonNull(severity, Severity.MAJOR))
.effortToFix(effortToFix)
.ruleKey(ruleKey)
.reporter(UserSession.get().login())
.build();