modxcms/revolution

View on GitHub
manager/min/lib/JSMin.php

Summary

Maintainability
D
2 days
Test Coverage

Function action has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    protected function action($command)
    {
        if ($command === self::ACTION_DELETE_A_B 
            && $this->b === ' '
            && ($this->a === '+' || $this->a === '-')) {
Severity: Minor
Found in manager/min/lib/JSMin.php - About 4 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 min has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function min()
    {
        if ($this->output !== '') { // min already run
            return $this->output;
        }
Severity: Minor
Found in manager/min/lib/JSMin.php - About 3 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

Method action has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function action($command)
    {
        if ($command === self::ACTION_DELETE_A_B 
            && $this->b === ' '
            && ($this->a === '+' || $this->a === '-')) {
Severity: Major
Found in manager/min/lib/JSMin.php - About 2 hrs to fix

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

        protected function multipleLineComment()
        {
            $this->get();
            $comment = '';
            while (true) {
    Severity: Minor
    Found in manager/min/lib/JSMin.php - 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 min has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function min()
        {
            if ($this->output !== '') { // min already run
                return $this->output;
            }
    Severity: Minor
    Found in manager/min/lib/JSMin.php - About 1 hr to fix

      Function isRegexpLiteral has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function isRegexpLiteral()
          {
              if (false !== strpos("\n{;(,=:[!&|?", $this->a)) { // we aren't dividing
                  return true;
              }
      Severity: Minor
      Found in manager/min/lib/JSMin.php - 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 get has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function get()
          {
              $c = $this->lookAhead;
              $this->lookAhead = null;
              if ($c === null) {
      Severity: Minor
      Found in manager/min/lib/JSMin.php - 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 method.
      Open

              return false;
      Severity: Major
      Found in manager/min/lib/JSMin.php - About 30 mins to fix

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

            protected function singleLineComment()
            {
                $comment = '';
                while (true) {
                    $get = $this->get();
        Severity: Minor
        Found in manager/min/lib/JSMin.php - 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