Tabnine Logo
Severity
Code IndexAdd Tabnine to your IDE (free)

How to use
Severity
in
com.buschmais.jqassistant.core.analysis.api.rule

Best Java code snippets using com.buschmais.jqassistant.core.analysis.api.rule.Severity (Showing top 14 results out of 315)

origin: com.buschmais.jqassistant.core/rule

/**
 * Extract the optional severity of a rule.
 *
 * @param attributes
 *            The attributes of the rule.
 * @param defaultSeverity
 *            The default severity to use if no severity is specified.
 * @return The severity.
 */
private Severity getSeverity(Attributes attributes, Severity defaultSeverity) throws RuleException {
  String severity = attributes.getString(SEVERITY);
  if (severity == null) {
    return defaultSeverity;
  }
  Severity value = Severity.fromValue(severity.toLowerCase());
  return value != null ? value : defaultSeverity;
}
origin: com.buschmais.jqassistant.core/report

/**
 * Writes the severity of the rule.
 *
 * @param severity
 *            The severity the rule has been executed with
 * @throws XMLStreamException
 *             If writing fails.
 */
private void writeSeverity(Severity severity) throws XMLStreamException {
  xmlStreamWriter.writeStartElement("severity");
  xmlStreamWriter.writeAttribute("level", severity.getLevel().toString());
  xmlStreamWriter.writeCharacters(severity.getValue());
  xmlStreamWriter.writeEndElement();
}
origin: com.buschmais.jqassistant.core/rule

/**
 * Return a string representing of the effective severity of a rule.
 *
 * @param effectiveSeverity
 *            The severity to use.
 * @return The string representation.
 */
public String getInfo(Severity effectiveSeverity) {
  StringBuffer result = new StringBuffer(effectiveSeverity.name());
  if (!this.equals(effectiveSeverity)) {
    result.append(" (from ").append(this.name()).append(")");
  }
  return result.toString();
}
origin: com.buschmais.jqassistant.scm/jqassistant.scm.cli

@Override
public void withOptions(final CommandLine options) throws CliConfigurationException {
  super.withOptions(options);
  reportDirectory = getOptionValue(options, CMDLINE_OPTION_REPORTDIR, DEFAULT_REPORT_DIRECTORY);
  severity = Severity.valueOf(getOptionValue(options, CMDLINE_OPTION_SEVERITY, Severity.CRITICAL.name()).toUpperCase());
  executeAppliedConcepts = options.hasOption(CMDLINE_OPTION_EXECUTEAPPLIEDCONCEPTS);
}
origin: com.buschmais.jqassistant.core/report

if (Result.Status.FAILURE.equals(result.getStatus())) {
  ExecutableRule rule = result.getRule();
  String severityInfo = rule.getSeverity().getInfo(result.getSeverity());
  List<String> resultRows = getResultRows(result, logResult);
  boolean warn = warnOnSeverity != null && result.getSeverity().getLevel() <= warnOnSeverity.getLevel();
  boolean fail = failOnSeverity != null && result.getSeverity().getLevel() <= failOnSeverity.getLevel();
  LoggingStrategy loggingStrategy;
  if (fail) {
origin: com.buschmais.jqassistant.core/analysis

@Override
public void visitConstraint(Constraint constraint, Severity effectiveSeverity) throws RuleException {
  analyzerContext.getLogger()
      .info("Validating constraint '" + constraint.getId() + "' with severity: '" + constraint.getSeverity().getInfo(effectiveSeverity) + "'.");
  try {
    analyzerContext.getStore().beginTransaction();
    reportPlugin.beginConstraint(constraint);
    reportPlugin.setResult(execute(constraint, effectiveSeverity));
    reportPlugin.endConstraint();
    analyzerContext.getStore().commitTransaction();
  } catch (XOException e) {
    analyzerContext.getStore().rollbackTransaction();
    throw new RuleException("Cannot validate constraint " + constraint.getId(), e);
  }
}
origin: com.buschmais.jqassistant.core/rule

  /**
   * Converts {@link Severity} to {@link SeverityEnumType}
   *
   * @param severity
   *            {@link Severity}, can be <code>null</code>
   * @param defaultSeverity
   *            default severity level, can be <code>null</code>
   * @return {@link SeverityEnumType}
   */
  private SeverityEnumType getSeverity(Severity severity, Severity defaultSeverity) {
    if (severity == null) {
      severity = defaultSeverity;
    }
    return defaultSeverity != null ? SeverityEnumType.fromValue(severity.getValue()) : null;
  }
}
origin: com.buschmais.jqassistant.plugin/common

if (severity.getLevel() <= failureSeverity.getLevel()) {
  Failure failure = new Failure();
  failure.setMessage(rule.getDescription());
  testcase.getFailure().add(failure);
  failures++;
} else if (severity.getLevel() <= errorSeverity.getLevel()) {
  Error error = new Error();
  error.setMessage(rule.getDescription());
origin: com.buschmais.jqassistant.core/rule

/**
 * Returns string representation of severity values.
 * 
 * @return {@link Severity}
 */
public static String[] names() {
  int i = 0;
  String[] names = new String[Severity.values().length];
  for (Severity severity : Severity.values()) {
    names[i++] = severity.value;
  }
  return names;
}
origin: com.buschmais.jqassistant.core/analysis

@Override
public boolean visitConcept(Concept concept, Severity effectiveSeverity) throws RuleException {
  try {
    analyzerContext.getStore().beginTransaction();
    ConceptDescriptor conceptDescriptor = analyzerContext.getStore().find(ConceptDescriptor.class, concept.getId());
    Result.Status status;
    if (conceptDescriptor == null || configuration.isExecuteAppliedConcepts()) {
      analyzerContext.getLogger()
          .info("Applying concept '" + concept.getId() + "' with severity: '" + concept.getSeverity().getInfo(effectiveSeverity) + "'.");
      reportPlugin.beginConcept(concept);
      Result<Concept> result = execute(concept, effectiveSeverity);
      reportPlugin.setResult(result);
      status = result.getStatus();
      if (conceptDescriptor == null) {
        conceptDescriptor = analyzerContext.getStore().create(ConceptDescriptor.class);
        conceptDescriptor.setId(concept.getId());
        conceptDescriptor.setStatus(status);
      }
      reportPlugin.endConcept();
    } else {
      status = conceptDescriptor.getStatus();
    }
    analyzerContext.getStore().commitTransaction();
    return Result.Status.SUCCESS.equals(status);
  } catch (XOException e) {
    analyzerContext.getStore().rollbackTransaction();
    throw new RuleException("Cannot apply concept " + concept.getId(), e);
  }
}
origin: com.buschmais.jqassistant.plugin/common

private Severity getSeverity(String errorSeverity) throws ReportException {
  try {
    return Severity.fromValue(errorSeverity);
  } catch (RuleException e) {
    throw new ReportException("Cannot parse error severity " + errorSeverity, e);
  }
}
origin: com.buschmais.jqassistant.core/rule

private Map<String, Severity> getGroupElements(Attributes attributes, String attributeName) throws RuleException {
  Map<String, String> references = getReferences(attributes, attributeName);
  Map<String, Severity> result = new HashMap<>();
  for (Map.Entry<String, String> entry : references.entrySet()) {
    String id = entry.getKey();
    String dependencyAttribute = entry.getValue();
    Severity severity = dependencyAttribute != null ? Severity.fromValue(dependencyAttribute.toLowerCase()) : null;
    result.put(id, severity);
  }
  return result;
}
origin: com.buschmais.jqassistant.core/rule

  /**
   * Get the severity.
   *
   * @param severityType
   *            The severity type.
   * @param defaultSeverity
   *            The default severity.
   * @return The severity.
   */
  private Severity getSeverity(SeverityEnumType severityType, Severity defaultSeverity) throws RuleException {
    return severityType == null ? defaultSeverity : Severity.fromValue(severityType.value());
  }
}
origin: com.buschmais.jqassistant.core/rule

private Severity toSeverity(String value, RuleContext context) throws RuleException {
  if (value == null) {
    return getRuleConfiguration().getDefaultConceptSeverity();
  }
  Severity severity = Severity.fromValue(value.toLowerCase());
  return severity != null ? severity : getRuleConfiguration().getDefaultConceptSeverity();
}
com.buschmais.jqassistant.core.analysis.api.ruleSeverity

Javadoc

Represents level of rule violations.

Most used methods

  • fromValue
    Retrieves severity based on string representation.
  • getInfo
    Return a string representing of the effective severity of a rule.
  • getLevel
    Returns violation level
  • getValue
    Returns string representation of severity
  • name
  • equals
  • valueOf
  • values

Popular in Java

  • Start an intent from android
  • getExternalFilesDir (Context)
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now