propelorm/Propel2

View on GitHub

Showing 754 of 754 total issues

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

    private static $sqliteTypeMap = [
        'tinyint'    => PropelTypes::TINYINT,
        'smallint'   => PropelTypes::SMALLINT,
        'mediumint'  => PropelTypes::SMALLINT,
        'int'        => PropelTypes::INTEGER,
Severity: Major
Found in src/Propel/Generator/Reverse/SqliteSchemaParser.php and 1 other location - About 1 day to fix
src/Propel/Generator/Reverse/MysqlSchemaParser.php on lines 38..68

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

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 static $mysqlTypeMap = [
        'tinyint'    => PropelTypes::TINYINT,
        'smallint'   => PropelTypes::SMALLINT,
        'mediumint'  => PropelTypes::SMALLINT,
        'int'        => PropelTypes::INTEGER,
Severity: Major
Found in src/Propel/Generator/Reverse/MysqlSchemaParser.php and 1 other location - About 1 day to fix
src/Propel/Generator/Reverse/SqliteSchemaParser.php on lines 38..68

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

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

<?php

/**
 * This file is part of the Propel package.
 * For the full copyright and license information, please view the LICENSE
Severity: Major
Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.php - About 1 day to fix

    Function createSelectSql has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
    Open

        public function createSelectSql(&$params)
        {
            $adapter = Propel::getServiceContainer()->getAdapter($this->getDbName());
            $dbMap = Propel::getServiceContainer()->getDatabaseMap($this->getDbName());
    
    
    Severity: Minor
    Found in src/Propel/Runtime/ActiveQuery/Criteria.php - About 1 day 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

    ForeignKey has 66 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ForeignKey extends MappingModel
    {
        /**
         * These constants are the uppercase equivalents of the onDelete / onUpdate
         * values in the schema definition.
    Severity: Major
    Found in src/Propel/Generator/Model/ForeignKey.php - About 1 day to fix

      Function execute has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function execute(InputInterface $input, OutputInterface $output)
          {
              $configOptions = [];
      
              if ($this->hasInputOption('output-dir', $input)) {
      Severity: Minor
      Found in src/Propel/Generator/Command/MigrationMigrateCommand.php - About 1 day 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

      File MysqlPlatform.php has 564 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * This file is part of the Propel package.
       * For the full copyright and license information, please view the LICENSE
      Severity: Major
      Found in src/Propel/Generator/Platform/MysqlPlatform.php - About 1 day to fix

        Function startElement has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
        Open

            public function startElement($parser, $name, $attributes)
            {
                $parentTag = $this->peekCurrentSchemaTag();
                if (false === $parentTag) {
                    switch ($name) {
        Severity: Minor
        Found in src/Propel/Generator/Builder/Util/SchemaReader.php - About 1 day 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

        File PgsqlPlatform.php has 528 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * This file is part of the Propel package.
         * For the full copyright and license information, please view the LICENSE
        Severity: Major
        Found in src/Propel/Generator/Platform/PgsqlPlatform.php - About 1 day to fix

          Function doUpdate has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
          Open

              public function doUpdate($updateValues, ConnectionInterface $con)
              {
                  /** @var PdoAdapter $db */
                  $db = Propel::getServiceContainer()->getAdapter($this->getDbName());
                  $dbMap = Propel::getServiceContainer()->getDatabaseMap($this->getDbName());
          Severity: Minor
          Found in src/Propel/Runtime/ActiveQuery/Criteria.php - About 1 day 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

          File TableDiff.php has 524 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          /**
           * This file is part of the Propel package.
           * For the full copyright and license information, please view the LICENSE
          Severity: Major
          Found in src/Propel/Generator/Model/Diff/TableDiff.php - About 1 day to fix

            Database has 59 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Database extends ScopedMappingModel
            {
            
                use BehaviorableTrait;
            
            
            Severity: Major
            Found in src/Propel/Generator/Model/Database.php - About 1 day to fix

              NestedSetBehaviorObjectBuilderModifier has 58 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class NestedSetBehaviorObjectBuilderModifier
              {
                  /** @var NestedSetBehavior */
                  protected $behavior;
              
              

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

                        foreach ($this->getTable()->getReferrers() as $refFK) {
                            $relationName = $this->getRefFKPhpNameAffix($refFK);
                
                            $script .= "
                 * @method     $queryClass leftJoin" . $relationName . "(\$relationAlias = null) Adds a LEFT JOIN clause to the query using the " . $relationName . " relation
                Severity: Major
                Found in src/Propel/Generator/Builder/Om/QueryBuilder.php and 1 other location - About 1 day to fix
                src/Propel/Generator/Builder/Om/QueryBuilder.php on lines 130..150

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

                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

                        foreach ($this->getTable()->getForeignKeys() as $fk) {
                            $relationName = $this->getFKPhpNameAffix($fk);
                
                            $script .= "
                 * @method     $queryClass leftJoin" . $relationName . "(\$relationAlias = null) Adds a LEFT JOIN clause to the query using the " . $relationName . " relation
                Severity: Major
                Found in src/Propel/Generator/Builder/Om/QueryBuilder.php and 1 other location - About 1 day to fix
                src/Propel/Generator/Builder/Om/QueryBuilder.php on lines 151..171

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

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

                <?php
                
                /**
                 * This file is part of the Propel package.
                 * For the full copyright and license information, please view the LICENSE

                  File SortableBehaviorObjectBuilderModifier.php has 505 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   * This file is part of the Propel package.
                   * For the full copyright and license information, please view the LICENSE

                    Function addForeignKeys has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function addForeignKeys(Table $table)
                        {
                            $database = $table->getDatabase();
                    
                            $dataFetcher = $this->dbh->query(sprintf('SHOW CREATE TABLE %s', $this->getPlatform()->doQuoting($table->getName())));
                    Severity: Minor
                    Found in src/Propel/Generator/Reverse/MysqlSchemaParser.php - About 1 day 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

                    File Database.php has 503 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    /**
                     * This file is part of the Propel package.
                     * For the full copyright and license information, please view the LICENSE
                    Severity: Major
                    Found in src/Propel/Generator/Model/Database.php - About 1 day to fix

                      File ForeignKey.php has 499 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      /**
                       * This file is part of the Propel package.
                       * For the full copyright and license information, please view the LICENSE
                      Severity: Minor
                      Found in src/Propel/Generator/Model/ForeignKey.php - About 1 day to fix
                        Severity
                        Category
                        Status
                        Source
                        Language