phug-php/phug

View on GitHub

Showing 115 of 115 total issues

Method getErrorAsHtml has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function getErrorAsHtml($error, $parameters, $data)
    {
        $sandBox = new SandBox(function () use (
            $error,
            $parameters,
Severity: Minor
Found in src/Phug/Renderer/Renderer/Partial/Debug/DebuggerTrait.php - About 1 hr to fix

    Method getProcesses has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function getProcesses($list, $link, $index, $duration, $maxSpace, $lineHeight, $timePrecision)
        {
            $count = count($list);
            for ($i = $count > 1 ? 1 : 0; $i < $count; $i++) {
                /** @var Event $previousEvent */
    Severity: Minor
    Found in src/Phug/Renderer/Renderer/Profiler/Profile.php - About 1 hr to fix

      Function handleError has a Cognitive Complexity of 11 (exceeds 7 allowed). Consider refactoring.
      Open

          public function handleError($error, $code, $path, $source, $parameters, $options)
          {
              /* @var \Throwable $error */
              $exception = $options['debug']
                  ? $this->getDebuggedException($error, $code, $source, $path, $parameters, $options)
      Severity: Minor
      Found in src/Phug/Renderer/Renderer/Partial/Debug/DebuggerTrait.php - About 55 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 isBlockTag has a Cognitive Complexity of 11 (exceeds 7 allowed). Consider refactoring.
      Open

          protected function isBlockTag(MarkupInterface $element)
          {
              if ($element->belongsTo($this->getOption('inline_tags'))) {
                  return false;
              }
      Severity: Minor
      Found in src/Phug/Formatter/Formatter/Format/XhtmlFormat.php - About 55 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 yieldAssignmentElement has a Cognitive Complexity of 11 (exceeds 7 allowed). Consider refactoring.
      Open

          protected function yieldAssignmentElement(AssignmentElement $element)
          {
              foreach ($this->getOption('assignment_handlers') as $handler) {
                  $iterator = $handler($element) ?: [];
      
      
      Severity: Minor
      Found in src/Phug/Formatter/Formatter/Format/XmlFormat.php - About 55 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 __construct has a Cognitive Complexity of 10 (exceeds 7 allowed). Consider refactoring.
      Open

          public function __construct(EventList $events, SplObjectStorage $nodesRegister)
          {
              $this->nodesRegister = $nodesRegister;
      
              if ($events) {
      Severity: Minor
      Found in src/Phug/Renderer/Renderer/Profiler/LinkedProcesses.php - About 45 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 isInFunctionParams has a Cognitive Complexity of 10 (exceeds 7 allowed). Consider refactoring.
      Open

          private function isInFunctionParams(&$tokens, $index)
          {
              $afterOpen = false;
              for ($i = $index - 1; $i >= 0; $i--) {
                  if (in_array($tokens[$i], [')', '}'], true)) {
      Severity: Minor
      Found in src/Phug/Formatter/Formatter/Partial/HandleVariable.php - About 45 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 scanInterpolationTokens has a Cognitive Complexity of 10 (exceeds 7 allowed). Consider refactoring.
      Open

          private function scanInterpolationTokens(State $state, &$firstToken)
          {
              if (static::INTERPOLATION_ENABLED) {
                  foreach ($state->scan(InterpolationScanner::class) as $subToken) {
                      if ($firstToken) {
      Severity: Minor
      Found in src/Phug/Lexer/Lexer/Scanner/TextScanner.php - About 45 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 compileNode has a Cognitive Complexity of 10 (exceeds 7 allowed). Consider refactoring.
      Open

          public function compileNode(NodeInterface $node, ElementInterface $parent = null)
          {
              $nodeEvent = new NodeEvent($node);
              $this->trigger($nodeEvent);
              $node = $nodeEvent->getNode();
      Severity: Minor
      Found in src/Phug/Compiler/Compiler.php - About 45 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 calculateIndex has a Cognitive Complexity of 10 (exceeds 7 allowed). Consider refactoring.
      Open

          private function calculateIndex($lines, $min, $max)
          {
              $index = 0;
              foreach ($lines as $level => $line) {
                  foreach ($line as $process) {
      Severity: Minor
      Found in src/Phug/Renderer/Renderer/Profiler/Profile.php - About 45 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 readString has a Cognitive Complexity of 10 (exceeds 7 allowed). Consider refactoring.
      Open

          public function readString(array $escapeSequences = null, $raw = false)
          {
              if (!$this->peekQuote()) {
                  return;
              }
      Severity: Minor
      Found in src/Phug/Reader/Reader.php - About 45 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

      Method getRendererException has 8 arguments (exceeds 6 allowed). Consider refactoring.
      Open

          private function getRendererException($error, $code, $line, $offset, $source, $sourcePath, $parameters, $options)
      Severity: Major
      Found in src/Phug/Renderer/Renderer/Partial/Debug/DebuggerTrait.php - About 45 mins to fix

        Function scan has a Cognitive Complexity of 10 (exceeds 7 allowed). Consider refactoring.
        Open

            public function scan(State $state)
            {
                $keywords = $state->getOption('keyword_names');
        
                if (count($keywords)) {
        Severity: Minor
        Found in src/Phug/Lexer/Lexer/Scanner/KeywordScanner.php - About 45 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

        Method getProcesses has 7 arguments (exceeds 6 allowed). Consider refactoring.
        Open

            private function getProcesses($list, $link, $index, $duration, $maxSpace, $lineHeight, $timePrecision)
        Severity: Major
        Found in src/Phug/Renderer/Renderer/Profiler/Profile.php - About 35 mins to fix

          Function formatExpressionElement has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
          Open

              protected function formatExpressionElement(ExpressionElement $code)
              {
                  $value = $this->formatCode($code->getValue(), $code->isChecked(), !$code->isTransformationAllowed());
          
                  if ($code->hasStaticValue()) {
          Severity: Minor
          Found in src/Phug/Formatter/Formatter/AbstractFormat.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 scan has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
          Open

              public function scan(State $state)
              {
                  $reader = $state->getReader();
          
                  if (!$reader->peekChar('<')) {
          Severity: Minor
          Found in src/Phug/Lexer/Lexer/Scanner/MarkupScanner.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 addModule has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
          Open

              public function addModule($module)
              {
                  if ($module instanceof ModuleInterface) {
                      if (in_array($module, $this->modules, true)) {
                          throw new InvalidArgumentException(
          Severity: Minor
          Found in src/Phug/Util/Util/Partial/ModuleContainerTrait.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 withVariableReference has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
          Open

              private function withVariableReference(&$variable, $name, $callback)
              {
                  $keys = $this->handleOptionName($name);
                  if (is_array($keys)) {
                      foreach (array_slice($keys, 0, -1) as $key) {
          Severity: Minor
          Found in src/Phug/Util/Util/Partial/OptionTrait.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 loopScan has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
          Open

              public function loopScan($scanners, $required = false)
              {
                  if ($this->reader->hasLength() && $this->scanners === null) {
                      $this->scanners = $this->filterScanners($scanners);
                  }
          Severity: Minor
          Found in src/Phug/Lexer/Lexer/State.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 isExpired has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
          Open

              public function isExpired($file, &$cachePath = null)
              {
                  if (isset($this->options['up_to_date_check']) && !$this->options['up_to_date_check']) {
                      if (func_num_args() > 1) {
                          $cachePath = $this->getRegistryPath($file);
          Severity: Minor
          Found in src/Phug/Phug/Phug/Optimizer.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

          Severity
          Category
          Status
          Source
          Language