phug-php/dev-tool

View on GitHub
src/Phug/DevTool/Command/CheckCommand.php

Summary

Maintainability
B
5 hrs
Test Coverage

Method configure has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function configure()
    {
        $this->setName('check')
            ->addOption(
                'report',
Severity: Major
Found in src/Phug/DevTool/Command/CheckCommand.php - About 2 hrs to fix

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

        protected function execute(InputInterface $input, OutputInterface $output)
        {
            $app = $this->getApplication();
            $coverageFilePath = $app->getWorkingDirectory().'/coverage.xml';
    
    
    Severity: Minor
    Found in src/Phug/DevTool/Command/CheckCommand.php - About 1 hr to fix

      Method runCoverage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function runCoverage(InputInterface $input, OutputInterface $output, $coverageFilePath)
          {
              $app = $this->getApplication();
      
              $phpVersion = $input->getOption('coverage-php-version');
      Severity: Minor
      Found in src/Phug/DevTool/Command/CheckCommand.php - About 1 hr to fix

        Function execute has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $app = $this->getApplication();
                $coverageFilePath = $app->getWorkingDirectory().'/coverage.xml';
        
        
        Severity: Minor
        Found in src/Phug/DevTool/Command/CheckCommand.php - About 55 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 assigning values to variables in if clauses and the like (line '91', column '14').
        Open

            protected function runCoverage(InputInterface $input, OutputInterface $output, $coverageFilePath)
            {
                $app = $this->getApplication();
        
                $phpVersion = $input->getOption('coverage-php-version');

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid assigning values to variables in if clauses and the like (line '124', column '17').
        Open

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $app = $this->getApplication();
                $coverageFilePath = $app->getWorkingDirectory().'/coverage.xml';
        
        

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid assigning values to variables in if clauses and the like (line '129', column '14').
        Open

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $app = $this->getApplication();
                $coverageFilePath = $app->getWorkingDirectory().'/coverage.xml';
        
        

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid assigning values to variables in if clauses and the like (line '133', column '33').
        Open

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $app = $this->getApplication();
                $coverageFilePath = $app->getWorkingDirectory().'/coverage.xml';
        
        

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid assigning values to variables in if clauses and the like (line '97', column '14').
        Open

            protected function runCoverage(InputInterface $input, OutputInterface $output, $coverageFilePath)
            {
                $app = $this->getApplication();
        
                $phpVersion = $input->getOption('coverage-php-version');

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Avoid assigning values to variables in if clauses and the like (line '137', column '60').
        Open

            protected function execute(InputInterface $input, OutputInterface $output)
            {
                $app = $this->getApplication();
                $coverageFilePath = $app->getWorkingDirectory().'/coverage.xml';
        
        

        IfStatementAssignment

        Since: 2.7.0

        Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.

        Example

        class Foo
        {
            public function bar($flag)
            {
                if ($foo = 'bar') { // possible typo
                    // ...
                }
                if ($baz = 0) { // always false
                    // ...
                }
            }
        }

        Source http://phpmd.org/rules/cleancode.html#ifstatementassignment

        Reference to constant VALUE_OPTIONAL from undeclared class \Symfony\Component\Console\Input\InputOption
        Open

                        InputOption::VALUE_OPTIONAL,
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Argument #1 of this call to \preg_match is typically a literal or constant but isn't, but argument #2 (which is typically a variable) is a literal or constant. The arguments may be in the wrong order.
        Open

                    if (!preg_match('/^'.preg_quote($phpVersion).'(\D.*)?$/', PHP_VERSION)) {

        Reference to constant VALUE_OPTIONAL from undeclared class \Symfony\Component\Console\Input\InputOption
        Open

                        InputOption::VALUE_OPTIONAL,
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Reference to constant VALUE_NONE from undeclared class \Symfony\Component\Console\Input\InputOption
        Open

                        InputOption::VALUE_NONE,
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Parameter $input has undeclared type \Symfony\Component\Console\Input\InputInterface
        Open

            protected function execute(InputInterface $input, OutputInterface $output)

        Parameter $input has undeclared type \Symfony\Component\Console\Input\InputInterface
        Open

            protected function runCoverage(InputInterface $input, OutputInterface $output, $coverageFilePath)

        Call to method writeln from undeclared class \Symfony\Component\Console\Output\OutputInterface
        Open

                    $output->writeln(
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Reference to constant VALUE_OPTIONAL from undeclared class \Symfony\Component\Console\Input\InputOption
        Open

                        InputOption::VALUE_OPTIONAL,
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Call to method writeln from undeclared class \Symfony\Component\Console\Output\OutputInterface
        Open

                        $output->writeln(
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Call to undeclared method \Phug\DevTool\Command\CheckCommand::setName
        Open

                $this->setName('check')
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Parameter $output has undeclared type \Symfony\Component\Console\Output\OutputInterface
        Open

            protected function runCoverage(InputInterface $input, OutputInterface $output, $coverageFilePath)

        Call to method getOption from undeclared class \Symfony\Component\Console\Input\InputInterface
        Open

                    '--ignore-tests' => $input->getOption('ignore-tests'),
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Reference to constant VALUE_NONE from undeclared class \Symfony\Component\Console\Input\InputOption
        Open

                        InputOption::VALUE_NONE,
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Call to method getOption from undeclared class \Symfony\Component\Console\Input\InputInterface
        Open

                    if ($value = $input->getOption($option)) {
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Call to method getOption from undeclared class \Symfony\Component\Console\Input\InputInterface
        Open

                $phpVersion = $input->getOption('coverage-php-version');
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Reference to constant VALUE_NONE from undeclared class \Symfony\Component\Console\Input\InputOption
        Open

                        InputOption::VALUE_NONE,
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Reference to constant VALUE_OPTIONAL from undeclared class \Symfony\Component\Console\Input\InputOption
        Open

                        InputOption::VALUE_OPTIONAL,
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Reference to constant VALUE_NONE from undeclared class \Symfony\Component\Console\Input\InputOption
        Open

                        InputOption::VALUE_NONE,
        Severity: Critical
        Found in src/Phug/DevTool/Command/CheckCommand.php by phan

        Parameter $output has undeclared type \Symfony\Component\Console\Output\OutputInterface
        Open

            protected function execute(InputInterface $input, OutputInterface $output)

        There are no issues that match your filters.

        Category
        Status