fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/parser/ExcelParser.java

Summary

Maintainability
F
3 days
Test Coverage

Method parseSheet has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
Open

    public ExcelSheet parseSheet(CharSequence stringFile, CharSequence sheetFile) {
        ExcelSheet data = new ExcelSheet();
        SimpleKeyValueList<String, ExcelCell> cells = new SimpleKeyValueList<String, ExcelCell>();
        SimpleKeyValueList<String, String> mergeCellPos = new SimpleKeyValueList<String, String>();

Severity: Minor
Found in src/main/java/de/uniks/networkparser/parser/ExcelParser.java - About 1 day 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 parseSheet has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public ExcelSheet parseSheet(CharSequence stringFile, CharSequence sheetFile) {
        ExcelSheet data = new ExcelSheet();
        SimpleKeyValueList<String, ExcelCell> cells = new SimpleKeyValueList<String, ExcelCell>();
        SimpleKeyValueList<String, String> mergeCellPos = new SimpleKeyValueList<String, String>();

Severity: Major
Found in src/main/java/de/uniks/networkparser/parser/ExcelParser.java - About 3 hrs to fix

    File ExcelParser.java has 281 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    package de.uniks.networkparser.parser;
    
    import de.uniks.networkparser.DateTimeEntity;
    import de.uniks.networkparser.EntityCreator;
    import de.uniks.networkparser.EntityUtil;
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/parser/ExcelParser.java - About 2 hrs to fix

      Method readCSV has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          public SimpleList<Object> readCSV(Buffer data, SendableEntityCreator creator) {
              SimpleList<Object> result = new SimpleList<Object>();
              if (data == null || creator == null) {
                  return result;
              }
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/parser/ExcelParser.java - About 2 hrs 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 readCSV has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public SimpleList<Object> readCSV(Buffer data, SendableEntityCreator creator) {
              SimpleList<Object> result = new SimpleList<Object>();
              if (data == null || creator == null) {
                  return result;
              }
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/parser/ExcelParser.java - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                if (CELL_TYPE_REFERENCE.equalsIgnoreCase(excelCell.getType())) {
                                    /* <v>2</v> */
                                    EntityList element = cell.getChild(0);
                                    if (element != null) {
                                        String ref = ((XMLEntity) element).getValue();
        Severity: Major
        Found in src/main/java/de/uniks/networkparser/parser/ExcelParser.java - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (item == null || item.x < 0 || item.y < 0) {
                                      continue;
                                  }
          Severity: Major
          Found in src/main/java/de/uniks/networkparser/parser/ExcelParser.java - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (CELL.equalsIgnoreCase(cell.getTag()) == false) {
                                        continue;
                                    }
            Severity: Major
            Found in src/main/java/de/uniks/networkparser/parser/ExcelParser.java - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (item == null || item instanceof ExcelCell == false) {
                                          continue;
                                      }
              Severity: Major
              Found in src/main/java/de/uniks/networkparser/parser/ExcelParser.java - About 45 mins to fix

                Method writeCSV has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public CharacterBuffer writeCSV(SimpleList<SimpleList<ExcelCell>> data) {
                        CharacterBuffer result = new CharacterBuffer();
                        if (data == null) {
                            return result;
                        }
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/parser/ExcelParser.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 getHeaderWorkbook has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private String getHeaderWorkbook(ExcelWorkBook content, int id) {
                        CharacterBuffer data = new CharacterBuffer().with(HEADER);
                        data.with(
                                "<workbook xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\">\r\n    <sheets>\r\n");
                        for (int i = 0; i < content.size(); i++) {
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/parser/ExcelParser.java - About 25 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

                There are no issues that match your filters.

                Category
                Status