TikiWiki/tiki-manager

View on GitHub

Showing 2,235 of 2,235 total issues

The method info uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                // when bisecting, the branch is not HEAD but the branch name
                $commitHash = $this->exec($targetFolder, 'rev-parse HEAD');
                $gitCmd = "branch --contains $commitHash";
                $branchOutput = $this->exec($targetFolder, $gitCmd);
Severity: Minor
Found in src/Libs/VersionControl/Git.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class '\Symfony\Component\Process\Process' in method 'exec'.
Open

            $cmd = Process::fromShellCommandline($command, null, null, null, 1800);  // 30min tops
Severity: Minor
Found in src/Libs/VersionControl/Svn.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method info uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $output[ $nodeName ] = [];

                foreach ($node_children as $nodeChild) {
                    $stack[] = [$nodeChild, &$output[ $nodeName ]];
Severity: Minor
Found in src/Libs/VersionControl/Svn.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class '\Symfony\Component\HttpClient\HttpClient' in method 'getRemoteVersion'.
Open

        $client = HttpClient::create();
Severity: Minor
Found in src/Manager/UpdateManager.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method setSafeDirectory() has an NPath complexity of 1920. The configured NPath complexity threshold is 200.
Open

    private function setSafeDirectory($instance)
    {
        $skipSafeDir = isset($_ENV['GIT_DONT_ADD_SAFEDIR']) ? (bool) $_ENV['GIT_DONT_ADD_SAFEDIR'] : false;

        if ($skipSafeDir) {
Severity: Minor
Found in src/Libs/VersionControl/Git.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method log uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $output->writeln(sprintf('%1$s', $this->interpolate($message, $context)));
            }
Severity: Minor
Found in src/Logger/ConsoleLogger.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid using static access to class '\TikiManager\Application\Version' in method 'getAvailableBranches'.
Open

            $sortedVersions[] = Version::buildFake('git', $version);
Severity: Minor
Found in src/Libs/VersionControl/Git.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

The method update() has an NPath complexity of 6912. The configured NPath complexity threshold is 200.
Open

    public function update(string $targetFolder, string $branch, int $lag = 0, ?string $revision = null)
    {
        $commitSHA = $revision;
        $fetchOptions = [];
        $time = time() - $lag * 60 * 60 * 24;
Severity: Minor
Found in src/Libs/VersionControl/Git.php by phpmd

NPathComplexity

Since: 0.1

The NPath complexity of a method is the number of acyclic execution paths through that method. A threshold of 200 is generally considered the point where measures should be taken to reduce complexity.

Example

class Foo {
    function bar() {
        // lots of complicated code
    }
}

Source https://phpmd.org/rules/codesize.html#npathcomplexity

The method getDetails uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $detail = <<<DET

! {img src=pics/icons/exclamation.png} {$instance->name}
__Website:__ [{$instance->weburl}]
Severity: Minor
Found in src/Report/Backup.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid unused private methods such as 'getLocation'.
Open

    private function getLocation()
    {
        return $this->location;
    }
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

The method exec uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $commandInstance = new Command($command);
            $result = $this->access->runCommand($commandInstance);

            $output = $result->getStdoutContent();
Severity: Minor
Found in src/Libs/VersionControl/Git.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method exec uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $commandInstance = new Command($command);
            $result = $this->access->runCommand($commandInstance);

            $output = $result->getStdoutContent();
Severity: Minor
Found in src/Libs/VersionControl/Svn.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method merge uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            $toAppend = $this->getBranchUrl($branch);
        }
Severity: Minor
Found in src/Libs/VersionControl/Svn.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method interpolate uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

            } else {
                $replacements["{{$key}}"] = '['.\gettype($val).']';
            }
Severity: Minor
Found in src/Logger/ConsoleLogger.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

The method info uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $output[ $node_name ] = [];

                    foreach ($node_children as $node_child) {
                        $stack[] = [$node_child, &$output[ $node_name ]];
Severity: Minor
Found in src/Repository/SVN.php by phpmd

ElseExpression

Since: 1.4.0

An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

Example

class Foo
{
    public function bar($flag)
    {
        if ($flag) {
            // one branch
        } else {
            // another branch
        }
    }
}

Source https://phpmd.org/rules/cleancode.html#elseexpression

Avoid unused private methods such as 'PHPSqlite'.
Open

    private static function PHPSqlite()
    {
        return in_array('sqlite', PDO::getAvailableDrivers());
    }

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid using static access to class '\TikiManager\Application\Version' in method 'getAvailableBranches'.
Open

            $versionsSorted[] = Version::buildFake($type, $branch);
Severity: Minor
Found in src/Libs/VersionControl/Svn.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

Avoid unused private methods such as 'formatHtml'.
Open

    private function formatHtml($matches)
    {
        $out = '<span style="';
        foreach (explode(';', $matches[1]) as $code) {
            if (isset(self::$availableForegroundColors[$code])) {

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'getHost'.
Open

    private function getHost()
    {
        return $this->host;
    }
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Avoid unused private methods such as 'getPort'.
Open

    private function getPort()
    {
        return $this->port;
    }
Severity: Minor
Found in src/Libs/Host/SSHWrapperAdapter.php by phpmd

UnusedPrivateMethod

Since: 0.2

Unused Private Method detects when a private method is declared but is unused.

Example

class Something
{
    private function foo() {} // unused
}

Source https://phpmd.org/rules/unusedcode.html#unusedprivatemethod

Severity
Category
Status
Source
Language