Remg/GeneratorBundle

View on GitHub

Showing 18 of 18 total issues

Method getPhpKeywords has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function getPhpKeywords()
    {
        return [
            'abstract',
            'and',
Severity: Major
Found in Mapping/MappingValidator.php - About 3 hrs to fix

    Entity has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Entity implements EntityInterface
    {
        /**
         * Contains the entity name.
         *
    Severity: Minor
    Found in Model/Entity.php - About 3 hrs to fix

      File MappingValidator.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * This file is part of the RemgGeneratorBundle package.
       *
      Severity: Minor
      Found in Mapping/MappingValidator.php - About 2 hrs to fix

        Method buildAssociations has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function buildAssociations(EntityInterface $entity, ClassMetadataBuilder $builder)
            {
                foreach ($entity->getAssociations() as $association) {
                    switch ($association->getType()) {
                        case Association::ONE_TO_ONE:
        Severity: Minor
        Found in Mapping/ClassMetadataFactory.php - About 1 hr to fix

          Method getReverseAssociation has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getReverseAssociation(AssociationInterface $targetAssociation)
              {
                  $name = $targetAssociation->isOwningSide()
                      ? $targetAssociation->getInversedBy()
                      : $targetAssociation->getMappedBy();
          Severity: Minor
          Found in Mapping/EntityBuilder.php - About 1 hr to fix

            Method interact has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function interact(InputInterface $input, OutputInterface $output)
                {
                    /* @var StyleInterface */
                    $display = $this->getDisplay($input, $output);
                    /* @var \Remg\GeneratorBundle\Command\Helper\EntityHelper */
            Severity: Minor
            Found in Command/GenerateEntityCommand.php - About 1 hr to fix

              Method listAssociations has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function listAssociations(EntityInterface $entity)
                  {
                      if ($entity->getAssociations()->isEmpty()) {
                          return;
                      }
              Severity: Minor
              Found in Command/Helper/EntityHelper.php - About 1 hr to fix

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

                    public function askAssociation(AssociationInterface $association)
                    {
                        $association
                            ->setName($this->askName($association))
                            ->setType($this->askType($association))
                Severity: Major
                Found in Command/Helper/AssociationHelper.php and 1 other location - About 1 hr to fix
                Command/Helper/FieldHelper.php on lines 36..48

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

                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 askField(FieldInterface $field)
                    {
                        $field
                            ->setName($this->askName($field))
                            ->setType($this->askType($field))
                Severity: Major
                Found in Command/Helper/FieldHelper.php and 1 other location - About 1 hr to fix
                Command/Helper/AssociationHelper.php on lines 27..39

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

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

                    private function buildAssociations(EntityInterface $entity, ClassMetadataBuilder $builder)
                    {
                        foreach ($entity->getAssociations() as $association) {
                            switch ($association->getType()) {
                                case Association::ONE_TO_ONE:
                Severity: Minor
                Found in Mapping/ClassMetadataFactory.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

                Function __construct has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __construct(array $mapping = null)
                    {
                        if ($mapping) {
                            $this->name = $mapping['fieldName'];
                
                
                Severity: Minor
                Found in Model/Association.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 getAllEntities has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getAllEntities()
                    {
                        $metadatas = $this->metadataFactory->getAllMetadata();
                
                        if (empty($metadatas)) {
                Severity: Minor
                Found in Mapping/EntityFactory.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 getDoctrineType has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getDoctrineType()
                    {
                        if (
                            static::ONE_TO_MANY === $this->type
                            && false === $this->bidirectional
                Severity: Minor
                Found in Model/Association.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 discoverAssociations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function discoverAssociations(EntityInterface $entity, array $entities)
                    {
                        foreach ($entities as $targetEntity) {
                            $targetAssociations = $targetEntity
                                ->getAssociations()
                Severity: Minor
                Found in Mapping/EntityBuilder.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

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

                    protected function execute(InputInterface $input, OutputInterface $output)
                    {
                        /* @var StyleInterface */
                        $display = $this->getDisplay($input, $output);
                        /* @var \Remg\GeneratorBundle\Model\Entity The ready-to-generate entity model. */
                Severity: Minor
                Found in Command/GenerateEntityCommand.php and 1 other location - About 30 mins to fix
                Command/RegenerateEntityCommand.php on lines 81..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 91.

                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

                    private function askName(AssociationInterface $association)
                    {
                        $validator = $this->validator;
                
                        return $this->display->ask(
                Severity: Minor
                Found in Command/Helper/AssociationHelper.php and 1 other location - About 30 mins to fix
                Command/Helper/FieldHelper.php on lines 57..72

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

                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

                    protected function execute(InputInterface $input, OutputInterface $output)
                    {
                        /* @var StyleInterface */
                        $display = $this->getDisplay($input, $output);
                        /* @var \Remg\GeneratorBundle\Model\Entity The ready-to-generate entity model. */
                Severity: Minor
                Found in Command/RegenerateEntityCommand.php and 1 other location - About 30 mins to fix
                Command/GenerateEntityCommand.php on lines 85..98

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

                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

                    private function askName(FieldInterface $field)
                    {
                        $validator = $this->validator;
                
                        return $this->display->ask(
                Severity: Minor
                Found in Command/Helper/FieldHelper.php and 1 other location - About 30 mins to fix
                Command/Helper/AssociationHelper.php on lines 48..63

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

                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

                Severity
                Category
                Status
                Source
                Language