phug-php/phug

View on GitHub

Showing 171 of 207 total issues

Function compileNode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function compileNode(ParserNodeInterface $node, ElementInterface $parent = null)
    {
        $compiler = $this->getCompiler();
        $compiler->assert(
            $node instanceof MixinCallNode,
Severity: Minor
Found in src/Phug/Compiler/Compiler/NodeCompiler/MixinCallNodeCompiler.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 handleToken has a Cognitive Complexity of 6 (exceeds 5 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 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 getAvailableMethods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getAvailableMethods($customMethods = null)
    {
        foreach ([$this->methods, $customMethods ?: $this->getCustomMethods()] as $methods) {
            foreach ($methods as $method => $action) {
                $method = is_int($method) ? $action : $method;
Severity: Minor
Found in src/Phug/Phug/Phug/Cli.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 record has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function record(Event $event)
    {
        $time = microtime(true) - $this->startTime;
        $container = $this->getContainer();
        $maxTime = $container->getOption('execution_max_time');
Severity: Minor
Found in src/Phug/Renderer/Renderer/Profiler/ProfilerModule.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 insert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function insert($value, $priority)
    {
        if (!is_callable($value)) {
            $previous = null;

Severity: Minor
Found in src/Phug/Event/Event/ListenerQueue.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 getNamedArgument has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getNamedArgument(array &$arguments, array $names)
    {
        foreach ($names as $name) {
            foreach ($arguments as $index => $argument) {
                $value = $this->getNamedArgumentBySpaceDelimiter($arguments, $index, $name) ?:
Severity: Minor
Found in src/Phug/Phug/Phug/Cli.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 compileNode has a Cognitive Complexity of 6 (exceeds 5 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 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 compileNode has a Cognitive Complexity of 6 (exceeds 5 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 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function scan(State $state)
    {
        $reader = $state->getReader();

        if (!$reader->match('([!]?)\|')) {
Severity: Minor
Found in src/Phug/Lexer/Lexer/Scanner/TextLineScanner.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 compileBlocks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function compileBlocks()
    {
        do {
            $blockProceeded = 0;
            foreach ($this->getBlocks() as $name => $blocks) {
Severity: Minor
Found in src/Phug/Compiler/Compiler.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 6 (exceeds 5 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 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