pug-php/twig

View on GitHub

Showing 9 of 146 total issues

Method __construct has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function __construct(Formatter $formatter = null)
    {
        $this->setOptionsRecursive([
            'white_space_sensitive_tags' => [
                'pre',
Severity: Major
Found in src/Phug/Formatter/Format/TwigXhtmlFormat.php - About 2 hrs to fix

    Function formatAttributeElement has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function formatAttributeElement(AttributeElement $element)
        {
            $value = $element->getValue();
            $name = $element->getName();
            $nonEmptyAttribute = ($name === 'class' || $name === 'id');
    Severity: Minor
    Found in src/Phug/Formatter/Format/TwigXmlFormat.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 formatAssignmentElement has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function formatAssignmentElement(AssignmentElement $element)
        {
            $handlers = $this->getOption('assignment_handlers');
            $newElements = [];
            array_walk(
    Severity: Minor
    Found in src/Phug/Formatter/Format/TwigXmlFormat.php - About 1 hr to fix

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

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

        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/Format/TwigXhtmlFormat.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);
        
                $defaults = [];
        Severity: Minor
        Found in src/Phug/Formatter/Format/TwigXmlFormat.php - About 1 hr 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/Format/TwigXmlFormat.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return '';
            Severity: Major
            Found in src/Phug/Formatter/Format/TwigXmlFormat.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return "{{ $input }}";
              Severity: Major
              Found in src/Phug/Formatter/AbstractTwigFormat.php - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language