propelorm/Propel2

View on GitHub

Showing 740 of 740 total issues

Method getDropTableDDL has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getDropTableDDL(Table $table): string
    {
        $ret = '';
        foreach ($table->getForeignKeys() as $fk) {
            $ret .= "
Severity: Minor
Found in src/Propel/Generator/Platform/MssqlPlatform.php - About 1 hr to fix

    Method appendForeignKeyNode has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function appendForeignKeyNode(ForeignKey $foreignKey, DOMNode $parentNode): void
        {
            /** @var \DOMElement $foreignKeyNode */
            $foreignKeyNode = $parentNode->appendChild($this->document->createElement('foreign-key'));
            $foreignKeyNode->setAttribute('foreignTable', $foreignKey->getForeignTableCommonName());
    Severity: Minor
    Found in src/Propel/Generator/Schema/Dumper/XmlDumper.php - About 1 hr to fix

      Method getModifyTableDDL has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getModifyTableDDL(TableDiff $tableDiff): string
          {
              $changedNotEditableThroughDirectDDL = $this->tableAlteringWorkaround && (
                  $tableDiff->hasModifiedFks()
                  || $tableDiff->hasModifiedIndices()
      Severity: Minor
      Found in src/Propel/Generator/Platform/SqlitePlatform.php - About 1 hr to fix

        Method queryMethods has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function queryMethods(QueryBuilder $builder): string
            {
                $this->setBuilder($builder);
                $script = '';
        
        

          Method generateScopePhp has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function generateScopePhp(): array
              {
                  $methodSignature = '';
                  $paramsDoc = '';
                  $buildScope = '';
          Severity: Minor
          Found in src/Propel/Generator/Behavior/Sortable/SortableBehavior.php - About 1 hr to fix

            Method doUpdate has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function doUpdate($updateValues, ConnectionInterface $con, bool $forceIndividualSaves = false): int
                {
                    if ($forceIndividualSaves) {
                        if ($updateValues instanceof Criteria) {
                            throw new LogicException('Parameter #1 `$updateValues` must be an array while `$forceIndividualSaves = true`.');
            Severity: Minor
            Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

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

                  public function build(array &$params): PreparedStatementDto
                  {
                      $sourceTableNamesCollector = [];
              
                      $selectSql = $this->buildSelectClause($sourceTableNamesCollector);
              Severity: Minor
              Found in src/Propel/Runtime/ActiveQuery/SqlBuilder/SelectQuerySqlBuilder.php - About 1 hr to fix

                Method addIndexes has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function addIndexes(Table $table): void
                    {
                        /** @var \PDOStatement $stmt */
                        $stmt = $this->dbh->query(sprintf('SHOW INDEX FROM %s', $this->getPlatform()->doQuoting($table->getName())));
                
                
                Severity: Minor
                Found in src/Propel/Generator/Reverse/MysqlSchemaParser.php - About 1 hr to fix

                  Method addPrimaryKey has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function addPrimaryKey(Table $table, int $oid): void
                      {
                          $stmt = $this->dbh->prepare("SELECT
                              DISTINCT ON(cls.relname)
                              cls.relname as idxname,
                  Severity: Minor
                  Found in src/Propel/Generator/Reverse/PgsqlSchemaParser.php - About 1 hr to fix

                    Method addColumnMutatorMethods has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function addColumnMutatorMethods(string &$script): void
                        {
                            foreach ($this->getTable()->getColumns() as $col) {
                                if ($col->getType() === PropelTypes::OBJECT) {
                                    $this->addObjectMutator($script, $col);
                    Severity: Minor
                    Found in src/Propel/Generator/Builder/Om/AbstractObjectBuilder.php - About 1 hr to fix

                      Method addRefFKSet has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function addRefFKSet(string &$script, ForeignKey $refFK): void
                          {
                              $relatedName = $this->getRefFKPhpNameAffix($refFK, true);
                              $relatedObjectClassName = $this->getRefFKPhpNameAffix($refFK, false);
                      
                      
                      Severity: Minor
                      Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    if (
                                        $col->isPrimaryKey()
                                        && $col->isAutoIncrement()
                                        && $table->getIdMethod() !== 'none'
                                        && !$table->isAllowPkInsert()
                        Severity: Critical
                        Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                  if (
                                      ($this->isNumber($fromSqlType) && $this->isNumber($toSqlType)) ||
                                      ($this->isString($fromSqlType) && $this->isString($toSqlType)) ||
                                      ($this->isNumber($fromSqlType) && $this->isString($toSqlType)) ||
                                      ($this->isUuid($fromSqlType) && $this->isString($toSqlType))
                          Severity: Critical
                          Found in src/Propel/Generator/Platform/PgsqlPlatform.php - About 1 hr to fix

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

                                    $this
                                        ->addOption('mysql-engine', null, InputOption::VALUE_REQUIRED, 'MySQL engine (MyISAM, InnoDB, ...)')
                                        ->addOption('schema-dir', null, InputOption::VALUE_REQUIRED, 'The directory where the schema files are placed')
                                        ->addOption('output-dir', null, InputOption::VALUE_REQUIRED, 'The output directory')
                                        ->addOption('object-class', null, InputOption::VALUE_REQUIRED, 'The object class generator name')
                            Severity: Major
                            Found in src/Propel/Generator/Command/ModelBuildCommand.php and 1 other location - About 1 hr to fix
                            src/Propel/Generator/Command/SqlBuildCommand.php on lines 28..34

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

                            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

                                    $this
                                        ->addOption('mysql-engine', null, InputOption::VALUE_REQUIRED, 'MySQL engine (MyISAM, InnoDB, ...)')
                                        ->addOption('schema-dir', null, InputOption::VALUE_REQUIRED, 'The directory where the schema files are placed')
                                        ->addOption('output-dir', null, InputOption::VALUE_REQUIRED, 'The output directory')
                                        ->addOption('validate', null, InputOption::VALUE_NONE, '')
                            Severity: Major
                            Found in src/Propel/Generator/Command/SqlBuildCommand.php and 1 other location - About 1 hr to fix
                            src/Propel/Generator/Command/ModelBuildCommand.php on lines 29..35

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

                            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

                            Method createSelectSqlPart has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function createSelectSqlPart(Criteria $criteria, array &$fromClause, bool $aliasAll = false): string
                                {
                                    $selectClause = [];
                            
                                    if ($aliasAll) {
                            Severity: Minor
                            Found in src/Propel/Runtime/Adapter/Pdo/PdoAdapter.php - About 1 hr to fix

                              Method addDelete has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  protected function addDelete(string &$script): void
                                  {
                                      $script .= "
                                  /**
                                   * Performs a DELETE on the database based on the current ModelCriteria
                              Severity: Minor
                              Found in src/Propel/Generator/Builder/Om/QueryBuilder.php - About 1 hr to fix

                                Method addFilterByPrimaryKey has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    protected function addFilterByPrimaryKey(string &$script): void
                                    {
                                        $script .= "
                                    /**
                                     * Filter the query by primary key
                                Severity: Minor
                                Found in src/Propel/Generator/Builder/Om/QueryBuilder.php - About 1 hr to fix

                                  Method declareClassNamespace has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function declareClassNamespace(string $class, string $namespace = '', $alias = false): string
                                      {
                                          $namespace = trim($namespace, '\\');
                                  
                                          // check if the class is already declared
                                  Severity: Minor
                                  Found in src/Propel/Generator/Builder/Om/AbstractOMBuilder.php - About 1 hr to fix

                                    Method getColumnDefaultValueDDL has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public function getColumnDefaultValueDDL(Column $col): string
                                        {
                                            $default = '';
                                            $defaultValue = $col->getDefaultValue();
                                            if ($defaultValue !== null) {
                                    Severity: Minor
                                    Found in src/Propel/Generator/Platform/DefaultPlatform.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language