deps/v8/tools/jsmin.py

Summary

Maintainability
B
4 hrs
Test Coverage

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

  def JSMinify(self, text):
    """The main entry point.  Takes a text and returns a compressed version.

    The compressed version hopefully does the same thing.  Line breaks are
    preserved.
Severity: Minor
Found in deps/v8/tools/jsmin.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 FindNewName has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def FindNewName(self, var_name):
    """Finds a new 1-character or 2-character name for a variable.

    Enters it into the mapping table for this scope.

Severity: Minor
Found in deps/v8/tools/jsmin.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

Avoid too many return statements within this function.
Open

      return up_to_args + "(" + ",".join(map(self.FindNewName, args)) + "){"
Severity: Major
Found in deps/v8/tools/jsmin.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return self.map[matched_text]
    Severity: Major
    Found in deps/v8/tools/jsmin.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return matched_text
      Severity: Major
      Found in deps/v8/tools/jsmin.py - About 30 mins to fix

        Function Declaration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def Declaration(self, m):
            """Rewrites bits of the program selected by a regexp.
        
            These can be curly braces, literal strings, function declarations and var
            declarations.  (These last two must be on one line including the opening
        Severity: Minor
        Found in deps/v8/tools/jsmin.py - 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