damianwajser/spring-rest-commons-options

View on GitHub

Showing 356 of 356 total issues

Endpoint has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

@JsonAutoDetect(fieldVisibility = Visibility.ANY)
@JsonPropertyOrder({ "endpoint", "httpMethod", "baseUrl", "relativeUrl" })
public class Endpoint implements Comparable<Endpoint> {
    private static final Logger LOGGER = LoggerFactory.getLogger(Endpoint.class);
    private QueryString queryString;
Severity: Minor
Found in src/main/java/com/github/damianwajser/model/Endpoint.java - About 2 hrs to fix

    Method getField has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private Optional<Field> getField(Class<?> clazz, PropertyDescriptor p) {
            Optional<Field> res = Optional.empty();
            if (clazz != null) {
                try {
                    res = Optional.ofNullable(clazz.getDeclaredField(p.getName()));

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method addEndpoint has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public void addEndpoint(Endpoint e) {
            LOGGER.debug("Añadiendo endpoint: {}", e);
            String[] relatives = e.getUrl().trim().split("/");
            int i = 0;
            String path = "";

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method getResponseSchemma has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private static Optional<JsonSchema> getResponseSchemma(Method m, Class<?> parametrizedClass) {
            Optional<JsonSchema> schemma = Optional.empty();
            // obtengo el tipo real de retorno por si es generic
            Optional<Type> returnType = ReflectionUtils.getRealType(m.getGenericReturnType(), parametrizedClass);
            if (returnType.isPresent()) {
    Severity: Minor
    Found in src/main/java/com/github/damianwajser/utils/JsonSchemmaUtils.java - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method checkIfAddField has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private boolean checkIfAddField(Optional<Field> field, PropertyDescriptor propertyDescriptor, boolean isRequest) {
            boolean res = true;
            if (field.isPresent()) {
                res = !field.get().isAnnotationPresent(JsonIgnore.class);
                if (isRequest) {

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method getCreationStrategy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        public static DetailFieldStrategy getCreationStrategy(Type type, Optional<Class<?>> parametrizedClass) {
            DetailFieldStrategy strategy = null;
            if (type != null) {
                LOGGER.debug("seleccionando strategyField: {}", type.getTypeName());
                if (ParameterizedType.class.isAssignableFrom(type.getClass())

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method collectParameters has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        private static void collectParameters(Collection<Parameters> parameters, Parameter parameter, Annotation a,
                boolean isPathVariable) {
            if (a != null) {
                String typeStr = parameter.getType().getSimpleName();
                Type type = parameter.getParameterizedType();
    Severity: Minor
    Found in src/main/java/com/github/damianwajser/utils/ReflectionUtils.java - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        public static List<Parameters> getPathVariable(Method m) {
            List<Parameters> parameters = new ArrayList<>();
            Arrays.asList(m.getParameters()).forEach(parameter -> {
                PathVariable a = parameter.getAnnotation(PathVariable.class);
                collectParameters(parameters, parameter, a, true);
    src/main/java/com/github/damianwajser/utils/ReflectionUtils.java on lines 138..145

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        public static List<Parameters> getQueryString(Method m) {
            List<Parameters> parameters = new ArrayList<>();
            Arrays.asList(m.getParameters()).forEach(parameter -> {
                RequestParam a = parameter.getAnnotation(RequestParam.class);
                collectParameters(parameters, parameter, a, false);
    src/main/java/com/github/damianwajser/utils/ReflectionUtils.java on lines 172..179

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 56.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method getName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private String getName(PropertyDescriptor field, Optional<Field> optField, boolean isRequest) {
            String name = field.getName();
            if (optField.isPresent()) {
                JsonProperty property = optField.get().getAnnotation(JsonProperty.class);
                if (property != null) {

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        public void addQueryParameters(String name, QueryParameterRaml parameter) {
            if (queryParameters == null)
                queryParameters = new HashMap<>();
            if (!queryParameters.containsKey(name)) {
                queryParameters.put(name, new ArrayList<>());
    src/main/java/com/github/damianwajser/builders/raml/model/ResourceRaml.java on lines 25..32

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 55.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        public void add(String key, Object value) {
            if (resource == null)
                resource = new HashMap<>();
            if (!resource.containsKey(key)) {
                resource.put(key, new ArrayList<>());
    src/main/java/com/github/damianwajser/builders/raml/model/ResourceMethodRaml.java on lines 19..26

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 55.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method getRequestSchemma has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private static Optional<JsonSchema> getRequestSchemma(Method m, Class<?> controller) {
            List<Parameter> p = ReflectionUtils.getParametersBody(m);
            Optional<JsonSchema> schemma = Optional.empty();
            if (!p.isEmpty()) {
                Optional<Type> t = ReflectionUtils.getRealType(p.get(0).getParameterizedType(), controller);
    Severity: Minor
    Found in src/main/java/com/github/damianwajser/utils/JsonSchemmaUtils.java - About 45 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method getClass has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public static Optional<Class<?>> getClass(Type type) {
            Optional<Class<?>> clazz = Optional.empty();
            if (type != null) {
                if (type instanceof Class) {
                    clazz = Optional.of((Class<?>) type);
    Severity: Minor
    Found in src/main/java/com/github/damianwajser/utils/ReflectionUtils.java - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        public Raml(String title, String baseUri, String version) {
            super();
            this.title = title;
            this.baseUri = baseUri;
            this.version = version;
    Severity: Minor
    Found in src/main/java/com/github/damianwajser/builders/raml/Raml.java and 1 other location - About 30 mins to fix
    src/main/java/com/github/damianwajser/model/Parameters.java on lines 17..22

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        public Parameters(boolean required, String name, String type) {
            super();
            this.type = type;
            this.required = required;
            this.name = name;
    Severity: Minor
    Found in src/main/java/com/github/damianwajser/model/Parameters.java and 1 other location - About 30 mins to fix
    src/main/java/com/github/damianwajser/builders/raml/Raml.java on lines 8..13

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 40.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method createDetail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        protected Optional<DetailField> createDetail(PropertyDescriptor descriptor, Optional<Field> f, boolean isRequest) {
            Optional<DetailField> detailField;
            LOGGER.debug("creando property: {}, field: {}, isRequest: {}", descriptor, f, isRequest);
            if (isRequest) {
                Optional<List<Validator>> validators = ValidatorFactory.getValidations(descriptor, f);

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method getGenericParameterStrategy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private static DetailFieldStrategy getGenericParameterStrategy(Type type, Optional<Class<?>> parametrizableClass) {
            DetailFieldStrategy strategy = null;
            // es un tipo generico y tengo que obtener la info de la clasex
            Optional<Type> genericType = Optional.empty();
            if (parametrizableClass.isPresent())

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method getValidator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        private static Optional<Validator> getValidator(Annotation annotation) {
            Validator validator = null;
    
            if (isValidable(annotation)) {
                if (annotation instanceof Range || annotation instanceof Length) {

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Wrong lexicographical order for 'com.fasterxml.jackson.module.jsonSchema.JsonSchema' import. Should be before 'org.slf4j.LoggerFactory'.
    Open

    import com.fasterxml.jackson.module.jsonSchema.JsonSchema;

    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.

    Severity
    Category
    Status
    Source
    Language