phug-php/phug

View on GitHub

Showing 171 of 197 total issues

Function getUnescapedLines has a Cognitive Complexity of 8 (exceeds 5 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 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 handleToken has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function handleToken(TokenInterface $token, State $state)
    {
        if (!($token instanceof InterpolationStartToken)) {
            throw new \RuntimeException(
                'You can only pass interpolation start tokens to this token handler'
Severity: Minor
Found in src/Phug/Parser/Parser/TokenHandler/InterpolationStartTokenHandler.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 handleError has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function handleError($error, $code, $path, $source, $parameters, $options)
Severity: Minor
Found in src/Phug/Renderer/Renderer/Partial/Debug/DebuggerTrait.php - About 45 mins to fix

    Function getUnescapedLineValue has a Cognitive Complexity of 8 (exceeds 5 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 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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            $name,
            $autoClosed = false,
            \SplObjectStorage $attributes = null,
            ParserNode $originNode = null,
            NodeInterface $parent = null,
    Severity: Minor
    Found in src/Phug/Formatter/Formatter/Element/MarkupElement.php - About 45 mins to fix

      Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $name,
              \SplObjectStorage $attributes = null,
              AssignmentContainerInterface $container = null,
              ParserNode $originNode = null,
              NodeInterface $parent = null,
      Severity: Minor
      Found in src/Phug/Formatter/Formatter/Element/AssignmentElement.php - About 45 mins to fix

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

            public function scan($scanners)
            {
                $scanners = $this->filterScanners($scanners);
        
                foreach ($scanners as $key => $scanner) {
        Severity: Minor
        Found in src/Phug/Lexer/Lexer/State.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 handleToken has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            public function handleToken(TokenInterface $token, State $state)
            {
                if (!($token instanceof AttributeToken)) {
                    throw new \RuntimeException(
                        'You can only pass attribute tokens to this token handler'
        Severity: Minor
        Found in src/Phug/Parser/Parser/TokenHandler/AttributeTokenHandler.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 scanParenthesesContent has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

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

        Consider simplifying this complex logical expression.
        Open

                if ($nonEmptyAttribute && (
                    !$value ||
                    ($value instanceof TextElement && ($value->getValue() ?: '') === '') ||
                    (is_string($value) && in_array(trim($value), ['', '""', "''"]))
                )) {
        Severity: Major
        Found in src/Phug/Formatter/Formatter/Format/XmlFormat.php - About 40 mins to fix

          Method displayCached has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function displayCached($path, $input, callable $rendered, array $variables, &$success = null)
          Severity: Minor
          Found in src/Phug/Renderer/Renderer/Adapter/FileAdapter.php - About 35 mins to fix

            Method assert has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function assert($condition, $message, $node = null, $code = 0, $previous = null)
            Severity: Minor
            Found in src/Phug/Compiler/Compiler.php - About 35 mins to fix

              Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      CompilerInterface $compiler,
                      $name = '',
                      ParserNode $originNode = null,
                      NodeInterface $parent = null,
                      array $children = null
              Severity: Minor
              Found in src/Phug/Compiler/Compiler/Element/BlockElement.php - About 35 mins to fix

                Method displayCached has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function displayCached($path, $input, callable $rendered, array $variables, &$success = null);
                Severity: Minor
                Found in src/Phug/Renderer/Renderer/CacheInterface.php - About 35 mins to fix

                  Method assert has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function assert($condition, $message, $node = null, $code = 0, $previous = null);
                  Severity: Minor
                  Found in src/Phug/Compiler/CompilerInterface.php - About 35 mins to fix

                    Method callAdapter has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function callAdapter($method, $path, $input, callable $getSource, array $parameters)
                    Severity: Minor
                    Found in src/Phug/Renderer/Renderer/Partial/AdapterTrait.php - About 35 mins to fix

                      Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              $name,
                              $value,
                              ParserNode $originNode = null,
                              NodeInterface $parent = null,
                              array $children = null
                      Severity: Minor
                      Found in src/Phug/Formatter/Formatter/Element/AttributeElement.php - About 35 mins to fix

                        Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                CodeElement $variable = null,
                                ExpressionElement $expression = null,
                                ParserNode $originNode = null,
                                NodeInterface $parent = null,
                                array $children = null
                        Severity: Minor
                        Found in src/Phug/Formatter/Formatter/Element/VariableElement.php - About 35 mins to fix

                          Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                                  EventList $events,
                                  SplObjectStorage $nodesRegister,
                                  $startTime,
                                  $initialMemoryUsage,
                                  $eventDump
                          Severity: Minor
                          Found in src/Phug/Renderer/Renderer/Profiler/Profile.php - About 35 mins to fix

                            Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    SourceLocation $location,
                                    $message = '',
                                    $code = 0,
                                    TokenInterface $relatedToken = null,
                                    $previous = null
                            Severity: Minor
                            Found in src/Phug/Parser/ParserException.php - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language