jaroslavtyc/drd-plus-codes

View on GitHub

Showing 591 of 591 total issues

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

            self::$CS => [
                self::COMMON => [self::$ONE => 'běžný'],
                self::HIGHLANDER => [self::$ONE => 'horal'],
                self::GREEN => [self::$ONE => 'zelený'],
                self::DARK => [self::$ONE => 'temný'],
Severity: Major
Found in Codes/SubRaceCode.php and 1 other location - About 4 hrs to fix
Codes/SubRaceCode.php on lines 133..143

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 162.

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

            self::$EN => [
                self::COMMON => [self::$ONE => 'common'],
                self::HIGHLANDER => [self::$ONE => 'highlander'],
                self::GREEN => [self::$ONE => 'green'],
                self::DARK => [self::$ONE => 'dark'],
Severity: Major
Found in Codes/SubRaceCode.php and 1 other location - About 4 hrs to fix
Codes/SubRaceCode.php on lines 122..132

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 162.

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

MeleeWeaponCode has 29 functions (exceeds 20 allowed). Consider refactoring.
Open

class MeleeWeaponCode extends WeaponCode implements MeleeWeaponlikeCode
{

    private static $customMeleeWeaponCodePerCategory = [];

Severity: Minor
Found in Codes/Armaments/MeleeWeaponCode.php - About 3 hrs to fix

    Function I_can_ask_code_if_is_specific_weapon_type has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        public function I_can_ask_code_if_is_specific_weapon_type()
        {
            $questions = [
                'isBow', 'isCrossbow', 'isThrowingWeapon',
            ];
    Severity: Minor
    Found in tests/Codes/Armaments/RangedWeaponCodeTest.php - About 3 hrs 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

    The class AbstractCodeTest has 12 public methods. Consider refactoring AbstractCodeTest to keep number of public methods under 10.
    Open

    abstract class AbstractCodeTest extends TestWithMockery
    {
    
        protected function setUp(): void
        {
    Severity: Minor
    Found in tests/Codes/AbstractCodeTest.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

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

    The class AllCodesTest has 11 public methods. Consider refactoring AllCodesTest to keep number of public methods under 10.
    Open

    class AllCodesTest extends TestWithMockery
    {
        use GetCodeClassesTrait;
    
        /**
    Severity: Minor
    Found in tests/Codes/AllCodesTest.php by phpmd

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

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

    The class MeleeWeaponCodeTest has an overall complexity of 61 which is very high. The configured complexity threshold is 50.
    Open

    class MeleeWeaponCodeTest extends WeaponCodeTest
    {
        use MeleeWeaponlikeCodeTrait;
    
        /**

    The class MeleeWeaponCodeTest has 24 public methods. Consider refactoring MeleeWeaponCodeTest to keep number of public methods under 10.
    Open

    class MeleeWeaponCodeTest extends WeaponCodeTest
    {
        use MeleeWeaponlikeCodeTrait;
    
        /**

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

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

    The class RangedWeaponCodeTest has 16 public methods. Consider refactoring RangedWeaponCodeTest to keep number of public methods under 10.
    Open

    class RangedWeaponCodeTest extends WeaponCodeTest
    {
    
        /**
         * @test

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

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

    The class WeaponCodeTest has 11 public methods. Consider refactoring WeaponCodeTest to keep number of public methods under 10.
    Open

    abstract class WeaponCodeTest extends WeaponlikeCodeTest
    {
        /**
         * @test
         */

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

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

    The class ShieldCodeTest has 11 public methods. Consider refactoring ShieldCodeTest to keep number of public methods under 10.
    Open

    class ShieldCodeTest extends WeaponlikeCodeTest implements ProtectiveArmamentCodeTest
    {
        use MeleeWeaponlikeCodeTrait;
    
        /**

    TooManyPublicMethods

    Since: 0.1

    A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

    By default it ignores methods starting with 'get' or 'set'.

    Example

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

    MeleeWeaponCodeTest has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MeleeWeaponCodeTest extends WeaponCodeTest
    {
        use MeleeWeaponlikeCodeTrait;
    
        /**
    Severity: Minor
    Found in tests/Codes/Armaments/MeleeWeaponCodeTest.php - About 3 hrs to fix

      Method fetchTranslations has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function fetchTranslations(): array
          {
              return [
                  'en' => [
                      self::STRENGTH => [self::$ONE => 'strength', self::$FEW => 'strengths', self::$MANY => 'strengths'],
      Severity: Major
      Found in Codes/Properties/PropertyCode.php - About 2 hrs to fix

        Method I_can_get_all_codes_at_once_or_by_same_named_constant has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function I_can_get_all_codes_at_once_or_by_same_named_constant()
            {
                self::assertSame(
                    $expectedValues = [
                        // unarmed
        Severity: Major
        Found in tests/Codes/Armaments/MeleeWeaponCodeTest.php - About 2 hrs to fix

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

          <?php declare(strict_types=1);
          
          namespace DrdPlus\Codes\Environment;
          
          use DrdPlus\Codes\Partials\AbstractCode;
          Severity: Major
          Found in Codes/Environment/LightConditionsCode.php and 1 other location - About 2 hrs to fix
          Codes/History/AncestryCode.php on lines 1..41

          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 134.

          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

          <?php declare(strict_types=1);
          
          namespace DrdPlus\Codes\History;
          
          use DrdPlus\Codes\Partials\AbstractCode;
          Severity: Major
          Found in Codes/History/AncestryCode.php and 1 other location - About 2 hrs to fix
          Codes/Environment/LightConditionsCode.php on lines 1..41

          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 134.

          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

              protected function fetchTranslations(): array
              {
                  return [
                      'cs' => [
                          'one' => [
          Severity: Major
          Found in Codes/Theurgist/DemonBodyCode.php and 1 other location - About 2 hrs to fix
          Codes/Theurgist/ModifierMutableParameterCode.php on lines 49..71

          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 132.

          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

              protected function fetchTranslations(): array
              {
                  return [
                      'cs' => [
                          'one' => [
          Severity: Major
          Found in Codes/Theurgist/ModifierMutableParameterCode.php and 1 other location - About 2 hrs to fix
          Codes/Theurgist/DemonBodyCode.php on lines 54..76

          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 132.

          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

          Method fetchTranslations has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function fetchTranslations(): array
              {
                  return [
                      'en' => [
                          self::ARMOR_WEARING => [self::$ONE => 'armor wearing'],
          Severity: Major
          Found in Codes/Skills/PhysicalSkillCode.php - About 2 hrs to fix

            Function scanForCodeClasses has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function scanForCodeClasses(string $rootDir, string $rootNamespace): array
                {
                    $codeClasses = [];
                    foreach (\scandir($rootDir, SCANDIR_SORT_NONE) as $folder) {
                        $folderFullPath = $rootDir . DIRECTORY_SEPARATOR . $folder;
            Severity: Minor
            Found in tests/Codes/GetCodeClassesTrait.php - About 2 hrs 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