jaroslavtyc/drd-plus-codes

View on GitHub

Showing 591 of 591 total issues

Function I_can_get_its_czech_translation has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function I_can_get_its_czech_translation()
    {
        foreach ($this->getTranslatableCodeClasses() as $codeClass) {
            $hasSinglesOnly = $this->hasSinglesOnly($codeClass);
            $hasMultiplesOnly = $this->hasMultiplesOnly($codeClass);
Severity: Minor
Found in tests/Codes/AllTranslatableCodesTest.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

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

<?php declare(strict_types=1); 

namespace DrdPlus\Codes\Environment;

use DrdPlus\Codes\Partials\AbstractCode;
Severity: Major
Found in Codes/Environment/ItemStealthinessCode.php and 2 other locations - About 2 hrs to fix
Codes/Environment/LightSourceCode.php on lines 1..39
Codes/Environment/TerrainCode.php on lines 1..38

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

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 3 locations. Consider refactoring.
Open

<?php declare(strict_types=1); 

namespace DrdPlus\Codes\Environment;

use DrdPlus\Codes\Partials\AbstractCode;
Severity: Major
Found in Codes/Environment/LightSourceCode.php and 2 other locations - About 2 hrs to fix
Codes/Environment/ItemStealthinessCode.php on lines 1..39
Codes/Environment/TerrainCode.php on lines 1..38

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

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 3 locations. Consider refactoring.
Open

<?php declare(strict_types=1); 

namespace DrdPlus\Codes\Environment;

use DrdPlus\Codes\Partials\AbstractCode;
Severity: Major
Found in Codes/Environment/TerrainCode.php and 2 other locations - About 2 hrs to fix
Codes/Environment/ItemStealthinessCode.php on lines 1..39
Codes/Environment/LightSourceCode.php on lines 1..39

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

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 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function fetchTranslations(): array
    {
        return [
            'en' => [
                self::BIG_HANDWORK => [self::$ONE => 'big handwork'],
Severity: Minor
Found in Codes/Skills/CombinedSkillCode.php - About 1 hr to fix

    Method I_can_get_its_czech_translation has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function I_can_get_its_czech_translation()
        {
            foreach ($this->getTranslatableCodeClasses() as $codeClass) {
                $hasSinglesOnly = $this->hasSinglesOnly($codeClass);
                $hasMultiplesOnly = $this->hasMultiplesOnly($codeClass);
    Severity: Minor
    Found in tests/Codes/AllTranslatableCodesTest.php - About 1 hr to fix

      Function translateTo has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public function translateTo(string $languageCode, $amount = 1): string
          {
              $code = $this->getValue();
              $translations = $this->getTranslations($languageCode);
              /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
      Severity: Minor
      Found in Codes/Partials/TranslatableCode.php - About 1 hr 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

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

          protected function fetchTranslations(): array
          {
              return [
                  'en' => [
                      self::SHORT_BOW => [self::$ONE => 'short bow', self::$FEW => 'short bows', self::$MANY => 'short bows'],
      Severity: Minor
      Found in Codes/Armaments/RangedWeaponCode.php - About 1 hr to fix

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

            public static function getPossibleValues(): array
            {
                return [
                    self::CRON,
                    self::DEMON_OF_MOVEMENT,
        Severity: Major
        Found in Codes/Theurgist/DemonCode.php and 1 other location - About 1 hr to fix
        Codes/Theurgist/ModifierCode.php on lines 33..55

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

        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::COLOR,
                    self::GATE,
        Severity: Major
        Found in Codes/Theurgist/ModifierCode.php and 1 other location - About 1 hr to fix
        Codes/Theurgist/DemonCode.php on lines 33..55

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

        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 checkTranslationsFormat has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function checkTranslationsFormat(array $translations)
            {
                /**
                 * @var string $languageCode
                 * @var array|string[] $languageTranslations
        Severity: Minor
        Found in Codes/Partials/TranslatableExtendableCode.php - About 1 hr 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

        Method translateTo has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function translateTo(string $languageCode, $amount = 1): string
            {
                $code = $this->getValue();
                $translations = $this->getTranslations($languageCode);
                /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
        Severity: Minor
        Found in Codes/Partials/TranslatableCode.php - About 1 hr to fix

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

              public function I_can_convert_spear_to_range_weapon_code()
              {
                  $meleeSpear = MeleeWeaponCode::getIt(MeleeWeaponCode::SPEAR);
                  self::assertInstanceOf(MeleeWeaponCode::class, $meleeSpear);
                  self::assertSame($meleeSpear, $meleeSpear->convertToMeleeWeaponCodeEquivalent());
          Severity: Major
          Found in tests/Codes/Armaments/MeleeWeaponCodeTest.php and 1 other location - About 1 hr to fix
          tests/Codes/Armaments/RangedWeaponCodeTest.php on lines 194..203

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

          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_convert_spear_to_melee_weapon_code()
              {
                  $rangeSpear = RangedWeaponCode::getIt(RangedWeaponCode::SPEAR);
                  self::assertInstanceOf(RangedWeaponCode::class, $rangeSpear);
                  self::assertSame($rangeSpear, $rangeSpear->convertToRangedWeaponCodeEquivalent());
          Severity: Major
          Found in tests/Codes/Armaments/RangedWeaponCodeTest.php and 1 other location - About 1 hr to fix
          tests/Codes/Armaments/MeleeWeaponCodeTest.php on lines 429..438

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

          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 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function fetchTranslations(): array
              {
                  $translations = [
                      'cs' => [
                          'one' => [
          Severity: Minor
          Found in Codes/Theurgist/ProfileCode.php - About 1 hr to fix

            Method getEnergeticSpellCodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function getEnergeticSpellCodes(): array
                {
                    return [
                        self::MAROON,
                        self::BURN,
            Severity: Minor
            Found in Codes/Wizard/SpellCode.php - About 1 hr to fix

              Method getMaterialSpellCodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function getMaterialSpellCodes(): array
                  {
                      return [
                          self::NOT_EVEN_HIT,
                          self::TODAY_YOU_WILL_TRY_IT_WITHOUT_WEAPON,
              Severity: Minor
              Found in Codes/Wizard/SpellCode.php - About 1 hr to fix

                Method getInvestigativeSpellCodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function getInvestigativeSpellCodes(): array
                    {
                        return [
                            self::GOOD_TABLE,
                            self::WHERE_IS_MY_PIPE,
                Severity: Minor
                Found in Codes/Wizard/SpellCode.php - About 1 hr to fix

                  Method getMentalSpellCodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function getMentalSpellCodes(): array
                      {
                          return [
                              self::COLORS_AND_SHAPES,
                              self::ENJOY_YOURSELF,
                  Severity: Minor
                  Found in Codes/Wizard/SpellCode.php - About 1 hr to fix

                    Method getTimeSpaceSpellCodes has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function getTimeSpaceSpellCodes(): array
                        {
                            return [
                                self::MAGIC_ARMOR,
                                self::PROJECTILE,
                    Severity: Minor
                    Found in Codes/Wizard/SpellCode.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language