edmondscommerce/doctrine-static-meta

View on GitHub

Showing 42 of 53 total issues

Function removeAllAssociations has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

    protected function removeAllAssociations(EntityInterface $entity)
    {
        $required    = $entity::getDoctrineStaticMeta()->getRequiredRelationProperties();
        $meta        = $this->getTestedEntityClassMetaData();
        $identifiers = array_flip($meta->getIdentifier());
Severity: Minor
Found in src/Entity/Testing/AbstractEntityTest.php - About 45 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

Function initialiseProperties has a Cognitive Complexity of 13 (exceeds 10 allowed). Consider refactoring.
Open

    private function initialiseProperties(EntityInterface $entity): void
    {
        $getters = $entity::getDoctrineStaticMeta()->getGetters();
        foreach ($getters as $getter) {
            try {
Severity: Minor
Found in src/Entity/Validation/Initialiser.php - About 45 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

Function replaceNestedDtosWithNewEntities has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
Open

    private function replaceNestedDtosWithNewEntities(DataTransferObjectInterface $dto): void
    {
        $getters = $this->getGettersForDtosOrCollections($dto);
        if ([[], []] === $getters) {
            return;
Severity: Minor
Found in src/Entity/Factory/EntityFactory.php - About 35 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

Function addNestedRequiredDtos has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
Open

    private function addNestedRequiredDtos(DataTransferObjectInterface $dto): void
    {
        $entityFqn         = $dto::getEntityFqn();
        $dsm               = $this->getDsmFromEntityFqn($entityFqn);
        $requiredRelations = $dsm->getRequiredRelationProperties();
Severity: Minor
Found in src/Entity/DataTransferObjects/DtoFactory.php - About 35 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

Function checkFakerClassesRootNamespaceMatchesEntityFqn has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
Open

    private function checkFakerClassesRootNamespaceMatchesEntityFqn(string $fakedEntityFqn): void
    {
        if ([] === $this->fakerDataProviderClasses) {
            return;
        }
Severity: Minor
Found in src/Entity/Testing/EntityGenerator/FakerDataFiller.php - About 35 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 too many return statements within this method.
Open

                return $this->getBigInt();
Severity: Major
Found in src/Entity/Testing/EntityGenerator/Faker/ColumnTypeGuesser.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return $this->getText();
    Severity: Major
    Found in src/Entity/Testing/EntityGenerator/Faker/ColumnTypeGuesser.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return self::HAS_REQUIRED_MANY_TO_ONE;
      Severity: Major
      Found in src/CodeGeneration/Generator/RelationsGenerator.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return null;
        Severity: Major
        Found in src/Entity/Testing/EntityGenerator/Faker/ColumnTypeGuesser.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return "4 $commentStart Fields $commentEnd";
          Severity: Major
          Found in src/CodeGeneration/PostProcessor/EntityFormatter.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return (string)$this->defaultValue;

              Avoid too many return statements within this method.
              Open

                              return 'null';

                Avoid too many return statements within this method.
                Open

                                return $this->getFloat();
                Severity: Major
                Found in src/Entity/Testing/EntityGenerator/Faker/ColumnTypeGuesser.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return "3 $commentStart DSM Fields $commentEnd";
                  Severity: Major
                  Found in src/CodeGeneration/PostProcessor/EntityFormatter.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return self::HAS_MANY_TO_ONE;
                    Severity: Major
                    Found in src/CodeGeneration/Generator/RelationsGenerator.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return $this->getDateTimeImmutable();
                      Severity: Major
                      Found in src/Entity/Testing/EntityGenerator/Faker/ColumnTypeGuesser.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $this->getString($fieldName, $class);
                        Severity: Major
                        Found in src/Entity/Testing/EntityGenerator/Faker/ColumnTypeGuesser.php - About 30 mins to fix

                          Function getTypesFromVarComment has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
                          Open

                              private function getTypesFromVarComment(string $property, string $filename): array
                              {
                                  $docComment = $this->reflectionClass->getProperty($property)->getDocComment();
                                  preg_match('%@var\s*?(.+)%', $docComment, $matches);
                                  $traitCode = \ts\file_get_contents($filename);
                          Severity: Minor
                          Found in src/DoctrineStaticMeta.php - About 25 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

                          Function unserialiseUuids has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
                          Open

                              private function unserialiseUuids(array &$query, UuidFactory $factory): void
                              {
                                  if (null === $query['params']) {
                                      return;
                                  }
                          Severity: Minor
                          Found in src/Entity/Testing/Fixtures/QueryCachingLogger.php - About 25 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

                          Function getErrorsSummary has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
                          Open

                              private static function getErrorsSummary(
                                  ConstraintViolationListInterface $errors,
                                  string $className,
                                  EntityData $dataObject
                              ): string {
                          Severity: Minor
                          Found in src/Exception/ValidationException.php - About 25 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

                          Severity
                          Category
                          Status
                          Source
                          Language