district09/php_package_qa-drupal

View on GitHub

Showing 4 of 4 total issues

Function drupal_phpunit_get_extension_namespaces has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function drupal_phpunit_get_extension_namespaces(array $dirs)
{
    $suiteNames = ['Unit', 'Kernel', 'Functional', 'FunctionalJavascript'];
    $namespaces = [];
    foreach ($dirs as $extension => $dir) {
Severity: Minor
Found in src/PHPUnit/Extension/bootstrap.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 rollback has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function rollback(): void {
        // Remove the created directories.
        foreach ($this->createdDirectories as $index => $dir) {
            if ($this->filesystem->exists($dir)) {
                $this->filesystem->remove($dir);
Severity: Minor
Found in src/GrumPHP/TransactionalFilesystem.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

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

    public function mergeTaskConfig(
        TaskInterface $task,
        bool $isExtension
    ): void {
        $taskInfo = $this->getTaskConfigFileInfo($task);
Severity: Minor
Found in src/GrumPHP/ConfigFileMerger.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

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

    protected function addTestsBySuiteNamespace($root, $suiteNamespace)
    {
        $vendor = "$root/vendor";

        foreach (drupal_phpunit_find_extension_directories($root) as $extension_name => $dir) {
Severity: Minor
Found in src/PHPUnit/TestSuites/TestSuiteBase.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