Kuangcp/mythpoi

View on GitHub

Showing 5 of 12 total issues

Method loadCellValue has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public static void loadCellValue(CellType type, Field colField, Object target, HSSFCell cell)
      throws IllegalAccessException, ParseException {
    String fieldType = colField.getType().getSimpleName();

    switch (type) {
Severity: Minor
Found in src/main/java/com/kuangcp/mythpoi/excel/util/ExcelUtil.java - About 1 hr to fix

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

      public static void loadCellValue(CellType type, Field colField, Object target, HSSFCell cell)
          throws IllegalAccessException, ParseException {
        String fieldType = colField.getType().getSimpleName();
    
        switch (type) {
    Severity: Minor
    Found in src/main/java/com/kuangcp/mythpoi/excel/util/ExcelUtil.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 getContentByMetas has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      private static List<Object[]> getContentByMetas(Class target, List<ExcelCellMeta> metaData,
          List<? extends ExcelTransform> originData) throws Exception {
        // 说明类里没有注解了的字段
        if (metaData.size() == 0) {
          return null;
    Severity: Minor
    Found in src/main/java/com/kuangcp/mythpoi/utils/base/ReadAnnotationUtil.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

    Method mapFieldAndTitle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      private static String[] mapFieldAndTitle(int colNum, HSSFRow row,
          List<ExcelCellMeta> metaList) {
        String[] titleList = new String[colNum];
        for (int i = 0; i < colNum; i++) {
          String temp = row.getCell(i).getStringCellValue();
    Severity: Minor
    Found in src/main/java/com/kuangcp/mythpoi/excel/ExcelImport.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

    Method getCellMetaData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      public static List<ExcelCellMeta> getCellMetaData(Class target) {
        List<ExcelCellMeta> list = new ArrayList<>();
        final Field[] fields = target.getDeclaredFields();
        for (Field field : fields) {
          if (field.isAnnotationPresent(ExcelConfig.class)) {
    Severity: Minor
    Found in src/main/java/com/kuangcp/mythpoi/utils/base/ReadAnnotationUtil.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

    Severity
    Category
    Status
    Source
    Language