Skip to content

Commit

Permalink
fixed broken file formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
dtbaum committed Jul 27, 2023
1 parent 5b46de3 commit 41d43e7
Showing 1 changed file with 23 additions and 39 deletions.
62 changes: 23 additions & 39 deletions src/main/java/edu/hm/hafner/analysis/Severity.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Severity of an issue. The predefined set of severities consists of an error
* and 3 warnings with priorities high,
* normal, or low. Additional severities can be created if this set of
* severities is not sufficient. Note that new
* instances are not cached by this class so that there might exist several
* severity instances with the same name.
* Severity of an issue. The predefined set of severities consists of an error and 3 warnings with priorities high,
* normal, or low. Additional severities can be created if this set of severities is not sufficient. Note that new
* instances are not cached by this class so that there might exist several severity instances with the same name.
*
* @author Ullrich Hafner
*/
Expand All @@ -33,32 +30,22 @@ public class Severity implements Serializable {

/** An error, e.g. a compile error. */
public static final Severity ERROR = new Severity("ERROR");
/**
* A warning with priority high. Mapping of warning priorities is determined by
* the corresponding tool.
*/
/** A warning with priority high. Mapping of warning priorities is determined by the corresponding tool. */
public static final Severity WARNING_HIGH = new Severity("HIGH");
/**
* A warning with priority normal. Mapping of warning priorities is determined
* by the corresponding tool.
*/
/** A warning with priority normal. Mapping of warning priorities is determined by the corresponding tool. */
public static final Severity WARNING_NORMAL = new Severity("NORMAL");
/**
* A warning with priority low. Mapping of warning priorities is determined by
* the corresponding tool.
*/
/** A warning with priority low. Mapping of warning priorities is determined by the corresponding tool. */
public static final Severity WARNING_LOW = new Severity("LOW");

private static final Set<Severity> ALL_SEVERITIES = Collections.unmodifiableSet(new LinkedHashSet<>(
Arrays.asList(ERROR, WARNING_HIGH, WARNING_NORMAL, WARNING_LOW)));
Arrays.asList(ERROR, WARNING_HIGH, WARNING_NORMAL, WARNING_LOW)));

/**
* Creates a new {@link Severity} with the specified name. If the name is the
* same as the name of one of the
* Creates a new {@link Severity} with the specified name. If the name is the same as the name of one of the
* predefined severities, then this existing severity is returned.
*
* @param name
* the name of the severity
* the name of the severity
*
* @return the severity
*/
Expand All @@ -79,15 +66,13 @@ public static Severity valueOf(final String name) {
}

/**
* Converts a String severity to one of the predefined severities. If the
* provided String does not match then the default
* Converts a String severity to one of the predefined severities. If the provided String does not match then the default
* severity will be returned.
*
* @param severity
* priority as a String
* priority as a String
* @param defaultValue
* default severity, if the specified String is {@code null}
* or is not a valid {@link Severity} name
* default severity, if the specified String is {@code null} or is not a valid {@link Severity} name
*
* @return enumeration value
*/
Expand All @@ -101,12 +86,11 @@ public static Severity valueOf(@CheckForNull final String severity, final Severi
}

/**
* Converts a String severity to one of the predefined severities. If the
* provided String does not match (even
* Converts a String severity to one of the predefined severities. If the provided String does not match (even
* partly) then the default severity will be returned.
*
* @param severity
* the severity string
* the severity string
*
* @return mapped level.
*/
Expand All @@ -127,11 +111,10 @@ public static Severity guessFromString(@CheckForNull final String severity) {
}

/**
* Gets the severities starting from the specified severity to
* {@link Severity#ERROR}.
* Gets the severities starting from the specified severity to {@link Severity#ERROR}.
*
* @param minimumSeverity
* the minimum priority
* the minimum priority
*
* @return the priorities starting from the specified priority
*/
Expand All @@ -140,10 +123,12 @@ public static Collection<Severity> collectSeveritiesFrom(final Severity minimumS
priorities.add(Severity.ERROR);
if (WARNING_HIGH.equals(minimumSeverity)) {
priorities.add(WARNING_HIGH);
} else if (WARNING_NORMAL.equals(minimumSeverity)) {
}
else if (WARNING_NORMAL.equals(minimumSeverity)) {
priorities.add(WARNING_HIGH);
priorities.add(WARNING_NORMAL);
} else if (WARNING_LOW.equals(minimumSeverity)) {
}
else if (WARNING_LOW.equals(minimumSeverity)) {
priorities.add(WARNING_HIGH);
priorities.add(WARNING_NORMAL);
priorities.add(WARNING_LOW);
Expand All @@ -167,7 +152,7 @@ public static Set<Severity> getPredefinedValues() {
* Creates a new {@link Severity} with the specified name.
*
* @param name
* the name of the severity
* the name of the severity
*/
public Severity(final String name) {
Ensure.that(name).isNotBlank();
Expand All @@ -193,10 +178,9 @@ public String toString() {
* Checks if this instance has a name that is equal to the specified name.
*
* @param severityName
* the name to check
* the name to check
*
* @return {@code true} if this instance has the same name, {@code false}
* otherwise
* @return {@code true} if this instance has the same name, {@code false} otherwise
*/
public boolean equalsIgnoreCase(final String severityName) {
return IssueParser.equalsIgnoreCase(getName(), severityName);
Expand Down

0 comments on commit 41d43e7

Please sign in to comment.