propelorm/Propel2

View on GitHub

Showing 740 of 740 total issues

Function build has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    public function build(): void
    {
        foreach ($this->getDatabases() as $database) {
            $dotSyntax = "digraph G {\n";

Severity: Minor
Found in src/Propel/Generator/Manager/GraphvizManager.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

Function addDoInsertBodyRaw has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addDoInsertBodyRaw(): string
    {
        $this->declareClasses(
            '\Propel\Runtime\Propel',
            '\PDO',
Severity: Minor
Found in src/Propel/Generator/Builder/Om/ObjectBuilder.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

Method addColumns has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addColumns(Table $table, int $oid): void
    {
        // Get the columns, types, etc.
        // Based on code from pgAdmin3 (http://www.pgadmin.org/)

Severity: Major
Found in src/Propel/Generator/Reverse/PgsqlSchemaParser.php - About 3 hrs to fix

    Method addHydrateBody has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function addHydrateBody(string &$script): void
        {
            $table = $this->getTable();
            $platform = $this->getPlatform();
    
    
    Severity: Major
    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 3 hrs to fix

      QuickBuilder has 30 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class QuickBuilder
      {
          use VfsTrait;
      
          /**
      Severity: Minor
      Found in src/Propel/Generator/Util/QuickBuilder.php - About 3 hrs to fix

        DatabaseDiff has 30 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class DatabaseDiff
        {
            /**
             * @var array<string, \Propel\Generator\Model\Table>
             */
        Severity: Minor
        Found in src/Propel/Generator/Model/Diff/DatabaseDiff.php - About 3 hrs to fix

          NestedSetBehaviorQueryBuilderModifier has 30 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class NestedSetBehaviorQueryBuilderModifier
          {
              /**
               * @var \Propel\Generator\Behavior\NestedSet\NestedSetBehavior
               */

            VersionableBehaviorObjectBuilderModifier has 30 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class VersionableBehaviorObjectBuilderModifier
            {
                /**
                 * @var \Propel\Generator\Behavior\Versionable\VersionableBehavior
                 */

              Function addColumns has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function addColumns(Table $table): void
                  {
                      $tableName = $table->getName();
              
                      /** @var \PDOStatement $stmt */
              Severity: Minor
              Found in src/Propel/Generator/Reverse/SqliteSchemaParser.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

              Function joinSchemas has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function joinSchemas(array $schemas): void
                  {
                      foreach ($schemas as $schema) {
                          foreach ($schema->getDatabases(false) as $addDb) {
                              $addDbName = $addDb->getName();
              Severity: Minor
              Found in src/Propel/Generator/Model/Schema.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

              Method applyLimit has 89 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function applyLimit(string &$sql, int $offset, int $limit, ?Criteria $criteria = null): void
                  {
                      // split the select and from clauses out of the original query
                      $selectStatement = '';
                      $fromStatement = '';
              Severity: Major
              Found in src/Propel/Runtime/Adapter/Pdo/MssqlAdapter.php - About 3 hrs to fix

                Method addSaveBody has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function addSaveBody(string &$script): void
                    {
                        $table = $this->getTable();
                        $reloadOnUpdate = $table->isReloadOnUpdate();
                        $reloadOnInsert = $table->isReloadOnInsert();
                Severity: Major
                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 3 hrs to fix

                  File OraclePlatform.php has 313 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  /**
                   * MIT License. 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/Platform/OraclePlatform.php - About 3 hrs to fix

                    PropelModelPager has 29 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class PropelModelPager implements IteratorAggregate, Countable
                    {
                        /**
                         * @var \Propel\Runtime\ActiveQuery\ModelCriteria
                         */
                    Severity: Minor
                    Found in src/Propel/Runtime/Util/PropelModelPager.php - About 3 hrs to fix

                      PdoAdapter has 29 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      abstract class PdoAdapter
                      {
                          /**
                           * Indicates if the database system can process DELETE statements with
                           * aliases like 'DELETE t FROM my_table t JOIN my_other_table o ON ...'
                      Severity: Minor
                      Found in src/Propel/Runtime/Adapter/Pdo/PdoAdapter.php - About 3 hrs to fix

                        StatementWrapper has 29 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class StatementWrapper implements StatementInterface, IteratorAggregate
                        {
                            /**
                             * The wrapped statement class
                             *
                        Severity: Minor
                        Found in src/Propel/Runtime/Connection/StatementWrapper.php - About 3 hrs to fix

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

                              protected function configure()
                              {
                                  parent::configure();
                          
                                  $this
                          Severity: Major
                          Found in src/Propel/Generator/Command/MigrationUpCommand.php and 1 other location - About 3 hrs to fix
                          src/Propel/Generator/Command/MigrationDownCommand.php on lines 25..38

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

                          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 configure()
                              {
                                  parent::configure();
                          
                                  $this
                          Severity: Major
                          Found in src/Propel/Generator/Command/MigrationDownCommand.php and 1 other location - About 3 hrs to fix
                          src/Propel/Generator/Command/MigrationUpCommand.php on lines 27..40

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

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

                              protected static function simpleXmlToArray(SimpleXMLElement $xml): array
                              {
                                  $ar = [];
                                  foreach ($xml->children() as $k => $v) {
                                      // recurse the child
                          Severity: Minor
                          Found in src/Propel/Common/Config/XmlToArrayConverter.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

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

                              protected function parseTables(Database $database, ?Table $filterTable = null): void
                              {
                                  $sql = "
                                  SELECT name
                                  FROM sqlite_master
                          Severity: Minor
                          Found in src/Propel/Generator/Reverse/SqliteSchemaParser.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

                          Severity
                          Category
                          Status
                          Source
                          Language