sualeh/magnetictrackparser

View on GitHub

Showing 8 of 11 total issues

Method toString has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  @Override
  public String toString() {
    final StringBuilder buffer = new StringBuilder();

    buffer.append("TRACK 1: ");
Severity: Minor
Found in src/main/java/us/fatehi/magnetictrack/BankCardMagneticTrack.java - About 1 hr to fix

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

      @Override
      public String toString() {
        final StringBuilder buffer = new StringBuilder();
    
        buffer.append("TRACK 1: ");
    Severity: Minor
    Found in src/main/java/us/fatehi/magnetictrack/BankCardMagneticTrack.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 from has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public static Track1FormatB from(final String rawTrackData) {
        final Matcher matcher = track1FormatBPattern.matcher(trimToEmpty(rawTrackData));
    
        final String rawTrack1Data;
        final AccountNumber pan;
    Severity: Minor
    Found in src/main/java/us/fatehi/magnetictrack/Track1FormatB.java - About 1 hr to fix

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

        @Override
        public boolean equals(final Object obj) {
          if (this == obj) {
            return true;
          }
      Severity: Minor
      Found in src/main/java/us/fatehi/magnetictrack/BaseBankCardTrackData.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 toBankCard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        public BankCard toBankCard() {
          final AccountNumber pan;
          if (track1.hasAccountNumber()) {
            pan = track1.getAccountNumber();
          } else {
      Severity: Minor
      Found in src/main/java/us/fatehi/magnetictrack/BankCardMagneticTrack.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

      Avoid too many return statements within this method.
      Open

            return false;
      Severity: Major
      Found in src/main/java/us/fatehi/magnetictrack/BaseBankCardTrackData.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

              return false;
        Severity: Major
        Found in src/main/java/us/fatehi/magnetictrack/BaseBankCardTrackData.java - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

              return true;
          Severity: Major
          Found in src/main/java/us/fatehi/magnetictrack/BaseBankCardTrackData.java - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language