Codota Logo
Constants$Severity
Code IndexAdd Codota to your IDE (free)

How to use
Constants$Severity
in
org.sonar.scanner.protocol

Best Java code snippets using org.sonar.scanner.protocol.Constants$Severity (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: SonarSource/sonarqube

 private static ActiveRule convert(ScannerReport.ActiveRule input, Rule rule) {
  RuleKey key = RuleKey.of(input.getRuleRepository(), input.getRuleKey());
  Map<String, String> params = new HashMap<>(input.getParamsByKeyMap());
  long updatedAt = input.getUpdatedAt();
  return new ActiveRule(key, input.getSeverity().name(), params, updatedAt == 0 ? input.getCreatedAt() : updatedAt, rule.getPluginKey(), emptyToNull(input.getQProfileKey()));
 }
}
origin: SonarSource/sonarqube

.setName(ruleMetadata.getAdHocName())
.setDescription(ruleMetadata.getAdHocDescription())
.setSeverity(Constants.Severity.valueOf(ruleMetadata.getAdHocSeverity()))
.setType(ScannerReport.IssueType.forNumber(ruleMetadata.getAdHocType()))
.build()),
origin: SonarSource/sonarqube

private static ScannerReport.ExternalIssue createReportExternalIssue(ExternalIssue issue, int componentRef) {
 // primary location of an external issue must have a message
 String primaryMessage = issue.primaryLocation().message();
 Severity severity = Severity.valueOf(issue.severity().name());
 IssueType issueType = IssueType.valueOf(issue.type().name());
 ScannerReport.ExternalIssue.Builder builder = ScannerReport.ExternalIssue.newBuilder();
 ScannerReport.IssueLocation.Builder locationBuilder = IssueLocation.newBuilder();
 ScannerReport.TextRange.Builder textRangeBuilder = ScannerReport.TextRange.newBuilder();
 // non-null fields
 builder.setSeverity(severity);
 builder.setType(issueType);
 builder.setEngineId(issue.engineId());
 builder.setRuleId(issue.ruleId());
 builder.setMsg(primaryMessage);
 locationBuilder.setMsg(primaryMessage);
 locationBuilder.setComponentRef(componentRef);
 TextRange primaryTextRange = issue.primaryLocation().textRange();
 if (primaryTextRange != null) {
  builder.setTextRange(toProtobufTextRange(textRangeBuilder, primaryTextRange));
 }
 Long effort = issue.remediationEffort();
 if (effort != null) {
  builder.setEffort(effort);
 }
 applyFlows(builder::addFlow, locationBuilder, textRangeBuilder, issue.flows());
 return builder.build();
}
origin: SonarSource/sonarqube

issue.setSeverity(reportExternalIssue.getSeverity().name());
origin: SonarSource/sonarqube

private static void handleIssue(IssueDto issue, ScannerInput.ServerIssue.Builder issueBuilder, Map<String, String> keysByUUid, OutputStream out) {
 issueBuilder.setKey(issue.getKey());
 String moduleUuid = extractModuleUuid(issue);
 issueBuilder.setModuleKey(keysByUUid.get(moduleUuid));
 ofNullable(issue.getFilePath()).ifPresent(issueBuilder::setPath);
 issueBuilder.setRuleRepository(issue.getRuleRepo());
 issueBuilder.setRuleKey(issue.getRule());
 ofNullable(issue.getChecksum()).ifPresent(issueBuilder::setChecksum);
 ofNullable(issue.getAssigneeUuid()).ifPresent(issueBuilder::setAssigneeLogin);
 ofNullable(issue.getLine()).ifPresent(issueBuilder::setLine);
 ofNullable(issue.getMessage()).ifPresent(issueBuilder::setMsg);
 issueBuilder.setSeverity(org.sonar.scanner.protocol.Constants.Severity.valueOf(issue.getSeverity()));
 issueBuilder.setManualSeverity(issue.isManualSeverity());
 issueBuilder.setStatus(issue.getStatus());
 ofNullable(issue.getResolution()).ifPresent(issueBuilder::setResolution);
 issueBuilder.setType(RuleType.valueOf(issue.getType()).name());
 issueBuilder.setCreationDate(issue.getIssueCreationTime());
 try {
  issueBuilder.build().writeDelimitedTo(out);
 } catch (IOException e) {
  throw new IllegalStateException("Unable to serialize issue", e);
 }
 issueBuilder.clear();
}
origin: org.sonarsource.sonarqube/sonar-server

 private static ActiveRule convert(ScannerReport.ActiveRule input, Rule rule) {
  RuleKey key = RuleKey.of(input.getRuleRepository(), input.getRuleKey());
  Map<String, String> params = new HashMap<>(input.getParamsByKeyMap());
  return new ActiveRule(key, input.getSeverity().name(), params, input.getCreatedAt(), rule.getPluginKey());
 }
}
origin: org.sonarsource.sonarqube/sonar-scanner-engine

@Override
public String severity() {
 return rawIssue.getSeverity().name();
}
origin: org.sonarsource.sonarqube/sonar-scanner-engine

@Override
public void store(DefaultAdHocRule adHocRule) {
 ScannerReportWriter writer = reportPublisher.getWriter();
 final ScannerReport.AdHocRule.Builder builder = ScannerReport.AdHocRule.newBuilder();
 builder.setEngineId(adHocRule.engineId());
 builder.setRuleId(adHocRule.ruleId());
 builder.setName(adHocRule.name());
 String description = adHocRule.description();
 if (description != null) {
  builder.setDescription(description);
 }
 builder.setSeverity(Constants.Severity.valueOf(adHocRule.severity().name()));
 builder.setType(ScannerReport.IssueType.valueOf(adHocRule.type().name()));
 writer.appendAdHocRule(builder.build());
}
origin: org.sonarsource.sonarqube/sonar-scanner-engine

public static TrackedIssue toTrackedIssue(ServerIssue serverIssue, String componentKey) {
 TrackedIssue issue = new TrackedIssue();
 issue.setKey(serverIssue.getKey());
 issue.setStatus(serverIssue.getStatus());
 issue.setResolution(serverIssue.hasResolution() ? serverIssue.getResolution() : null);
 issue.setMessage(serverIssue.hasMsg() ? serverIssue.getMsg() : null);
 issue.setStartLine(serverIssue.hasLine() ? serverIssue.getLine() : null);
 issue.setEndLine(serverIssue.hasLine() ? serverIssue.getLine() : null);
 issue.setSeverity(serverIssue.getSeverity().name());
 issue.setAssignee(serverIssue.hasAssigneeLogin() ? serverIssue.getAssigneeLogin() : null);
 // key in serverIssue might have branch, so don't use it
 issue.setComponentKey(componentKey);
 issue.setCreationDate(new Date(serverIssue.getCreationDate()));
 issue.setRuleKey(RuleKey.of(serverIssue.getRuleRepository(), serverIssue.getRuleKey()));
 issue.setNew(false);
 return issue;
}
origin: org.sonarsource.sonarqube/sonar-scanner-engine

@Override
public void publish(ScannerReportWriter writer) {
 final ScannerReport.ActiveRule.Builder builder = ScannerReport.ActiveRule.newBuilder();
 writer.writeActiveRules(activeRules.findAll().stream()
  .map(DefaultActiveRule.class::cast)
  .map(input -> {
   builder.clear();
   builder.setRuleRepository(input.ruleKey().repository());
   builder.setRuleKey(input.ruleKey().rule());
   builder.setSeverity(Constants.Severity.valueOf(input.severity()));
   builder.setCreatedAt(input.createdAt());
   builder.setUpdatedAt(input.updatedAt());
   builder.setQProfileKey(input.qpKey());
   builder.getMutableParamsByKey().putAll(input.params());
   return builder.build();
  }).collect(toList()));
}
origin: SonarSource/sonarqube

public static TrackedIssue toTrackedIssue(InputComponent component, ScannerReport.Issue rawIssue, @Nullable SourceHashHolder hashes) {
 RuleKey ruleKey = RuleKey.of(rawIssue.getRuleRepository(), rawIssue.getRuleKey());
 Preconditions.checkNotNull(component.key(), "Component key must be set");
 Preconditions.checkNotNull(ruleKey, "Rule key must be set");
 TrackedIssue issue = new TrackedIssue(hashes != null ? hashes.getHashedSource() : null);
 issue.setKey(Uuids.createFast());
 issue.setComponentKey(component.key());
 issue.setRuleKey(ruleKey);
 issue.setGap(rawIssue.getGap() != 0 ? rawIssue.getGap() : null);
 issue.setSeverity(rawIssue.getSeverity().name());
 issue.setMessage(StringUtils.trimToNull(rawIssue.getMsg()));
 issue.setResolution(null);
 issue.setStatus(Issue.STATUS_OPEN);
 issue.setNew(true);
 if (rawIssue.hasTextRange()) {
  TextRange r = rawIssue.getTextRange();
  issue.setStartLine(r.getStartLine());
  issue.setStartLineOffset(r.getStartOffset());
  issue.setEndLine(r.getEndLine());
  issue.setEndLineOffset(r.getEndOffset());
 }
 return issue;
}
origin: org.sonarsource.sonarqube/sonar-scanner-engine

public static TrackedIssue toTrackedIssue(InputComponent component, ScannerReport.Issue rawIssue, @Nullable SourceHashHolder hashes) {
 RuleKey ruleKey = RuleKey.of(rawIssue.getRuleRepository(), rawIssue.getRuleKey());
 Preconditions.checkNotNull(component.key(), "Component key must be set");
 Preconditions.checkNotNull(ruleKey, "Rule key must be set");
 TrackedIssue issue = new TrackedIssue(hashes != null ? hashes.getHashedSource() : null);
 issue.setKey(Uuids.createFast());
 issue.setComponentKey(component.key());
 issue.setRuleKey(ruleKey);
 issue.setGap(rawIssue.getGap() != 0 ? rawIssue.getGap() : null);
 issue.setSeverity(rawIssue.getSeverity().name());
 issue.setMessage(StringUtils.trimToNull(rawIssue.getMsg()));
 issue.setResolution(null);
 issue.setStatus(Issue.STATUS_OPEN);
 issue.setNew(true);
 if (rawIssue.hasTextRange()) {
  TextRange r = rawIssue.getTextRange();
  issue.setStartLine(r.getStartLine());
  issue.setStartLineOffset(r.getStartOffset());
  issue.setEndLine(r.getEndLine());
  issue.setEndLineOffset(r.getEndOffset());
 }
 return issue;
}
origin: SonarSource/sonarqube

@VisibleForTesting
protected void mergeMatched(Tracking<TrackedIssue, ServerIssueFromWs> result, Collection<TrackedIssue> mergeTo, Collection<TrackedIssue> rawIssues) {
 for (Map.Entry<TrackedIssue, ServerIssueFromWs> e : result.getMatchedRaws().entrySet()) {
  org.sonar.scanner.protocol.input.ScannerInput.ServerIssue dto = e.getValue().getDto();
  TrackedIssue tracked = e.getKey();
  // invariant fields
  tracked.setKey(dto.getKey());
  // non-persisted fields
  tracked.setNew(false);
  // fields to update with old values
  tracked.setResolution(dto.hasResolution() ? dto.getResolution() : null);
  tracked.setStatus(dto.getStatus());
  tracked.setAssignee(dto.hasAssigneeLogin() ? dto.getAssigneeLogin() : null);
  tracked.setCreationDate(new Date(dto.getCreationDate()));
  if (dto.getManualSeverity()) {
   // Severity overridden by user
   tracked.setSeverity(dto.getSeverity().name());
  }
  mergeTo.add(tracked);
 }
}
origin: org.sonarsource.sonarqube/sonar-scanner-engine

@VisibleForTesting
protected void mergeMatched(Tracking<TrackedIssue, ServerIssueFromWs> result, Collection<TrackedIssue> mergeTo, Collection<TrackedIssue> rawIssues) {
 for (Map.Entry<TrackedIssue, ServerIssueFromWs> e : result.getMatchedRaws().entrySet()) {
  org.sonar.scanner.protocol.input.ScannerInput.ServerIssue dto = e.getValue().getDto();
  TrackedIssue tracked = e.getKey();
  // invariant fields
  tracked.setKey(dto.getKey());
  // non-persisted fields
  tracked.setNew(false);
  // fields to update with old values
  tracked.setResolution(dto.hasResolution() ? dto.getResolution() : null);
  tracked.setStatus(dto.getStatus());
  tracked.setAssignee(dto.hasAssigneeLogin() ? dto.getAssigneeLogin() : null);
  tracked.setCreationDate(new Date(dto.getCreationDate()));
  if (dto.getManualSeverity()) {
   // Severity overridden by user
   tracked.setSeverity(dto.getSeverity().name());
  }
  mergeTo.add(tracked);
 }
}
origin: SonarSource/sonarqube

private static ScannerReport.Issue createReportIssue(Issue issue, int componentRef, String activeRuleSeverity) {
 String primaryMessage = nullToEmpty(issue.primaryLocation().message());
 org.sonar.api.batch.rule.Severity overriddenSeverity = issue.overriddenSeverity();
 Severity severity = overriddenSeverity != null ? Severity.valueOf(overriddenSeverity.name()) : Severity.valueOf(activeRuleSeverity);
 ScannerReport.Issue.Builder builder = ScannerReport.Issue.newBuilder();
 ScannerReport.IssueLocation.Builder locationBuilder = IssueLocation.newBuilder();
 ScannerReport.TextRange.Builder textRangeBuilder = ScannerReport.TextRange.newBuilder();
 // non-null fields
 builder.setSeverity(severity);
 builder.setRuleRepository(issue.ruleKey().repository());
 builder.setRuleKey(issue.ruleKey().rule());
 builder.setMsg(primaryMessage);
 locationBuilder.setMsg(primaryMessage);
 locationBuilder.setComponentRef(componentRef);
 TextRange primaryTextRange = issue.primaryLocation().textRange();
 if (primaryTextRange != null) {
  builder.setTextRange(toProtobufTextRange(textRangeBuilder, primaryTextRange));
 }
 Double gap = issue.gap();
 if (gap != null) {
  builder.setGap(gap);
 }
 applyFlows(builder::addFlow, locationBuilder, textRangeBuilder, issue.flows());
 return builder.build();
}
origin: SonarSource/sonarlint-core

public Sonarlint.ServerIssue toStorageIssue(ScannerInput.ServerIssue issue, Sonarlint.ProjectConfiguration projectConfiguration) {
 String sqPath = fileKeyToSqPath(projectConfiguration, issue.getModuleKey(), issue.getPath());
 Sonarlint.ServerIssue.Builder builder = Sonarlint.ServerIssue.newBuilder()
  .setAssigneeLogin(issue.getAssigneeLogin())
  .setChecksum(issue.getChecksum())
  .setCreationDate(issue.getCreationDate())
  .setKey(issue.getKey())
  .setLine(issue.getLine())
  .setManualSeverity(issue.getManualSeverity())
  .setModuleKey(issue.getModuleKey())
  .setMsg(issue.getMsg())
  .setPath(sqPath)
  .setResolution(issue.getResolution())
  .setRuleKey(issue.getRuleKey())
  .setRuleRepository(issue.getRuleRepository())
  .setSeverity(issue.getSeverity().name())
  .setStatus(issue.getStatus());
 if (issue.hasType()) {
  // type was added recently
  builder.setType(issue.getType());
 }
 return builder.build();
}
origin: SonarSource/sonarqube

public static TrackedIssue toTrackedIssue(ServerIssue serverIssue, String componentKey) {
 TrackedIssue issue = new TrackedIssue();
 issue.setKey(serverIssue.getKey());
 issue.setStatus(serverIssue.getStatus());
 issue.setResolution(serverIssue.hasResolution() ? serverIssue.getResolution() : null);
 issue.setMessage(serverIssue.hasMsg() ? serverIssue.getMsg() : null);
 issue.setStartLine(serverIssue.hasLine() ? serverIssue.getLine() : null);
 issue.setEndLine(serverIssue.hasLine() ? serverIssue.getLine() : null);
 issue.setSeverity(serverIssue.getSeverity().name());
 issue.setAssignee(serverIssue.hasAssigneeLogin() ? serverIssue.getAssigneeLogin() : null);
 // key in serverIssue might have branch, so don't use it
 issue.setComponentKey(componentKey);
 issue.setCreationDate(new Date(serverIssue.getCreationDate()));
 issue.setRuleKey(RuleKey.of(serverIssue.getRuleRepository(), serverIssue.getRuleKey()));
 issue.setNew(false);
 return issue;
}
origin: org.sonarsource.sonarqube/sonar-server

private static void handleIssue(IssueDto issue, ScannerInput.ServerIssue.Builder issueBuilder, Map<String, String> keysByUUid, OutputStream out) {
 issueBuilder.setKey(issue.getKey());
 String moduleUuid = extractModuleUuid(issue);
 issueBuilder.setModuleKey(keysByUUid.get(moduleUuid));
 setNullable(issue.getFilePath(), issueBuilder::setPath);
 issueBuilder.setRuleRepository(issue.getRuleRepo());
 issueBuilder.setRuleKey(issue.getRule());
 setNullable(issue.getChecksum(), issueBuilder::setChecksum);
 setNullable(issue.getAssigneeUuid(), issueBuilder::setAssigneeLogin);
 setNullable(issue.getLine(), issueBuilder::setLine);
 setNullable(issue.getMessage(), issueBuilder::setMsg);
 issueBuilder.setSeverity(org.sonar.scanner.protocol.Constants.Severity.valueOf(issue.getSeverity()));
 issueBuilder.setManualSeverity(issue.isManualSeverity());
 issueBuilder.setStatus(issue.getStatus());
 setNullable(issue.getResolution(), issueBuilder::setResolution);
 issueBuilder.setType(RuleType.valueOf(issue.getType()).name());
 issueBuilder.setCreationDate(issue.getIssueCreationTime());
 try {
  issueBuilder.build().writeDelimitedTo(out);
 } catch (IOException e) {
  throw new IllegalStateException("Unable to serialize issue", e);
 }
 issueBuilder.clear();
}
origin: SonarSource/sonarqube

@Override
public void publish(ScannerReportWriter writer) {
 final ScannerReport.ActiveRule.Builder builder = ScannerReport.ActiveRule.newBuilder();
 writer.writeActiveRules(activeRules.findAll().stream()
  .map(DefaultActiveRule.class::cast)
  .map(input -> {
   builder.clear();
   builder.setRuleRepository(input.ruleKey().repository());
   builder.setRuleKey(input.ruleKey().rule());
   builder.setSeverity(Constants.Severity.valueOf(input.severity()));
   builder.setCreatedAt(input.createdAt());
   builder.setUpdatedAt(input.updatedAt());
   builder.setQProfileKey(input.qpKey());
   builder.getMutableParamsByKey().putAll(input.params());
   return builder.build();
  }).collect(toList()));
}
origin: org.sonarsource.sonarqube/sonar-scanner-engine

private static ScannerReport.Issue createReportIssue(Issue issue, int componentRef, String activeRuleSeverity) {
 String primaryMessage = nullToEmpty(issue.primaryLocation().message());
 org.sonar.api.batch.rule.Severity overriddenSeverity = issue.overriddenSeverity();
 Severity severity = overriddenSeverity != null ? Severity.valueOf(overriddenSeverity.name()) : Severity.valueOf(activeRuleSeverity);
 ScannerReport.Issue.Builder builder = ScannerReport.Issue.newBuilder();
 ScannerReport.IssueLocation.Builder locationBuilder = IssueLocation.newBuilder();
 ScannerReport.TextRange.Builder textRangeBuilder = ScannerReport.TextRange.newBuilder();
 // non-null fields
 builder.setSeverity(severity);
 builder.setRuleRepository(issue.ruleKey().repository());
 builder.setRuleKey(issue.ruleKey().rule());
 builder.setMsg(primaryMessage);
 locationBuilder.setMsg(primaryMessage);
 locationBuilder.setComponentRef(componentRef);
 TextRange primaryTextRange = issue.primaryLocation().textRange();
 if (primaryTextRange != null) {
  builder.setTextRange(toProtobufTextRange(textRangeBuilder, primaryTextRange));
 }
 Double gap = issue.gap();
 if (gap != null) {
  builder.setGap(gap);
 }
 applyFlows(builder::addFlow, locationBuilder, textRangeBuilder, issue.flows());
 return builder.build();
}
org.sonar.scanner.protocolConstants$Severity

Most used methods

  • name
  • valueOf

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (Timer)
  • orElseThrow (Optional)
  • putExtra (Intent)
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • InetAddress (java.net)
    This class represents an Internet Protocol (IP) address. An IP address is either a 32-bit or 128-bit
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • List (java.util)
    A List is a collection which maintains an ordering for its elements. Every element in the List has a
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now