soliantconsulting/SimpleFM

View on GitHub

Showing 330 of 330 total issues

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

<?php
declare(strict_types = 1);

namespace Soliant\SimpleFM\Repository\Builder\Type;

Severity: Major
Found in src/Repository/Builder/Type/DecimalType.php and 1 other location - About 1 hr to fix
src/Repository/Builder/Type/DateTimeType.php on lines 1..30

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

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 __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

        string $propertyName,
        string $targetTable,
        string $targetEntity,
        string $targetFieldName,
        string $targetInterfaceName = null,
Severity: Major
Found in src/Repository/Builder/Metadata/OneToOne.php - About 1 hr to fix

    Method execute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function execute(Command $command) : CollectionInterface
        {
            $xml = $this->connection->execute($command, self::GRAMMAR_PATH);
            $errorCode = (int) $xml->error['code'];
            $dataSource = $xml->datasource;
    Severity: Minor
    Found in src/Client/ResultSet/ResultSetClient.php - About 1 hr to fix

      Method testOneToOneOwningHydrationWithoutEntity has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testOneToOneOwningHydrationWithoutEntity(bool $eagerHydration)
          {
              $entityPrototype = new class
              {
                  public $baz;
      Severity: Minor
      Found in test/Repository/Builder/MetadataHydrationTest.php - About 1 hr to fix

        Method testOneToOneInverseHydrationWithoutEntity has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function testOneToOneInverseHydrationWithoutEntity(bool $eagerHydration)
            {
                $entityPrototype = new class
                {
                    public $baz;
        Severity: Minor
        Found in test/Repository/Builder/MetadataHydrationTest.php - About 1 hr to fix

          Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  string $layout,
                  string $className,
                  array $fields,
                  array $embeddables,
                  array $oneToMany,
          Severity: Major
          Found in src/Repository/Builder/Metadata/Entity.php - About 1 hr to fix

            Method __construct has 9 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    string $fieldName,
                    string $propertyName,
                    string $targetTable,
                    string $targetEntity,
                    string $targetPropertyName,
            Severity: Major
            Found in src/Repository/Builder/Metadata/ManyToOne.php - About 1 hr to fix

              Method testManyToOneHydrationWithoutEntity has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function testManyToOneHydrationWithoutEntity(bool $eagerHydration)
                  {
                      $entityPrototype = new class
                      {
                          public $baz;
              Severity: Minor
              Found in test/Repository/Builder/MetadataHydrationTest.php - About 1 hr to fix

                Function buildProxyClass has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function buildProxyClass(
                        string $entityInterfaceName,
                        string $proxyNamespace,
                        string $proxyClassName
                    ) : string {
                Severity: Minor
                Found in src/Repository/Builder/Proxy/ProxyBuilder.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

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

                        $entityMetadata = new Entity('foo', get_class($entityPrototype), [], [], [], [], [
                            new OneToOne(
                                'baz',
                                'bar',
                                'child',
                Severity: Major
                Found in test/Repository/Builder/MetadataHydrationTest.php and 1 other location - About 1 hr to fix
                test/Repository/Builder/MetadataHydrationTest.php on lines 297..310

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

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

                    public function testProxyExtraction()
                    {
                        $entity = new class
                        {
                            private $baz = 'bat';
                Severity: Minor
                Found in test/Repository/Builder/MetadataExtractionTest.php - About 1 hr to fix

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

                          $entityMetadata = new Entity('foo', get_class($entityPrototype), [], [], [], [], [
                              new OneToOne(
                                  'baz',
                                  'bar',
                                  'child',
                  Severity: Major
                  Found in test/Repository/Builder/MetadataHydrationTest.php and 1 other location - About 1 hr to fix
                  test/Repository/Builder/MetadataHydrationTest.php on lines 358..371

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

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

                          $repository = $this->createAssertiveRepository(function (Command $command) use (&$index) {
                              $this->assertSame([
                                  '-lay=foo&-recid=1&-find&-max=1',
                                  '-lay=foo&foo=bar&-recid=1&-edit',
                              ][++$index], (string) $command);
                  Severity: Major
                  Found in test/Repository/RepositoryTest.php and 5 other locations - About 55 mins to fix
                  test/Repository/RepositoryTest.php on lines 310..316
                  test/Repository/RepositoryTest.php on lines 369..375
                  test/Repository/RepositoryTest.php on lines 390..396
                  test/Repository/RepositoryTest.php on lines 411..417
                  test/Repository/RepositoryTest.php on lines 441..447

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

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

                          $repository = $this->createAssertiveRepository(function (Command $command) use (&$index) {
                              $this->assertSame([
                                  '-lay=foo&-recid=1&-find&-max=1',
                                  '-lay=foo&-recid=1&-delete&-modid=1',
                              ][++$index], (string) $command);
                  Severity: Major
                  Found in test/Repository/RepositoryTest.php and 5 other locations - About 55 mins to fix
                  test/Repository/RepositoryTest.php on lines 310..316
                  test/Repository/RepositoryTest.php on lines 335..341
                  test/Repository/RepositoryTest.php on lines 369..375
                  test/Repository/RepositoryTest.php on lines 411..417
                  test/Repository/RepositoryTest.php on lines 441..447

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

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

                          $repository = $this->createAssertiveRepository(function (Command $command) use (&$index) {
                              $this->assertSame([
                                  '-lay=foo&-recid=1&-find&-max=1',
                                  '-lay=foo&foo=bar&-recid=1&-modid=1&-edit',
                              ][++$index], (string) $command);
                  Severity: Major
                  Found in test/Repository/RepositoryTest.php and 5 other locations - About 55 mins to fix
                  test/Repository/RepositoryTest.php on lines 310..316
                  test/Repository/RepositoryTest.php on lines 335..341
                  test/Repository/RepositoryTest.php on lines 390..396
                  test/Repository/RepositoryTest.php on lines 411..417
                  test/Repository/RepositoryTest.php on lines 441..447

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

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

                          $repository = $this->createAssertiveRepository(function (Command $command) use (&$index) {
                              $this->assertSame([
                                  '-lay=foo&-recid=1&-find&-max=1',
                                  '-lay=foo&-recid=1&-delete',
                              ][++$index], (string) $command);
                  Severity: Major
                  Found in test/Repository/RepositoryTest.php and 5 other locations - About 55 mins to fix
                  test/Repository/RepositoryTest.php on lines 310..316
                  test/Repository/RepositoryTest.php on lines 335..341
                  test/Repository/RepositoryTest.php on lines 369..375
                  test/Repository/RepositoryTest.php on lines 390..396
                  test/Repository/RepositoryTest.php on lines 441..447

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

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

                          $repository = $this->createAssertiveRepository(function (Command $command) use (&$index) {
                              $this->assertSame([
                                  '-lay=foo&-recid=1&-find&-max=1',
                                  '-lay=foo&foo=bar&-recid=1&-modid=1&-edit',
                              ][++$index], (string) $command);
                  Severity: Major
                  Found in test/Repository/RepositoryTest.php and 5 other locations - About 55 mins to fix
                  test/Repository/RepositoryTest.php on lines 335..341
                  test/Repository/RepositoryTest.php on lines 369..375
                  test/Repository/RepositoryTest.php on lines 390..396
                  test/Repository/RepositoryTest.php on lines 411..417
                  test/Repository/RepositoryTest.php on lines 441..447

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

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

                          $repository = $this->createAssertiveRepository(function (Command $command) use (&$index) {
                              $this->assertSame([
                                  '-lay=foo&-recid=1&-find&-max=1',
                                  '-lay=foo&-recid=1&-delete&-modid=1',
                              ][++$index], (string) $command);
                  Severity: Major
                  Found in test/Repository/RepositoryTest.php and 5 other locations - About 55 mins to fix
                  test/Repository/RepositoryTest.php on lines 310..316
                  test/Repository/RepositoryTest.php on lines 335..341
                  test/Repository/RepositoryTest.php on lines 369..375
                  test/Repository/RepositoryTest.php on lines 390..396
                  test/Repository/RepositoryTest.php on lines 411..417

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

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

                      public function __toString() : string
                      {
                          $parts = [];
                  
                          foreach ($this->parameters as $name => $value) {
                  Severity: Minor
                  Found in src/Connection/Command.php - About 55 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

                  Avoid variables with short names like $id. Configured minimum length is 3.
                  Open

                              private $id = 5;

                  ShortVariable

                  Since: 0.2

                  Detects when a field, local, or parameter has a very short name.

                  Example

                  class Something {
                      private $q = 15; // VIOLATION - Field
                      public static function main( array $as ) { // VIOLATION - Formal
                          $r = 20 + $this->q; // VIOLATION - Local
                          for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                              $r += $this->q;
                          }
                      }
                  }

                  Source https://phpmd.org/rules/naming.html#shortvariable

                  Severity
                  Category
                  Status
                  Source
                  Language