prowide/prowide-core

View on GitHub
src/generated/java/com/prowidesoftware/swift/model/field/Field23.java

Summary

Maintainability
D
1 day
Test Coverage

Field23 has 58 methods (exceeds 20 allowed). Consider refactoring.
Open

@SuppressWarnings("unused")
@Generated
public class Field23 extends Field implements Serializable, CurrencyContainer {
    /**
     * Constant identifying the SRU to which this class belongs to.
Severity: Major
Found in src/generated/java/com/prowidesoftware/swift/model/field/Field23.java - About 1 day to fix

    File Field23.java has 379 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright 2006-2023 Prowide
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
    Severity: Minor
    Found in src/generated/java/com/prowidesoftware/swift/model/field/Field23.java - About 5 hrs to fix

      Method fromJson has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static Field23 fromJson(final String json) {
      
              final Field23 field = new Field23();
      
              final JsonObject jsonObject = JsonParser.parseString(json).getAsJsonObject();

        Avoid too many return statements within this method.
        Open

                return null;
        Severity: Major
        Found in src/generated/java/com/prowidesoftware/swift/model/field/Field23.java - About 30 mins to fix

          Rename method "currency" to prevent any misunderstanding/clash with field "CURRENCY" defined on line 143.
          Open

              public Currency currency() {

          Looking at the set of methods in a class, including superclass methods, and finding two methods or fields that differ only by capitalization is confusing to users of the class. It is similarly confusing to have a method and a field which differ only in capitalization or a method and a field with exactly the same name and visibility.

          In the case of methods, it may have been a mistake on the part of the original developer, who intended to override a superclass method, but instead added a new method with nearly the same name.

          Otherwise, this situation simply indicates poor naming. Method names should be action-oriented, and thus contain a verb, which is unlikely in the case where both a method and a member have the same name (with or without capitalization differences). However, renaming a public method could be disruptive to callers. Therefore renaming the member is the recommended action.

          Noncompliant Code Example

          public class Car{
          
            public DriveTrain drive;
          
            public void tearDown(){...}
          
            public void drive() {...}  // Noncompliant; duplicates field name
          }
          
          public class MyCar extends Car{
            public void teardown(){...}  // Noncompliant; not an override. It it really what's intended?
          
            public void drivefast(){...}
          
            public void driveFast(){...} //Huh?
          }
          

          Compliant Solution

          public class Car{
          
            private DriveTrain drive;
          
            public void tearDown(){...}
          
            public void drive() {...}  // field visibility reduced
          }
          
          public class MyCar extends Car{
            @Override
            public void tearDown(){...}
          
            public void drivefast(){...}
          
            public void driveReallyFast(){...}
          
          }
          

          Define a constant instead of duplicating this literal "code1" 4 times.
          Open

                  result.put(1, "code1");

          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 "code2" 4 times.
          Open

                  result.put(2, "code2");

          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 "currency" 4 times.
          Open

                  result.put(4, "currency");

          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 "code3" 4 times.
          Open

                  result.put(3, "code3");

          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.

          Use already-defined constant 'PARSER_PATTERN' instead of duplicating its value here.
          Open

                  return "S[/S/S[/S]]";

          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.

          There are no issues that match your filters.

          Category
          Status