alkal-io/kalium

View on GitHub

Showing 76 of 76 total issues

First sentence of Javadoc is missing an ending period.
Open

    /**

Checks thatJavadoc summary sentence does not contain phrases that are not recommended to use.Summaries that contain only the {@inheritDoc} tag are skipped. Check alsoviolate Javadoc that does not contain first sentence.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Line continuation have incorrect indentation level, expected level should be 4.
Open

 * Created on 20-Jan-2019

Checks the indentation of the continuation lines in block tags.That is whether thecontinued description of at clauses should be indented or not. If the text is not properlyindented it throws a violation. A continuation line is when the description starts/spanspast the line with the tag. Default indentation required is at least 4, but this can bechanged with the help of properties below.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

'if' construct must use '{}'s.
Open

        if (!objectTypeToHandlersMap.containsKey(object.getClass())) return;

Method name 'Builder' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9_]*$'.
Open

    static KaliumBuilder Builder() {

Checks that method names conform to a specified pattern.

Also, checks if a method name has the same name as the residing class.The default is false (it is not allowed). It is legal in Java to havemethod with the same name as a class. As long as a return type is specifiedit is a method and not a constructor which it could be easily confused as.Does not check-style the name of an overridden methods because the developerdoes not have a choice in renaming such methods.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Line is longer than 100 characters (found 121).
Open

            String errorMessage = "No KaliumQueueAdapter is set! No Kalium instance can be built. call setQueueAdapter" +

Checks for long lines.

Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Line continuation have incorrect indentation level, expected level should be 4.
Open

 * Created on 04-May-2019

Checks the indentation of the continuation lines in block tags.That is whether thecontinued description of at clauses should be indented or not. If the text is not properlyindented it throws a violation. A continuation line is when the description starts/spanspast the line with the tag. Default indentation required is at least 4, but this can bechanged with the help of properties below.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Line continuation have incorrect indentation level, expected level should be 4.
Open

 * Created on 20-Jan-2019

Checks the indentation of the continuation lines in block tags.That is whether thecontinued description of at clauses should be indented or not. If the text is not properlyindented it throws a violation. A continuation line is when the description starts/spanspast the line with the tag. Default indentation required is at least 4, but this can bechanged with the help of properties below.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Line continuation have incorrect indentation level, expected level should be 4.
Open

 * Created on 16-Feb-2019

Checks the indentation of the continuation lines in block tags.That is whether thecontinued description of at clauses should be indented or not. If the text is not properlyindented it throws a violation. A continuation line is when the description starts/spanspast the line with the tag. Default indentation required is at least 4, but this can bechanged with the help of properties below.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Line is longer than 100 characters (found 129).
Open

     * <code>start</code> is being called by kalium when kalium starts. Dependencies to the implementing class should be injected

Checks for long lines.

Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Line is longer than 100 characters (found 102).
Open

    private Map<String, Map<Class, List<Method>>> reactionIdToObjectTypeToMethodMap = new HashMap<>();

Checks for long lines.

Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

First sentence of Javadoc is missing an ending period.
Open

/**

Checks thatJavadoc summary sentence does not contain phrases that are not recommended to use.Summaries that contain only the {@inheritDoc} tag are skipped. Check alsoviolate Javadoc that does not contain first sentence.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Line continuation have incorrect indentation level, expected level should be 4.
Open

 * Created on 04-May-2019

Checks the indentation of the continuation lines in block tags.That is whether thecontinued description of at clauses should be indented or not. If the text is not properlyindented it throws a violation. A continuation line is when the description starts/spanspast the line with the tag. Default indentation required is at least 4, but this can bechanged with the help of properties below.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Line continuation have incorrect indentation level, expected level should be 4.
Open

 * Created on 20-Jan-2019

Checks the indentation of the continuation lines in block tags.That is whether thecontinued description of at clauses should be indented or not. If the text is not properlyindented it throws a violation. A continuation line is when the description starts/spanspast the line with the tag. Default indentation required is at least 4, but this can bechanged with the help of properties below.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Line is longer than 100 characters (found 105).
Open

    public <T> void on(Class<T> tClass, Consumer<T> consumer, String reactionId) throws KaliumException {

Checks for long lines.

Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Parameter name 't' must match pattern '^[a-z][a-z0-9][a-zA-Z0-9]*$'.
Open

            public void doSomething(T t) {

Checks that method parameter names conform to a specified pattern.By using accessModifiers property it is possibleto specify different formats for methods at different visibility levels.

To validate catch parameters please useCatchParameterName.

To validate lambda parameters please useLambdaParameterName.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

At-clause should have a non-empty description.
Open

     * @param queueListener

Line is longer than 100 characters (found 109).
Open

        Map<Class, List<Method>> objectTypeToHandlersMap = reactionIdToObjectTypeToMethodMap.get(reactionId);

Checks for long lines.

Rationale: Long lines are hard to read in printouts or if developershave limited screen space for the source code, e.g. if the IDEdisplays additional information like project tree, class hierarchy,etc.

This documentation is written and maintained by the Checkstyle community and is covered under the same license as the Checkstyle project.

Provide the parametrized type for this generic.
Open

    private void validateOnInputs(Class tClass, Consumer consumer, String reactionId) throws KaliumException {

Generic types shouldn't be used raw (without type parameters) in variable declarations or return values. Doing so bypasses generic type checking, and defers the catch of unsafe code to runtime.

Noncompliant Code Example

List myList; // Noncompliant
Set mySet; // Noncompliant

Compliant Solution

List<String> myList;
Set<? extends Number> mySet;

Invoke method(s) only conditionally. Use the built-in formatting to construct this argument.
Open

            logger.log(Level.FINEST, "Posting object: " + object.toString());

Passing message arguments that require further evaluation into a Guava com.google.common.base.Preconditions check can result in a performance penalty. That's because whether or not they're needed, each argument must be resolved before the method is actually called.

Similarly, passing concatenated strings into a logging method can also incur a needless performance hit because the concatenation will be performed every time the method is called, whether or not the log level is low enough to show the message.

Instead, you should structure your code to pass static or pre-computed values into Preconditions conditions check and logging calls.

Specifically, the built-in string formatting should be used instead of string concatenation, and if the message is the result of a method call, then Preconditions should be skipped altogether, and the relevant exception should be conditionally thrown instead.

Noncompliant Code Example

logger.log(Level.DEBUG, "Something went wrong: " + message);  // Noncompliant; string concatenation performed even when log level too high to show DEBUG messages

logger.fine("An exception occurred with message: " + message); // Noncompliant

LOG.error("Unable to open file " + csvPath, e);  // Noncompliant

Preconditions.checkState(a > 0, "Arg must be positive, but got " + a);  // Noncompliant. String concatenation performed even when a > 0

Preconditions.checkState(condition, formatMessage());  // Noncompliant. formatMessage() invoked regardless of condition

Preconditions.checkState(condition, "message: %s", formatMessage());  // Noncompliant

Compliant Solution

logger.log(Level.SEVERE, "Something went wrong: {0} ", message);  // String formatting only applied if needed

logger.fine("An exception occurred with message: {}", message);  // SLF4J, Log4j

logger.log(Level.SEVERE, () -> "Something went wrong: " + message); // since Java 8, we can use Supplier , which will be evaluated lazily

LOG.error("Unable to open file {0}", csvPath, e);

if (LOG.isDebugEnabled() {
  LOG.debug("Unable to open file " + csvPath, e);  // this is compliant, because it will not evaluate if log level is above debug.
}

Preconditions.checkState(arg > 0, "Arg must be positive, but got %d", a);  // String formatting only applied if needed

if (!condition) {
  throw new IllegalStateException(formatMessage());  // formatMessage() only invoked conditionally
}

if (!condition) {
  throw new IllegalStateException("message: " + formatMessage());
}

Exceptions

catch blocks are ignored, because the performance penalty is unimportant on exceptional paths (catch block should not be a part of standard program flow). Getters are ignored as well as methods called on annotations which can be considered as getters. This rule accounts for explicit test-level testing with SLF4J methods isXXXEnabled and ignores the bodies of such if statements.

Add a private constructor to hide the implicit public one.
Open

public class ReflectionUtils {

Utility classes, which are collections of static members, are not meant to be instantiated. Even abstract utility classes, which can be extended, should not have public constructors.

Java adds an implicit public constructor to every class which does not define at least one explicitly. Hence, at least one non-public constructor should be defined.

Noncompliant Code Example

class StringUtils { // Noncompliant

  public static String concatenate(String s1, String s2) {
    return s1 + s2;
  }

}

Compliant Solution

class StringUtils { // Compliant

  private StringUtils() {
    throw new IllegalStateException("Utility class");
  }

  public static String concatenate(String s1, String s2) {
    return s1 + s2;
  }

}

Exceptions

When class contains public static void main(String[] args) method it is not considered as utility class and will be ignored by this rule.

Severity
Category
Status
Source
Language