damianwajser/spring-rest-commons-options

View on GitHub

Showing 13 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

    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

    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

    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

    Severity
    Category
    Status
    Source
    Language