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()));

    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 = "";

    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

    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) {

    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

    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())

    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

    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

    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

    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

    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) {

    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

    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

    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

    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

    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) {

    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())

    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);

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

    private static Optional<JsonSchema> getResponseSchemma(Method m, Class<?> parametrizedClass) {
    Severity
    Category
    Status
    Source
    Language