treasure-data/embulk-input-marketo

View on GitHub
src/main/java/org/embulk/input/marketo/CsvTokenizer.java

Summary

Maintainability
F
5 days
Test Coverage

Method nextColumn has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring.
Open

    public String nextColumn()
    {
        if (!hasNextColumn()) {
            throw new TooFewColumnsException("Too few columns");
        }
Severity: Minor
Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 2 days 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

File CsvTokenizer.java has 596 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package org.embulk.input.marketo;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonValue;
import com.google.common.base.Preconditions;
Severity: Major
Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 1 day to fix

    Method nextColumn has 174 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public String nextColumn()
        {
            if (!hasNextColumn()) {
                throw new TooFewColumnsException("Too few columns");
            }
    Severity: Major
    Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 6 hrs to fix

      Method nextLine has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private boolean nextLine(boolean skipEmptyLine)
          {
              while (true) {
                  if (!unreadLines.isEmpty()) {
                      line = unreadLines.removeFirst();
      Severity: Minor
      Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.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 nextColumnOrNull has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public String nextColumnOrNull()
          {
              String v = nextColumn();
              if (nullStringOrNull == null) {
                  if (v.isEmpty()) {
      Severity: Minor
      Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.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

      Avoid too many return statements within this method.
      Open

                              return "";
      Severity: Major
      Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                                    return quotedValue.toString();
        Severity: Major
        Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                                      return line.substring(valueStartPos, valueEndPos);
          Severity: Major
          Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                    return quotedValue.toString();
            Severity: Major
            Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return "";
              Severity: Major
              Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                            return line.substring(valueStartPos, valueEndPos);
                Severity: Major
                Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                          return line.substring(valueStartPos, valueEndPos);
                  Severity: Major
                  Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                                return line.substring(valueStartPos, linePos - 1);
                    Severity: Major
                    Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                                  return value;
                      Severity: Major
                      Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                                    return quotedValue.toString();
                        Severity: Major
                        Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                                      return "";
                          Severity: Major
                          Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                                    return line.substring(valueStartPos, linePos);
                            Severity: Major
                            Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java - About 30 mins to fix

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

                                                  if (isDelimiter(c)) {
                                                      // empty value
                                                      if (delimiterFollowingString == null) {
                                                          return "";
                                                      }
                              Severity: Minor
                              Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java and 1 other location - About 35 mins to fix
                              src/main/java/org/embulk/input/marketo/CsvTokenizer.java on lines 284..294

                              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 44.

                              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

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

                                                  if (isDelimiter(c)) {
                                                      // empty value
                                                      if (delimiterFollowingString == null) {
                                                          return "";
                                                      }
                              Severity: Minor
                              Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java and 1 other location - About 35 mins to fix
                              src/main/java/org/embulk/input/marketo/CsvTokenizer.java on lines 253..263

                              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 44.

                              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

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

                                      @Override
                                      public boolean equals(Object obj)
                                      {
                                          if (!(obj instanceof QuoteCharacter)) {
                                              return false;
                              Severity: Minor
                              Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java and 1 other location - About 30 mins to fix
                              src/main/java/org/embulk/input/marketo/CsvTokenizer.java on lines 687..695

                              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

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

                                      @Override
                                      public boolean equals(Object obj)
                                      {
                                          if (!(obj instanceof EscapeCharacter)) {
                                              return false;
                              Severity: Minor
                              Found in src/main/java/org/embulk/input/marketo/CsvTokenizer.java and 1 other location - About 30 mins to fix
                              src/main/java/org/embulk/input/marketo/CsvTokenizer.java on lines 635..643

                              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

                              There are no issues that match your filters.

                              Category
                              Status