jaroslavtyc/drd-plus-codes

View on GitHub

Showing 591 of 591 total issues

The class AllTranslatableCodesTest has a coupling between objects value of 29. Consider to reduce the number of dependencies under 13.
Open

class AllTranslatableCodesTest extends TestWithMockery
{

    use GetCodeClassesTrait;

CouplingBetweenObjects

Since: 1.1.0

A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

Example

class Foo {
    /**
     * @var \foo\bar\X
     */
    private $x = null;

    /**
     * @var \foo\bar\Y
     */
    private $y = null;

    /**
     * @var \foo\bar\Z
     */
    private $z = null;

    public function setFoo(\Foo $foo) {}
    public function setBar(\Bar $bar) {}
    public function setBaz(\Baz $baz) {}

    /**
     * @return \SplObjectStorage
     * @throws \OutOfRangeException
     * @throws \InvalidArgumentException
     * @throws \ErrorException
     */
    public function process(\Iterator $it) {}

    // ...
}

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

Similar blocks of code found in 10 locations. Consider refactoring.
Open

        foreach (MeleeWeaponCode::getMorningstarsAndMorgensternsValues() as $codeValue) {
            $code = MeleeWeaponCode::getIt($codeValue);
            self::assertTrue($code->isMelee());
            self::assertFalse($code->isRanged());
            self::assertTrue($code->isMorningstarOrMorgenstern());
Severity: Major
Found in tests/Codes/Armaments/MeleeWeaponCodeTest.php and 9 other locations - About 40 mins to fix
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 321..331
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 332..342
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 343..353
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 365..375
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 391..401
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 402..412
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 413..423
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 153..163
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 164..174

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

        foreach (RangedWeaponCode::getBowsValues() as $codeValue) {
            $code = RangedWeaponCode::getIt($codeValue);
            self::assertTrue($code->isRanged());
            self::assertFalse($code->isMelee());
            self::assertTrue($code->isBow());
Severity: Major
Found in tests/Codes/Armaments/RangedWeaponCodeTest.php and 9 other locations - About 40 mins to fix
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 321..331
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 332..342
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 343..353
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 354..364
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 365..375
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 391..401
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 402..412
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 413..423
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 164..174

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

        foreach (RangedWeaponCode::getCrossbowsValues() as $codeValue) {
            $code = RangedWeaponCode::getIt($codeValue);
            self::assertTrue($code->isRanged());
            self::assertFalse($code->isMelee());
            self::assertTrue($code->isCrossbow());
Severity: Major
Found in tests/Codes/Armaments/RangedWeaponCodeTest.php and 9 other locations - About 40 mins to fix
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 321..331
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 332..342
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 343..353
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 354..364
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 365..375
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 391..401
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 402..412
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 413..423
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 153..163

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

        foreach (MeleeWeaponCode::getSwordsValues() as $codeValue) {
            $code = MeleeWeaponCode::getIt($codeValue);
            self::assertTrue($code->isMelee());
            self::assertFalse($code->isRanged());
            self::assertTrue($code->isSword());
Severity: Major
Found in tests/Codes/Armaments/MeleeWeaponCodeTest.php and 9 other locations - About 40 mins to fix
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 321..331
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 332..342
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 343..353
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 354..364
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 365..375
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 402..412
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 413..423
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 153..163
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 164..174

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

        foreach (MeleeWeaponCode::getUnarmedValues() as $codeValue) {
            $code = MeleeWeaponCode::getIt($codeValue);
            self::assertTrue($code->isMelee());
            self::assertFalse($code->isRanged());
            self::assertTrue($code->isUnarmed());
Severity: Major
Found in tests/Codes/Armaments/MeleeWeaponCodeTest.php and 9 other locations - About 40 mins to fix
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 321..331
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 332..342
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 343..353
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 354..364
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 365..375
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 391..401
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 402..412
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 153..163
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 164..174

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

        foreach (MeleeWeaponCode::getAxesValues() as $codeValue) {
            $code = MeleeWeaponCode::getIt($codeValue);
            self::assertTrue($code->isMelee());
            self::assertFalse($code->isRanged());
            self::assertTrue($code->isAxe());
Severity: Major
Found in tests/Codes/Armaments/MeleeWeaponCodeTest.php and 9 other locations - About 40 mins to fix
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 332..342
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 343..353
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 354..364
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 365..375
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 391..401
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 402..412
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 413..423
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 153..163
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 164..174

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

        foreach (MeleeWeaponCode::getKnivesAndDaggersValues() as $codeValue) {
            $code = MeleeWeaponCode::getIt($codeValue);
            self::assertTrue($code->isMelee());
            self::assertFalse($code->isRanged());
            self::assertTrue($code->isKnifeOrDagger());
Severity: Major
Found in tests/Codes/Armaments/MeleeWeaponCodeTest.php and 9 other locations - About 40 mins to fix
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 321..331
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 343..353
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 354..364
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 365..375
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 391..401
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 402..412
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 413..423
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 153..163
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 164..174

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

        foreach (MeleeWeaponCode::getVoulgesAndTridentsValues() as $codeValue) {
            $code = MeleeWeaponCode::getIt($codeValue);
            self::assertTrue($code->isMelee());
            self::assertFalse($code->isRanged());
            self::assertTrue($code->isVoulgeOrTrident());
Severity: Major
Found in tests/Codes/Armaments/MeleeWeaponCodeTest.php and 9 other locations - About 40 mins to fix
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 321..331
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 332..342
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 343..353
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 354..364
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 365..375
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 391..401
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 413..423
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 153..163
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 164..174

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

        foreach (MeleeWeaponCode::getSabersAndBowieKnivesValues() as $codeValue) {
            $code = MeleeWeaponCode::getIt($codeValue);
            self::assertTrue($code->isMelee());
            self::assertFalse($code->isRanged());
            self::assertTrue($code->isSaberOrBowieKnife());
Severity: Major
Found in tests/Codes/Armaments/MeleeWeaponCodeTest.php and 9 other locations - About 40 mins to fix
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 321..331
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 332..342
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 343..353
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 354..364
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 391..401
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 402..412
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 413..423
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 153..163
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 164..174

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 10 locations. Consider refactoring.
Open

        foreach (MeleeWeaponCode::getMacesAndClubsValues() as $codeValue) {
            $code = MeleeWeaponCode::getIt($codeValue);
            self::assertTrue($code->isMelee());
            self::assertFalse($code->isRanged());
            self::assertTrue($code->isMaceOrClub());
Severity: Major
Found in tests/Codes/Armaments/MeleeWeaponCodeTest.php and 9 other locations - About 40 mins to fix
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 321..331
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 332..342
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 354..364
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 365..375
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 391..401
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 402..412
tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 413..423
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 153..163
tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 164..174

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 93.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public static function getPossibleValues(): array
    {
        return [
            self::SPELL_RADIUS,
            self::EPICENTER_SHIFT,
Severity: Minor
Found in Codes/Theurgist/ModifierMutableParameterCode.php and 1 other location - About 35 mins to fix
Codes/Theurgist/DemonBodyCode.php on lines 26..44

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function I_can_not_use_empty_string_for_translation_of_custom_code()
    {
        $this->expectException(\DrdPlus\Codes\Partials\Exceptions\InvalidTranslationFormat::class);
        $this->expectExceptionMessageMatches("~''~");
        /** like @see \DrdPlus\Codes\Armaments\MeleeWeaponCode::addNewMeleeWeaponCode */
Severity: Minor
Found in tests/Codes/Armaments/WeaponCodeTest.php and 1 other location - About 35 mins to fix
tests/Codes/Armaments/WeaponCodeTest.php on lines 159..175

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public static function getPossibleValues(): array
    {
        return [
            self::CLOCK,
            self::PEBBLE,
Severity: Minor
Found in Codes/Theurgist/DemonBodyCode.php and 1 other location - About 35 mins to fix
Codes/Theurgist/ModifierMutableParameterCode.php on lines 29..47

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function provideType(): array
    {
        return [
            [PhysicalWoundTypeCode::CRUSH, true, false, false],
            [PhysicalWoundTypeCode::STAB, false, true, false],
Severity: Minor
Found in tests/Codes/Body/PhysicalWoundTypeCodeTest.php and 1 other location - About 35 mins to fix
tests/Codes/ItemHoldingCodeTest.php on lines 27..34

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function provideHoldingExpectation(): array
    {
        return [
            [ItemHoldingCode::TWO_HANDS, true, false, false],
            [ItemHoldingCode::MAIN_HAND, false, true, false],
Severity: Minor
Found in tests/Codes/ItemHoldingCodeTest.php and 1 other location - About 35 mins to fix
tests/Codes/Body/PhysicalWoundTypeCodeTest.php on lines 26..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function I_can_not_use_invalid_plural_for_translation_of_custom_code()
    {
        $this->expectException(\DrdPlus\Codes\Partials\Exceptions\UnknownTranslationPlural::class);
        $this->expectExceptionMessageMatches('~all~');
        /** like @see \DrdPlus\Codes\Armaments\MeleeWeaponCode::addNewMeleeWeaponCode */
Severity: Minor
Found in tests/Codes/Armaments/WeaponCodeTest.php and 1 other location - About 35 mins to fix
tests/Codes/Armaments/WeaponCodeTest.php on lines 199..211

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function Has_unique_codes_across_all_weaponlikes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function Has_unique_codes_across_all_weaponlikes()
    {
        $sutClass = self::getSutClass();
        $reflection = new \ReflectionClass($sutClass);
        $sameCodes = [];
Severity: Minor
Found in tests/Codes/Armaments/WeaponlikeCodeTest.php - About 35 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 guardSameCategory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    private static function guardSameCategory(string $meleeWeaponValue, WeaponCategoryCode $weaponCategoryCode)
    {
        if (!in_array($meleeWeaponValue, self::$customMeleeWeaponCodePerCategory[$weaponCategoryCode->getValue()] ?? [], true)) {
            $alreadyUsedCategory = null;
            foreach (WeaponCategoryCode::getPossibleValues() as $anotherCategory) {
Severity: Minor
Found in Codes/Armaments/MeleeWeaponCode.php - About 35 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 I_get_whispered_current_code_as_return_value_of_factory_method has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function I_get_whispered_current_code_as_return_value_of_factory_method()
    {
        foreach ($this->getCodeClasses() as $codeClass) {
            $reflectionClass = new \ReflectionClass($codeClass);
            $classBaseName = preg_replace('~^.*[\\\](\w+)$~', '$1', $codeClass);
Severity: Minor
Found in tests/Codes/AllCodesTest.php - About 35 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