red6/dmn-check

View on GitHub
server/src/main/java/de/redsix/dmncheck/server/ValidationServer.java

Summary

Maintainability
A
1 hr
Test Coverage

Method main has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static void main(String[] args) {
        final ValidationServer validationServer = new ValidationServer();

        final Logger logger = LoggerFactory.getLogger(ValidationServer.class);

    Define a constant instead of duplicating this literal "message" 3 times.
    Open

                                                    "message",

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    public void run() {
      prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
      execute("action1");
      release("action1");
    }
    
    @SuppressWarning("all")                            // Compliant - annotations are excluded
    private void method1() { /* ... */ }
    @SuppressWarning("all")
    private void method2() { /* ... */ }
    
    public String method3(String a) {
      System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
      return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
    }
    

    Compliant Solution

    private static final String ACTION_1 = "action1";  // Compliant
    
    public void run() {
      prepare(ACTION_1);                               // Compliant
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Define a constant instead of duplicating this literal "items" 3 times.
    Open

                                    "items",

    Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

    On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

    Noncompliant Code Example

    With the default threshold of 3:

    public void run() {
      prepare("action1");                              // Noncompliant - "action1" is duplicated 3 times
      execute("action1");
      release("action1");
    }
    
    @SuppressWarning("all")                            // Compliant - annotations are excluded
    private void method1() { /* ... */ }
    @SuppressWarning("all")
    private void method2() { /* ... */ }
    
    public String method3(String a) {
      System.out.println("'" + a + "'");               // Compliant - literal "'" has less than 5 characters and is excluded
      return "";                                       // Compliant - literal "" has less than 5 characters and is excluded
    }
    

    Compliant Solution

    private static final String ACTION_1 = "action1";  // Compliant
    
    public void run() {
      prepare(ACTION_1);                               // Compliant
      execute(ACTION_1);
      release(ACTION_1);
    }
    

    Exceptions

    To prevent generating some false-positives, literals having less than 5 characters are excluded.

    Extra separation in import group before 'com.beust.jcommander.JCommander'
    Open

    import com.beust.jcommander.JCommander;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'java.io.ByteArrayInputStream' import. Should be before 'spark.Spark.post'.
    Open

    import java.io.ByteArrayInputStream;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'org.slf4j.LoggerFactory' import. Should be before 'spark.Spark.post'.
    Open

    import org.slf4j.LoggerFactory;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'com.beust.jcommander.Parameter' import. Should be before 'spark.Spark.post'.
    Open

    import com.beust.jcommander.Parameter;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'de.redsix.dmncheck.util.ValidatorLoader' import. Should be before 'spark.Spark.post'.
    Open

    import de.redsix.dmncheck.util.ValidatorLoader;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'org.camunda.bpm.model.dmn.DmnModelException' import. Should be before 'spark.Spark.post'.
    Open

    import org.camunda.bpm.model.dmn.DmnModelException;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'org.apache.commons.lang3.exception.ExceptionUtils' import. Should be before 'spark.Spark.post'.
    Open

    import org.apache.commons.lang3.exception.ExceptionUtils;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

    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 101).
    Open

                    FieldUtils.writeField(Dmn.INSTANCE, "dmnParser", new NonValidatingDmnParser(), true);

    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.

    Wrong lexicographical order for 'javax.annotation.Nullable' import. Should be before 'spark.Spark.post'.
    Open

    import javax.annotation.Nullable;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'java.nio.charset.StandardCharsets' import. Should be before 'spark.Spark.post'.
    Open

    import java.nio.charset.StandardCharsets;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'org.apache.commons.lang3.reflect.FieldUtils' import. Should be before 'spark.Spark.post'.
    Open

    import org.apache.commons.lang3.reflect.FieldUtils;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'org.slf4j.Logger' import. Should be before 'spark.Spark.post'.
    Open

    import org.slf4j.Logger;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'java.util.Collections' import. Should be before 'spark.Spark.post'.
    Open

    import java.util.Collections;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'org.json.JSONObject' import. Should be before 'spark.Spark.post'.
    Open

    import org.json.JSONObject;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

    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 119).
    Open

                    // Do not validate against the xml schema now. Errors from the xml validation are hard to map back into

    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 119).
    Open

                                    Collections.singleton(new JSONObject().put("message", nullsafeError(e.getMessage()))));

    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.

    Wrong lexicographical order for 'de.redsix.dmncheck.result.ValidationResult' import. Should be before 'spark.Spark.post'.
    Open

    import de.redsix.dmncheck.result.ValidationResult;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'java.util.stream.Collectors' import. Should be before 'spark.Spark.post'.
    Open

    import java.util.stream.Collectors;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'org.camunda.bpm.model.dmn.Dmn' import. Should be before 'spark.Spark.post'.
    Open

    import org.camunda.bpm.model.dmn.Dmn;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'org.camunda.bpm.model.dmn.DmnModelInstance' import. Should be before 'spark.Spark.post'.
    Open

    import org.camunda.bpm.model.dmn.DmnModelInstance;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'com.beust.jcommander.JCommander' import. Should be before 'spark.Spark.post'.
    Open

    import com.beust.jcommander.JCommander;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'java.util.List' import. Should be before 'spark.Spark.post'.
    Open

    import java.util.List;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'org.camunda.bpm.model.xml.instance.ModelElementInstance' import. Should be before 'spark.Spark.post'.
    Open

    import org.camunda.bpm.model.xml.instance.ModelElementInstance;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'java.util.Optional' import. Should be before 'spark.Spark.post'.
    Open

    import java.util.Optional;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

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

    Wrong lexicographical order for 'org.camunda.bpm.model.dmn.instance.DrgElement' import. Should be before 'spark.Spark.post'.
    Open

    import org.camunda.bpm.model.dmn.instance.DrgElement;

    Checks that the groups of import declarations appear in the order specifiedby the user. If there is an import but its group is not specified in theconfiguration such an import should be placed at the end of the import list.

    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 111).
    Open

                    final List<ValidationResult> validationResults = validationServer.runValidators(modelInstance);

    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.

    There are no issues that match your filters.

    Category
    Status