TikiWiki/tiki-manager

View on GitHub

Showing 2,238 of 2,238 total issues

Avoid unused private methods such as 'asciiRotxmm'.
Open

    private static function asciiRotxmm($login, $key)
    {
        $tmp = '';

        for ($i = 0, $tmp_count = strlen($login); $i < $tmp_count; $i++, $key--) {
Severity: Minor
Found in src/Ext/Password.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 runSetup uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            @chmod($_ENV['SSH_KEY'], 0600);
        }
Severity: Minor
Found in src/Config/Environment.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 local variables such as '$result'.
Open

        $result = $this->query($sql);
Severity: Minor
Found in src/Libs/Database/Database.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

Avoid unused local variables such as '$hash'.
Open

            $map[$path] = $hash;
Severity: Minor
Found in src/Libs/Audit/Checksum.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

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

            } else {
                $absolutes[] = $part;
            }

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 local variables such as '$result'.
Open

        $result = $this->query($sql);
Severity: Minor
Found in src/Libs/Database/Database.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

The function query() contains an exit expression.
Open

            exit(1);
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

ExitExpression

Since: 0.2

An exit-expression within regular code is untestable and therefore it should be avoided. Consider to move the exit-expression into some kind of startup script where an error/exception code is returned to the calling environment.

Example

class Foo {
    public function bar($param)  {
        if ($param === 42) {
            exit(23);
        }
    }
}

Source https://phpmd.org/rules/design.html#exitexpression

Avoid unused local variables such as '$differentInstance'.
Open

        $differentInstance = $this->instance->getId() != $this->getSourceInstance()->getId();
Severity: Minor
Found in src/Application/Restore.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

Avoid unused local variables such as '$key'.
Open

    foreach ($instances as $key => $i) {
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

Avoid using static access to class '\Composer\Semver\Semver' in method 'isValidVersion'.
Open

        return Semver::satisfies($version, $constraint);

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 restoreFilesFromFolder uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

                } else {
                    $this->getAccess()->uploadFile($src, $target);
                }
Severity: Minor
Found in src/Application/Restore.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 restoreFromVCS uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
Open

        } else {
            return false;
        }
Severity: Minor
Found in src/Application/Restore.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 local variables such as '$db_tiki'.
Open

                'type' => $db_tiki ?? '',
Severity: Minor
Found in src/Libs/Database/Database.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

Avoid using static access to class '\TikiManager\Libs\Helpers\ApplicationHelper' in method 'restoreFolder'.
Open

        if (ApplicationHelper::isWindows() && $instance->type == 'local') {
Severity: Minor
Found in src/Application/Restore.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 using static access to class '\TikiManager\Libs\Helpers\ApplicationHelper' in method 'decompressArchive'.
Open

        if (ApplicationHelper::isWindows()) {
Severity: Minor
Found in src/Application/Restore.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 local variables such as '$key'.
Open

            foreach ($current as $key => $value) {

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

The method handleCheckResult() has 258 lines of code. Current threshold is set to 100. Avoid really long methods.
Open

    public static function handleCheckResult(Instance $instance, Version $version, $array)
    {
        if (! $_ENV['INTERACTIVE']) {
            return; // skip
        }
Severity: Minor
Found in src/Libs/Helpers/Checksum.php by phpmd

Avoid unused local variables such as '$home'.
Open

        list($name, $pass, $uid, $comment, $home, $shell) = explode(':', $line);
Severity: Minor
Found in src/Libs/Helpers/functions.php by phpmd

UnusedLocalVariable

Since: 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example

class Foo {
    public function doSomething()
    {
        $i = 5; // Unused
    }
}

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

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

    } else {
        $paths = `whereis php 2>> logs/trim.output`;
    }
Severity: Minor
Found in src/Libs/Helpers/functions.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 readManifest() has an NPath complexity of 6918. The configured NPath complexity threshold is 200.
Open

    public function readManifest($manifestPath)
    {
        $differentInstance = $this->instance->getId() != $this->getSourceInstance()->getId();

        $skipPathCheck = ($this->allowCommonParents < 0) || (count(explode('/', $this->instance->webroot)) < $this->allowCommonParents);
Severity: Minor
Found in src/Application/Restore.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

Severity
Category
Status
Source
Language