ulikoehler/UliEngineering

View on GitHub
UliEngineering/Utils/Files.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function list_recursive has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def list_recursive(directory, relative=False, files_only=True):
    """
    List a directory recursively, yielding each filename
    (with the filename being relative to the directory).
    
Severity: Minor
Found in UliEngineering/Utils/Files.py - 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

Function extract_numeric_column has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def extract_numeric_column(flo, isline=__standard_isline, postproc=functoolz.identity,
Severity: Major
Found in UliEngineering/Utils/Files.py - About 50 mins to fix

    Function extract_column has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def extract_column(flo, isline=__standard_isline, preproc=_strip_newline,
    Severity: Minor
    Found in UliEngineering/Utils/Files.py - About 35 mins to fix

      Function extract_column has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def extract_column(flo, isline=__standard_isline, preproc=_strip_newline,
                         postproc=functoolz.identity, extractcol=_csv_firstcol):
          """
          Lazily extract a column from a file, for example extract a column from a CSV file.
          The values are run through a postprocessing function and placed in a list which is returned.
      Severity: Minor
      Found in UliEngineering/Utils/Files.py - 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

      There are no issues that match your filters.

      Category
      Status