propelorm/Propel2

View on GitHub

Showing 740 of 740 total issues

Function addFilterByCol has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addFilterByCol(string &$script, Column $col): void
    {
        $colPhpName = $col->getPhpName();
        $colName = $col->getName();
        $variableName = $col->getCamelCaseName();
Severity: Minor
Found in src/Propel/Generator/Builder/Om/QueryBuilder.php - About 2 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 isIndex has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    public function isIndex(array $keys): bool
    {
        if ($this->indices) {
            foreach ($this->indices as $index) {
                if (count($keys) === count($index->getColumns())) {
Severity: Minor
Found in src/Propel/Generator/Model/Table.php - About 2 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 addDoDelete has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addDoDelete(string &$script): void
    {
        $table = $this->getTable();
        $script .= "
    /**
Severity: Major
Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 2 hrs to fix

    Method __toString has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function __toString(): string
        {
            $tables = [];
            foreach ($this->getTables() as $table) {
                $columns = [];
    Severity: Major
    Found in src/Propel/Generator/Model/Database.php - About 2 hrs to fix

      AbstractFormatter has 24 functions (exceeds 20 allowed). Consider refactoring.
      Open

      abstract class AbstractFormatter
      {
          /**
           * @var string|null
           */
      Severity: Minor
      Found in src/Propel/Runtime/Formatter/AbstractFormatter.php - About 2 hrs to fix

        ArchivableBehavior has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class ArchivableBehavior extends Behavior
        {
            /**
             * Default parameters value
             *
        Severity: Minor
        Found in src/Propel/Generator/Behavior/Archivable/ArchivableBehavior.php - About 2 hrs to fix

          Method build has 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function build(): void
              {
                  $this->validate();
          
                  $totalNbFiles = 0;
          Severity: Major
          Found in src/Propel/Generator/Manager/ModelManager.php - About 2 hrs to fix

            Method addCrossFKDoAdd has 65 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function addCrossFKDoAdd(string &$script, CrossForeignKeys $crossFKs): void
                {
                    $selfRelationNamePlural = $this->getFKPhpNameAffix($crossFKs->getIncomingForeignKey(), true);
                    $relatedObjectClassName = $this->getCrossFKsPhpNameAffix($crossFKs, false);
                    $className = $this->getClassNameFromTable($crossFKs->getIncomingForeignKey()->getTable());
            Severity: Major
            Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

              Method setupReferrers has 65 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function setupReferrers(bool $throwErrors = false): void
                  {
                      foreach ($this->foreignKeys as $foreignKey) {
                          // table referrers
                          $foreignTable = $this->database->getTable($foreignKey->getForeignTableName());
              Severity: Major
              Found in src/Propel/Generator/Model/Table.php - About 2 hrs to fix

                File PropelTypes.php has 275 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/Model/PropelTypes.php - About 2 hrs to fix

                  Function buildOrderByClause has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function buildOrderByClause(array &$params): array
                      {
                          $orderBy = $this->criteria->getOrderByColumns();
                          if (!$orderBy) {
                              return ['', ''];
                  Severity: Minor
                  Found in src/Propel/Runtime/ActiveQuery/SqlBuilder/SelectQuerySqlBuilder.php - About 2 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 search has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function search($element)
                      {
                          $hashes = [];
                          $isActiveRecord = [];
                          foreach (func_get_args() as $pos => $obj) {
                  Severity: Minor
                  Found in src/Propel/Runtime/Collection/ObjectCombinationCollection.php - About 2 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 getColumnFromName has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function getColumnFromName(string $columnName, bool $failSilently = true): array
                      {
                          if (strpos($columnName, '.') === false) {
                              $prefix = (string)$this->getModelAliasOrName();
                          } else {
                  Severity: Minor
                  Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 2 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 addColumns has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function addColumns(Table $table): void
                      {
                          /** @var \PDOStatement $stmt */
                          $stmt = $this->dbh->query("SELECT COLUMN_NAME, DATA_TYPE, NULLABLE, DATA_LENGTH, DATA_PRECISION, DATA_SCALE, DATA_DEFAULT FROM USER_TAB_COLS WHERE TABLE_NAME = '" . $table->getName() . "'");
                          while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                  Severity: Minor
                  Found in src/Propel/Generator/Reverse/OracleSchemaParser.php - About 2 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 addDoSave has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function addDoSave(string &$script): void
                      {
                          $table = $this->getTable();
                  
                          $reloadOnUpdate = $table->isReloadOnUpdate();
                  Severity: Minor
                  Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 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 addColumnAccessorMethods has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function addColumnAccessorMethods(string &$script): void
                      {
                          $table = $this->getTable();
                  
                          foreach ($table->getColumns() as $col) {
                  Severity: Minor
                  Found in src/Propel/Generator/Builder/Om/AbstractObjectBuilder.php - About 2 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 compareColumns has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function compareColumns(bool $caseInsensitive = false): int
                      {
                          $fromTableColumns = $this->getFromTable()->getColumns();
                          $toTableColumns = $this->getToTable()->getColumns();
                          $columnDifferences = 0;
                  Severity: Minor
                  Found in src/Propel/Generator/Model/Diff/TableComparator.php - About 2 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 compareColumns has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function compareColumns(Column $fromColumn, Column $toColumn): array
                      {
                          $changedProperties = [];
                  
                          // compare column types
                  Severity: Minor
                  Found in src/Propel/Generator/Model/Diff/ColumnComparator.php - About 2 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 addVersionTable has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function addVersionTable(): void
                      {
                          $table = $this->getTable();
                          $database = $table->getDatabase();
                          $versionTableName = $this->getParameter('version_table') ?: ($table->getOriginCommonName() . '_version');
                  Severity: Minor
                  Found in src/Propel/Generator/Behavior/Versionable/VersionableBehavior.php - About 2 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

                      protected function addGetPrevious(string &$script): void
                      {
                          $useScope = $this->behavior->useScope();
                  
                          // The generateScopePhp() method below contains the following list of variables:
                  src/Propel/Generator/Behavior/Sortable/SortableBehaviorObjectBuilderModifier.php on lines 477..518

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

                  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