tools/closure_linter/closure_linter/common/simplefileflags.py

Summary

Maintainability
B
5 hrs
Test Coverage

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

def FilterFiles(files):
  """Filters the list of files to be linted be removing any excluded files.

  Filters out files excluded using --exclude_files and  --exclude_directories.

Severity: Minor
Found in tools/closure_linter/closure_linter/common/simplefileflags.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 _GetRecursiveFiles has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def _GetRecursiveFiles(suffixes):
  """Returns files to be checked specified by the --recurse flag.

  Args:
    suffixes: Expected suffixes for the file type being checked.
Severity: Minor
Found in tools/closure_linter/closure_linter/common/simplefileflags.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 _GetUserSpecifiedFiles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def _GetUserSpecifiedFiles(argv, suffixes):
  """Returns files to be linted, specified directly on the command line.

  Can handle the '*' wildcard in filenames, but no other wildcards.

Severity: Minor
Found in tools/closure_linter/closure_linter/common/simplefileflags.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

Avoid deeply nested control flow statements.
Open

          if MatchesSuffixes(f, suffixes):
            lint_files.append(os.path.join(root, f))
  return lint_files
Severity: Major
Found in tools/closure_linter/closure_linter/common/simplefileflags.py - About 45 mins to fix

    There are no issues that match your filters.

    Category
    Status