phug-php/phug

View on GitHub

Showing 113 of 115 total issues

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

    public function compileNode(NodeInterface $node, ElementInterface $parent = null)
    {
        $compiler = $this->getCompiler();
        $compiler->assert(
            $node instanceof ElementNode,
Severity: Minor
Found in src/Phug/Compiler/Compiler/NodeCompiler/ElementNodeCompiler.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

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

    public function getIndentLevel(State $state, $maxLevel = INF, callable $getIndentChar = null)
    {
        if ($maxLevel <= 0) {
            return 0;
        }
Severity: Minor
Found in src/Phug/Lexer/Lexer/Scanner/IndentationScanner.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 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 formatAttributes has a Cognitive Complexity of 9 (exceeds 7 allowed). Consider refactoring.
Open

    protected function formatAttributes(MarkupElement $element)
    {
        if ($this->hasNonStaticAttributes($element) ||
            $this->hasDuplicateAttributeNames($element)) {
            $empty = true;
Severity: Minor
Found in src/Phug/Formatter/Formatter/Format/XmlFormat.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 src/Phug/Formatter/Formatter.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

            return $this->cache[$cacheKey];
    Severity: Major
    Found in src/Phug/DependencyInjection/DependencyInjection.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return $this->pattern(
                  'attribute_pattern',
                  $this->format($name),
                  $this->format($value)
              );
      Severity: Major
      Found in src/Phug/Formatter/Formatter/Format/XmlFormat.php - About 30 mins to fix

        Function scanParenthesesContent has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring.
        Open

            private function scanParenthesesContent(State $state, array $options)
            {
                $reader = $state->getReader();
        
                while ($reader->hasLength()) {
        Severity: Minor
        Found in src/Phug/Lexer/Lexer/Scanner/AttributeScanner.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

        Function getUnescapedLines has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring.
        Open

            protected function getUnescapedLines(State $state, $lines)
            {
                $buffer = '';
                $interpolationLevel = 0;
        
        
        Severity: Minor
        Found in src/Phug/Lexer/Lexer/Scanner/MultilineScanner.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

        Function getUnescapedLineValue has a Cognitive Complexity of 8 (exceeds 7 allowed). Consider refactoring.
        Open

            protected function getUnescapedLineValue(State $state, $value, &$interpolationLevel, &$buffer)
            {
                if (is_string($value)) {
                    if ($interpolationLevel) {
                        yield $this->unEscapedToken($state, $value);
        Severity: Minor
        Found in src/Phug/Lexer/Lexer/Scanner/MultilineScanner.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

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

            public function scan($scanners, array $options = [])
            {
                $scanners = $this->filterScanners($scanners);
        
                foreach ($scanners as $scanner) {
        Severity: Minor
        Found in src/Phug/Lexer/Lexer/State.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