jaroslavtyc/drd-plus-profession-levels

View on GitHub

Showing 345 of 345 total issues

File ProfessionLevelsTest.php has 697 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);

namespace DrdPlus\Tests\Person\ProfessionLevels;

use DrdPlus\Codes\ProfessionCode;
Severity: Major
Found in tests/Person/ProfessionLevels/ProfessionLevelsTest.php - About 1 day to fix

    ProfessionLevels has 41 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ProfessionLevels extends StrictObject implements \IteratorAggregate
    {
        private \DrdPlus\Person\ProfessionLevels\ProfessionZeroLevel $professionZeroLevel;
    
        private \DrdPlus\Person\ProfessionLevels\ProfessionFirstLevel $professionFirstLevel;
    Severity: Minor
    Found in src/ProfessionLevels/ProfessionLevels.php - About 5 hrs to fix

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

              $this->addPropertyIncrementGetters(
                  $thirdLevel,
                  $strength = ($this->isPrimaryProperty(PropertyCode::STRENGTH, ProfessionCode::FIGHTER) ? 7 : 0),
                  $agility = ($this->isPrimaryProperty(PropertyCode::AGILITY, ProfessionCode::FIGHTER) ? 8 : 0),
                  $knack = ($this->isPrimaryProperty(PropertyCode::KNACK, ProfessionCode::FIGHTER) ? 9 : 0),
      Severity: Major
      Found in tests/Person/ProfessionLevels/ProfessionLevelsTest.php and 1 other location - About 4 hrs to fix
      tests/Person/ProfessionLevels/ProfessionLevelsTest.php on lines 413..421

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

      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

              $this->addPropertyIncrementGetters(
                  $nextLevel,
                  $strength = $this->isPrimaryProperty(PropertyCode::STRENGTH, ProfessionCode::FIGHTER) ? 1 : 0,
                  $agility = $this->isPrimaryProperty(PropertyCode::AGILITY, ProfessionCode::FIGHTER) ? 1 : 0,
                  $knack = $this->isPrimaryProperty(PropertyCode::KNACK, ProfessionCode::FIGHTER) ? 1 : 0,
      Severity: Major
      Found in tests/Person/ProfessionLevels/ProfessionLevelsTest.php and 1 other location - About 4 hrs to fix
      tests/Person/ProfessionLevels/ProfessionLevelsTest.php on lines 519..527

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

      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

      ProfessionLevelsTest has 33 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class ProfessionLevelsTest extends TestWithMockery
      {
      
          /**
           * @test
      Severity: Minor
      Found in tests/Person/ProfessionLevels/ProfessionLevelsTest.php - About 4 hrs to fix

        File ProfessionFirstLevelTest.php has 336 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php declare(strict_types=1);
        
        namespace DrdPlus\Tests\Person\ProfessionLevels;
        
        use DrdPlus\BaseProperties\Property;
        Severity: Minor
        Found in tests/Person/ProfessionLevels/ProfessionFirstLevelTest.php - About 4 hrs to fix

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

                  $this->addPropertyIncrementGetters(
                      $thirdLevel,
                      $strength = ($this->isPrimaryProperty(PropertyCode::STRENGTH, $professionCode) ? 7 : 0),
                      $agility = ($this->isPrimaryProperty(PropertyCode::AGILITY, $professionCode) ? 8 : 0),
                      $knack = ($this->isPrimaryProperty(PropertyCode::KNACK, $professionCode) ? 9 : 0),
          Severity: Major
          Found in tests/Person/ProfessionLevels/ProfessionLevelsTest.php and 1 other location - About 3 hrs to fix
          tests/Person/ProfessionLevels/ProfessionLevelsTest.php on lines 99..107

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

          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

                  $this->addPropertyIncrementGetters(
                      $firstLevel,
                      $strength = $this->isPrimaryProperty(PropertyCode::STRENGTH, $professionCode) ? 1 : 0,
                      $agility = $this->isPrimaryProperty(PropertyCode::AGILITY, $professionCode) ? 1 : 0,
                      $knack = $this->isPrimaryProperty(PropertyCode::KNACK, $professionCode) ? 1 : 0,
          Severity: Major
          Found in tests/Person/ProfessionLevels/ProfessionLevelsTest.php and 1 other location - About 3 hrs to fix
          tests/Person/ProfessionLevels/ProfessionLevelsTest.php on lines 628..636

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

          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 ProfessionLevelsTest has 28 non-getter- and setter-methods. Consider refactoring ProfessionLevelsTest to keep number of methods under 25.
          Open

          class ProfessionLevelsTest extends TestWithMockery
          {
          
              /**
               * @test

          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 ProfessionLevelsTest has an overall complexity of 93 which is very high. The configured complexity threshold is 50.
          Open

          class ProfessionLevelsTest extends TestWithMockery
          {
          
              /**
               * @test

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

          class ProfessionNextLevelTest extends AbstractTestOfProfessionLevel
          {
          
              /**
               * @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 ProfessionLevels has an overall complexity of 51 which is very high. The configured complexity threshold is 50.
          Open

          class ProfessionLevels extends StrictObject implements \IteratorAggregate
          {
              private \DrdPlus\Person\ProfessionLevels\ProfessionZeroLevel $professionZeroLevel;
          
              private \DrdPlus\Person\ProfessionLevels\ProfessionFirstLevel $professionFirstLevel;

          File ProfessionNextLevelTest.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php declare(strict_types=1);
          
          namespace DrdPlus\Tests\Person\ProfessionLevels;
          
          use DrdPlus\BaseProperties\Property;
          Severity: Minor
          Found in tests/Person/ProfessionLevels/ProfessionNextLevelTest.php - About 3 hrs to fix

            Method I_can_add_more_levels_of_same_profession has 73 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function I_can_add_more_levels_of_same_profession()
                {
                    $firstLevel = $this->createProfessionFirstLevel(ProfessionCode::FIGHTER);
                    $this->addPrimaryPropertiesAnswer($firstLevel, ProfessionCode::FIGHTER);
                    $this->addFirstLevelAnswer($firstLevel, true);
            Severity: Major
            Found in tests/Person/ProfessionLevels/ProfessionLevelsTest.php - About 2 hrs to fix

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

                  public function I_can_not_use_greater_than_allowed_first_level_property(
                      string $professionCode,
                      int $strength,
                      int $agility,
                      int $knack,
              Severity: Major
              Found in tests/Person/ProfessionLevels/ProfessionFirstLevelTest.php and 1 other location - About 2 hrs to fix
              tests/Person/ProfessionLevels/ProfessionFirstLevelTest.php on lines 375..396

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

              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_lesser_than_allowed_first_level_property(
                      string $professionCode,
                      int $strength,
                      int $agility,
                      int $knack,
              Severity: Major
              Found in tests/Person/ProfessionLevels/ProfessionFirstLevelTest.php and 1 other location - About 2 hrs to fix
              tests/Person/ProfessionLevels/ProfessionFirstLevelTest.php on lines 304..325

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

              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

              ProfessionFirstLevelTest has 23 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class ProfessionFirstLevelTest extends AbstractTestOfProfessionLevel
              {
              
                  /**
                   * @test
              Severity: Minor
              Found in tests/Person/ProfessionLevels/ProfessionFirstLevelTest.php - About 2 hrs to fix

                ProfessionNextLevelTest has 23 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class ProfessionNextLevelTest extends AbstractTestOfProfessionLevel
                {
                
                    /**
                     * @test
                Severity: Minor
                Found in tests/Person/ProfessionLevels/ProfessionNextLevelTest.php - About 2 hrs to fix

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

                          $professionNextLevel = ProfessionNextLevel::createNextLevel(
                              $profession = $this->createProfession($professionCode),
                              $levelRank = $this->createLevelRank(2),
                              $strengthIncrement = $this->createStrength($professionCode),
                              $agilityIncrement = $this->createAgility($professionCode),
                  Severity: Major
                  Found in tests/Person/ProfessionLevels/ProfessionNextLevelTest.php and 1 other location - About 2 hrs to fix
                  tests/Person/ProfessionLevels/ProfessionNextLevelTest.php on lines 84..94

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

                  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 ProfessionLevels.php has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php declare(strict_types=1);
                  
                  namespace DrdPlus\Person\ProfessionLevels;
                  
                  use DrdPlus\Codes\Properties\PropertyCode;
                  Severity: Minor
                  Found in src/ProfessionLevels/ProfessionLevels.php - About 2 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language