soliantconsulting/SimpleFM

View on GitHub

Showing 330 of 330 total issues

Method validXmlProvider has 275 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function validXmlProvider() : array
    {
        return [
            'project-sample-data' => [
                'projectsampledata.xml',
Severity: Major
Found in test/Client/ResultSet/ResultSetClientTest.php - About 1 day to fix

    File MetadataHydrationTest.php has 468 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    declare(strict_types = 1);
    
    namespace SoliantTest\SimpleFM\Repository\Builder;
    
    
    Severity: Minor
    Found in test/Repository/Builder/MetadataHydrationTest.php - About 7 hrs to fix

      File RepositoryTest.php has 454 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      declare(strict_types = 1);
      
      namespace SoliantTest\SimpleFM\Repository;
      
      
      Severity: Minor
      Found in test/Repository/RepositoryTest.php - About 6 hrs to fix

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

        <?php
        declare(strict_types = 1);
        
        namespace SoliantTest\SimpleFM\Repository\Builder\Type;
        
        
        Severity: Major
        Found in test/Repository/Builder/Type/DateTypeTest.php and 1 other location - About 6 hrs to fix
        test/Repository/Builder/Type/TimeTypeTest.php on lines 1..51

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

        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 SoliantTest\SimpleFM\Repository\Builder\Type;
        
        
        Severity: Major
        Found in test/Repository/Builder/Type/TimeTypeTest.php and 1 other location - About 6 hrs to fix
        test/Repository/Builder/Type/DateTypeTest.php on lines 1..51

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

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

        <?php
        declare(strict_types = 1);
        
        namespace SoliantTest\SimpleFM\Client\ResultSet;
        
        
        Severity: Minor
        Found in test/Client/ResultSet/ResultSetClientTest.php - About 6 hrs to fix

          File MetadataExtractionTest.php has 391 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          declare(strict_types = 1);
          
          namespace SoliantTest\SimpleFM\Repository\Builder;
          
          
          Severity: Minor
          Found in test/Repository/Builder/MetadataExtractionTest.php - About 5 hrs to fix

            Function hydrateWithMetadata has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
            Open

                private function hydrateWithMetadata(array $data, $entity, Entity $metadata)
                {
                    Assertion::isInstanceOf($entity, $metadata->getClassName());
                    $reflectionClass = new ReflectionClass($entity);
            
            
            Severity: Minor
            Found in src/Repository/Builder/MetadataHydration.php - About 5 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 2 locations. Consider refactoring.
            Open

                public function testOneToOneOwningReadOnlyExtractionWithEntity()
                {
                    $childEntity = new class implements EmptyProxyEntityInterface
                    {
                        private $id = 5;
            Severity: Major
            Found in test/Repository/Builder/MetadataExtractionTest.php and 1 other location - About 4 hrs to fix
            test/Repository/Builder/MetadataExtractionTest.php on lines 376..404

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

            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 testOneToOneInverseExtractionWithEntity()
                {
                    $childEntity = new class implements EmptyProxyEntityInterface
                    {
                        private $id = 5;
            Severity: Major
            Found in test/Repository/Builder/MetadataExtractionTest.php and 1 other location - About 4 hrs to fix
            test/Repository/Builder/MetadataExtractionTest.php on lines 318..346

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

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

                private function buildMetadata(string $xmlPath) : Entity
                {
                    $xml = $this->loadValidatedXml($xmlPath);
                    $fields = [];
                    $embeddables = [];
            Severity: Major
            Found in src/Repository/Builder/Metadata/MetadataBuilder.php - About 4 hrs to fix

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

                  public function testSimpleFieldHydration()
                  {
                      $entityPrototype = new class
                      {
                          public $baz;
              Severity: Major
              Found in test/Repository/Builder/MetadataHydrationTest.php and 1 other location - About 4 hrs to fix
              test/Repository/Builder/MetadataHydrationTest.php on lines 89..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 174.

              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 testReadOnlyFieldHydration()
                  {
                      $entityPrototype = new class
                      {
                          public $baz;
              Severity: Major
              Found in test/Repository/Builder/MetadataHydrationTest.php and 1 other location - About 4 hrs to fix
              test/Repository/Builder/MetadataHydrationTest.php on lines 28..46

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

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

                  private function hydrateWithMetadata(array $data, $entity, Entity $metadata)
                  {
                      Assertion::isInstanceOf($entity, $metadata->getClassName());
                      $reflectionClass = new ReflectionClass($entity);
              
              
              Severity: Major
              Found in src/Repository/Builder/MetadataHydration.php - About 4 hrs to fix

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

                    public function testRequestWithCommandIdentity()
                    {
                        $identityHandler = $this->prophesize(IdentityHandlerInterface::class);
                        $identityHandler->decryptPassword(Argument::any())->willReturn('bat2');
                
                
                Severity: Major
                Found in test/Connection/ConnectionTest.php and 1 other location - About 4 hrs to fix
                test/Connection/ConnectionTest.php on lines 91..108

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

                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 testRequestWithUriAndCommandCredentials()
                    {
                        $identityHandler = $this->prophesize(IdentityHandlerInterface::class);
                        $identityHandler->decryptPassword(Argument::any())->willReturn('bat2');
                
                
                Severity: Major
                Found in test/Connection/ConnectionTest.php and 1 other location - About 4 hrs to fix
                test/Connection/ConnectionTest.php on lines 110..127

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

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

                <?php
                declare(strict_types = 1);
                
                namespace Soliant\SimpleFM\Client\Exception;
                
                
                Severity: Minor
                Found in src/Client/Exception/FileMakerException.php - About 3 hrs to fix

                  RepositoryTest has 31 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  final class RepositoryTest extends TestCase
                  {
                      public function testQuoteStringUsesClientMethod()
                      {
                          $resultSetClient = $this->prophesize(ResultSetClientInterface::class);
                  Severity: Minor
                  Found in test/Repository/RepositoryTest.php - About 3 hrs to fix

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

                        private function buildMetadata(string $xmlPath) : Entity
                        {
                            $xml = $this->loadValidatedXml($xmlPath);
                            $fields = [];
                            $embeddables = [];
                    Severity: Minor
                    Found in src/Repository/Builder/Metadata/MetadataBuilder.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 MetadataExtractionTest has 16 public methods. Consider refactoring MetadataExtractionTest to keep number of public methods under 10.
                    Open

                    final class MetadataExtractionTest extends TestCase
                    {
                        public function testSimpleFieldExtraction()
                        {
                            $entity = new class

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language