elboletaire/less-cake-plugin

View on GitHub

Showing 7 of 26 total issues

Function prepareInputFilesForParsing has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    protected function prepareInputFilesForParsing(array $input = [])
    {
        $parse = [];
        foreach ($input as $in) {
            $less = realpath(WWW_ROOT . $in);
Severity: Minor
Found in src/View/Helper/LessHelper.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 setOptions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function setOptions(array $options)
    {
        // @codeCoverageIgnoreStart
        $this->parserDefaults = array_merge($this->parserDefaults, [
            // The import callback ensures that if a file is not found in the
Severity: Minor
Found in src/View/Helper/LessHelper.php - About 1 hr to fix

    Method testLess has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testLess()
        {
            $options = [
                'cache' => false,
                'parser' => ['sourceMap' => false]
    Severity: Minor
    Found in tests/TestCase/View/Helper/LessHelperTest.php - About 1 hr to fix

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

          public function less($less = 'styles.less', array $options = [], array $modifyVars = [])
          {
              $options = $this->setOptions($options);
              $less    = (array)$less;
      
      
      Severity: Minor
      Found in src/View/Helper/LessHelper.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

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

          public function fetch(array $options = [], array $modifyVars = [])
          {
              if (empty($options['overwrite'])) {
                  $options['overwrite'] = true;
              }
      Severity: Minor
      Found in src/View/Helper/LessHelper.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 $this->jsBlock($less, $options);
      Severity: Major
      Found in src/View/Helper/LessHelper.php - About 30 mins to fix

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

            protected function setOptions(array $options)
            {
                // @codeCoverageIgnoreStart
                $this->parserDefaults = array_merge($this->parserDefaults, [
                    // The import callback ensures that if a file is not found in the
        Severity: Minor
        Found in src/View/Helper/LessHelper.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

        Severity
        Category
        Status
        Source
        Language