jaroslavtyc/drd-plus-health

View on GitHub

Showing 669 of 669 total issues

File HealthTest.php has 1250 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);

namespace DrdPlus\Tests\Health;

use DrdPlus\Codes\Body\OrdinaryWoundOriginCode;
Severity: Major
Found in tests/Health/HealthTest.php - About 3 days to fix

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

        public function I_can_ask_it_if_I_am_suffering_from_wounds(): void
        {
            $woundBoundary = $this->createWoundBoundary(5);
            $health = $this->createHealthToTest($woundBoundary);
            self::assertFalse($health->mayHaveMalusFromWounds($woundBoundary));
    Severity: Major
    Found in tests/Health/HealthTest.php and 1 other location - About 1 day to fix
    tests/Health/HealthTest.php on lines 1504..1547

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

    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_ask_it_if_may_suffer_from_wounds(): void
        {
            $woundBoundary = $this->createWoundBoundary(5);
            $health = $this->createHealthToTest($woundBoundary);
            self::assertFalse($health->maySufferFromWounds($woundBoundary));
    Severity: Major
    Found in tests/Health/HealthTest.php and 1 other location - About 1 day to fix
    tests/Health/HealthTest.php on lines 1552..1595

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

    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

    File Health.php has 560 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php declare(strict_types=1);
    
    namespace DrdPlus\Health;
    
    use DrdPlus\BaseProperties\Will;
    Severity: Major
    Found in Health/Health.php - About 1 day to fix

      HealthTest has 64 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class HealthTest extends TestWithMockery
      {
          /**
           * @test
           */
      Severity: Major
      Found in tests/Health/HealthTest.php - About 1 day to fix

        Health has 61 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Health extends StrictObject
        {
            /**
             * @var array|Wound[]
             */
        Severity: Major
        Found in Health/Health.php - About 1 day to fix

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

              public function I_can_get_used_to_shine_by_long_waiting(): void
              {
                  $glared = Glared::createFromGlare($this->createGlare(-50, true), new Health());
          
                  self::assertSame(-50, $glared->getCurrentMalus());
          Severity: Major
          Found in tests/Health/Inflictions/GlaredTest.php and 1 other location - About 3 hrs to fix
          tests/Health/Inflictions/GlaredTest.php on lines 144..156

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

          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_get_used_to_darkness_by_long_waiting(): void
              {
                  $glared = Glared::createFromGlare($this->createGlare(-21 /* malus */, false), new Health());
          
                  self::assertSame(-21, $glared->getCurrentMalus());
          Severity: Major
          Found in tests/Health/Inflictions/GlaredTest.php and 1 other location - About 3 hrs to fix
          tests/Health/Inflictions/GlaredTest.php on lines 94..106

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

          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

              public function I_can_get_knack_malus_from_afflictions(): void
              {
                  $health = $this->createHealthToTest($woundBoundary = $this->createWoundBoundary(123));
                  $seriousWound = $health->addWound($this->createWoundSize(70),
                      SeriousWoundOriginCode::getPsychicalWoundOrigin(),
          Severity: Major
          Found in tests/Health/HealthTest.php and 2 other locations - About 3 hrs to fix
          tests/Health/HealthTest.php on lines 1366..1378
          tests/Health/HealthTest.php on lines 1400..1412

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

          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

              public function I_can_get_agility_malus_from_afflictions(): void
              {
                  $health = $this->createHealthToTest($woundBoundary = $this->createWoundBoundary(123));
                  $seriousWound = $health->addWound($this->createWoundSize(70),
                      SeriousWoundOriginCode::getPsychicalWoundOrigin(),
          Severity: Major
          Found in tests/Health/HealthTest.php and 2 other locations - About 3 hrs to fix
          tests/Health/HealthTest.php on lines 1383..1395
          tests/Health/HealthTest.php on lines 1400..1412

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

          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

              public function I_can_get_will_malus_from_afflictions(): void
              {
                  $health = $this->createHealthToTest($woundBoundary = $this->createWoundBoundary(123));
                  $seriousWound = $health->addWound($this->createWoundSize(70),
                      SeriousWoundOriginCode::getPsychicalWoundOrigin(),
          Severity: Major
          Found in tests/Health/HealthTest.php and 2 other locations - About 3 hrs to fix
          tests/Health/HealthTest.php on lines 1366..1378
          tests/Health/HealthTest.php on lines 1383..1395

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

          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

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

          class Health extends StrictObject
          {
              /**
               * @var array|Wound[]
               */
          Severity: Minor
          Found in Health/Health.php by phpmd

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

          class Health extends StrictObject
          {
              /**
               * @var array|Wound[]
               */
          Severity: Minor
          Found in Health/Health.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 AfflictionTest has 11 public methods. Consider refactoring AfflictionTest to keep number of public methods under 10.
          Open

          abstract class AfflictionTest extends TestWithMockery
          {
          
              /**
               * @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 HealthTest has 50 public methods. Consider refactoring HealthTest to keep number of public methods under 10.
          Open

          class HealthTest extends TestWithMockery
          {
              /**
               * @test
               */
          Severity: Minor
          Found in tests/Health/HealthTest.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 HealthTest has 64 non-getter- and setter-methods. Consider refactoring HealthTest to keep number of methods under 25.
          Open

          class HealthTest extends TestWithMockery
          {
              /**
               * @test
               */
          Severity: Minor
          Found in tests/Health/HealthTest.php by phpmd

          TooManyMethods

          Since: 0.1

          A class with too many 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'.

          The default was changed from 10 to 25 in PHPMD 2.3.

          Example

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

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

          class HealthTest extends TestWithMockery
          {
              /**
               * @test
               */
          Severity: Minor
          Found in tests/Health/HealthTest.php by phpmd

          Method I_can_be_wounded_both_ordinary_and_seriously has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function I_can_be_wounded_both_ordinary_and_seriously(): void
              {
                  $ordinaryWoundsSize = 0;
                  $seriousWoundsSize = 0;
                  $health = $this->createHealthToTest($woundBoundary = $this->createWoundBoundary(10));
          Severity: Major
          Found in tests/Health/HealthTest.php - About 2 hrs to fix

            Method I_can_get_calculated_filled_half_rows_for_given_wound_value has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function I_can_get_calculated_filled_half_rows_for_given_wound_value(): void
                {
                    // limit of wounds divisible by two (odd)
                    $gridOfWounds = new GridOfWounds($this->createHealth([] /* no wounds*/));
                    self::assertSame(
            Severity: Major
            Found in tests/Health/GridOfWoundsTest.php - About 2 hrs to fix

              Method I_can_be_seriously_wounded has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function I_can_be_seriously_wounded(): void
                  {
                      $health = $this->createHealthToTest($woundBoundary = $this->createWoundBoundary(6));
              
                      $seriousWoundByStab = $health->addWound(
              Severity: Major
              Found in tests/Health/HealthTest.php - About 2 hrs to fix
                Severity
                Category
                Status
                Source
                Language