phug-php/phug

View on GitHub

Showing 171 of 197 total issues

Method provideAttributesAssignment has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function provideAttributesAssignment()
    {
        return $this
            ->registerHelper(
                'attributes_mapping',
Severity: Minor
Found in src/Phug/Formatter/Formatter/Partial/AssignmentHelpersTrait.php - About 1 hr to fix

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

        private static function mergeOptions($options, $values)
        {
            foreach ($values as $key => &$value) {
                if (substr($key, 0, 3) === 'on_') {
                    if (!is_array($value) || is_callable($value)) {
    Severity: Minor
    Found in src/Phug/Phug/Phug/Partial/ExtensionsTrait.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 scan has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        public function scan(State $state)
        {
            $tokens = [];
    
            /** @var ImportToken $token */
    Severity: Minor
    Found in src/Phug/Lexer/Lexer/Scanner/ImportScanner.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 compose has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        public function compose($timePrecision, $lineHeight)
        {
            $duration = microtime(true) - $this->startTime;
            $linkedProcesses = new LinkedProcesses($this->events, $this->nodesRegister);
    
    
    Severity: Minor
    Found in src/Phug/Renderer/Renderer/Profiler/Profile.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 mergeEventListeners has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        public function mergeEventListeners($eventListeners)
        {
            if ($eventListeners instanceof EventManagerInterface) {
                $eventListeners = $eventListeners->getEventListeners();
            }
    Severity: Minor
    Found in src/Phug/Event/EventManagerTrait.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 formatMixinCallElement has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function formatMixinCallElement(MixinCallElement $mixinCall)
        {
            $hasBlock = $mixinCall->hasChildren();
            $children = new PhpUnwrap($this->formatElementChildren($mixinCall), $this->formatter);
            $mixinName = $mixinCall->getName();
    Severity: Minor
    Found in src/Phug/Formatter/Formatter/AbstractFormat.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 formatElementChildren has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function formatElementChildren(ElementInterface $element, $indentStep = 1)
        {
            $indentLevel = $this->formatter->getLevel();
            $this->formatter->setLevel($indentLevel + $indentStep);
            $content = '';
    Severity: Minor
    Found in src/Phug/Formatter/Formatter/AbstractFormat.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 handleToken has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function handleToken(TokenInterface $token, State $state)
        {
            if (!($token instanceof AttributeStartToken)) {
                throw new \RuntimeException(
                    'You can only pass attribute start tokens to this token handler'
    Severity: Minor
    Found in src/Phug/Parser/Parser/TokenHandler/AttributeStartTokenHandler.php - About 1 hr to fix

      Method setFormatter has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function setFormatter(Formatter $formatter)
          {
              $this->formatter = $formatter;
              $format = $this;
      
      
      Severity: Minor
      Found in src/Phug/Formatter/Formatter/AbstractFormat.php - About 1 hr to fix

        Method formatElementChildren has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function formatElementChildren(ElementInterface $element, $indentStep = 1)
            {
                $indentLevel = $this->formatter->getLevel();
                $this->formatter->setLevel($indentLevel + $indentStep);
                $content = '';
        Severity: Minor
        Found in src/Phug/Formatter/Formatter/AbstractFormat.php - About 1 hr to fix

          Method getList has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function getList()
              {
                  return [
                      //TODO: Several of these are non-standard and need to be encapsulated into extensions
                      //Namely: ForScanner, DoScanner, VariableScanner
          Severity: Minor
          Found in src/Phug/Lexer/Scanners.php - About 1 hr to fix

            Method yieldAssignmentElement has 33 lines of code (exceeds 25 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 1 hr to fix

              Method scan has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function scan(State $state)
                  {
                      $reader = $state->getReader();
              
                      if (!$reader->peekString('//')) {
              Severity: Minor
              Found in src/Phug/Lexer/Lexer/Scanner/CommentScanner.php - About 1 hr to fix

                Method readString has 32 lines of code (exceeds 25 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 1 hr to fix

                  Method compileNode has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function compileNode(NodeInterface $node, ElementInterface $parent = null)
                      {
                          $compiler = $this->getCompiler();
                          $compiler->assert(
                              $node instanceof FilterNode,
                  Severity: Minor
                  Found in src/Phug/Compiler/Compiler/NodeCompiler/FilterNodeCompiler.php - About 1 hr to fix

                    Function handleError has a Cognitive Complexity of 11 (exceeds 5 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 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 yieldLines has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function yieldLines(State $state, array $lines, LineAnalyzer $analyzer)
                        {
                            $reader = $state->getReader();
                    
                            yield $state->createToken(IndentToken::class);
                    Severity: Minor
                    Found in src/Phug/Lexer/Lexer/Scanner/MultilineScanner.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 isBlockTag has a Cognitive Complexity of 11 (exceeds 5 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 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 __construct has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function __construct(Formatter $formatter = null)
                        {
                            parent::__construct($formatter);
                    
                            $this
                    Severity: Minor
                    Found in src/Phug/Formatter/Formatter/Format/XmlFormat.php - About 1 hr to fix

                      Method compileNode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function compileNode(NodeInterface $node, ElementInterface $parent = null)
                          {
                              $this->getCompiler()->assert(
                                  $node instanceof ForNode,
                                  'Unexpected '.get_class($node).' given to for compiler.',
                      Severity: Minor
                      Found in src/Phug/Compiler/Compiler/NodeCompiler/ForNodeCompiler.php - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language