jaroslavtyc/drd-plus-codes

View on GitHub

Showing 591 of 591 total issues

Missing class import via use statement (line '63', column '23').
Open

        foreach ((new \ReflectionClass($sutClass))->getConstants() as $constant) {
Severity: Minor
Found in tests/Codes/AbstractCodeTest.php by phpmd

MissingImport

Since: 2.7.0

Importing all external classes in a file through use statements makes them clearly visible.

Example

function make() {
    return new \stdClass();
}

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

Avoid too many return statements within this method.
Open

            return $translations[$code][$plural]; // explicit english translation
Severity: Major
Found in Codes/Partials/TranslatableCode.php - About 30 mins to fix

    The method getCrossbowsValues has a boolean flag argument $withCustomValues, which is a certain sign of a Single Responsibility Principle violation.
    Open

        public static function getCrossbowsValues(bool $withCustomValues = true): array
    Severity: Minor
    Found in Codes/Armaments/RangedWeaponCode.php by phpmd

    BooleanArgumentFlag

    Since: 1.4.0

    A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

    Example

    class Foo {
        public function bar($flag = true) {
        }
    }

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

    Missing class import via use statement (line '137', column '31').
    Open

            $codeClass::getIt(new \DateTime());
    Severity: Minor
    Found in tests/Codes/AllCodesTest.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '164', column '36').
    Open

                $reflectionClass = new \ReflectionClass($codeClass);
    Severity: Minor
    Found in tests/Codes/AllCodesTest.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '307', column '32').
    Open

            $reflectionClass = new \ReflectionClass(RangedWeaponCode::class);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '81', column '18').
    Open

            if ((new \ReflectionClass($sutClass))->isAbstract()) {

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '14', column '27').
    Open

            $reflection = new \ReflectionClass(self::getSutClass());

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '62', column '32').
    Open

            $reflectionClass = new \ReflectionClass($sutClass);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '58', column '27').
    Open

            $reflection = new \ReflectionClass(self::getSutClass());

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '27', column '40').
    Open

                    $reflectionClass = new \ReflectionClass(static::class);
    Severity: Minor
    Found in Codes/Partials/AbstractCode.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '17', column '31').
    Open

                array_values((new \ReflectionClass(RangedCombatActionCode::class))->getConstants()),

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '29', column '27').
    Open

            $reflection = new \ReflectionClass(MeleeCombatActionCode::class);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '18', column '31').
    Open

                array_values((new \ReflectionClass(MeleeCombatActionCode::class))->getConstants()),

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '28', column '27').
    Open

            $reflection = new \ReflectionClass(RangedCombatActionCode::class);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '24', column '35').
    Open

                $codeReflection = new \ReflectionClass($rootClass);
    Severity: Minor
    Found in tests/Codes/GetCodeClassesTrait.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '31', column '27').
    Open

            $reflection = new \ReflectionClass($sutClass);

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '51', column '44').
    Open

                        $reflectionClass = new \ReflectionClass($rootNamespace . '\\' . $matches['classBasename']);
    Severity: Minor
    Found in tests/Codes/GetCodeClassesTrait.php by phpmd

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

    Missing class import via use statement (line '46', column '27').
    Open

            $reflection = new \ReflectionClass(self::getSutClass());

    MissingImport

    Since: 2.7.0

    Importing all external classes in a file through use statements makes them clearly visible.

    Example

    function make() {
        return new \stdClass();
    }

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

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

        public function I_can_easily_find_out_if_sub_race_belongs_to_race()
        {
            foreach ($this->getExpectedRacesToSubRaces() as $race => $subRaces) {
                $raceCode = RaceCode::getIt($race);
                foreach ($subRaces as $subRace) {
    Severity: Minor
    Found in tests/Codes/SubRaceCodeTest.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