giganticode/codeprep

View on GitHub
codeprep/api/common.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function create_split_value has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def create_split_value(split_type: str, bpe_codes_id: Optional[str] = None, full_strings: bool = False,
                       split_numbers: bool = False, ronin: bool = False, stem: bool = False):
    if split_type == 'nosplit':
        return 'F' if full_strings else '0'
    elif split_type == 'chars':
Severity: Minor
Found in codeprep/api/common.py - 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

Function create_prep_config has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

def create_prep_config(spl_type: str, bpe_codes_id: Optional[str] = None, no_spaces: bool = False,
Severity: Major
Found in codeprep/api/common.py - About 1 hr to fix

    Function create_split_value has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def create_split_value(split_type: str, bpe_codes_id: Optional[str] = None, full_strings: bool = False,
    Severity: Minor
    Found in codeprep/api/common.py - About 45 mins to fix

      Avoid too many return statements within this function.
      Open

                  return '2'
      Severity: Major
      Found in codeprep/api/common.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return '1'
        Severity: Major
        Found in codeprep/api/common.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return '9'
          Severity: Major
          Found in codeprep/api/common.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return '4'
            Severity: Major
            Found in codeprep/api/common.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return '5'
              Severity: Major
              Found in codeprep/api/common.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return '6'
                Severity: Major
                Found in codeprep/api/common.py - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status