propelorm/Propel2

View on GitHub

Showing 740 of 740 total issues

Method addCrossFKCreateQuery has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addCrossFKCreateQuery(string &$script, CrossForeignKeys $crossFKs): void
    {
        if (1 <= count($crossFKs->getCrossForeignKeys()) && !$crossFKs->getUnclassifiedPrimaryKeys()) {
            return;
        }
Severity: Major
Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

    Method addVersionTable has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function addVersionTable(): void
        {
            $table = $this->getTable();
            $database = $table->getDatabase();
            $versionTableName = $this->getParameter('version_table') ?: ($table->getOriginCommonName() . '_version');
    Severity: Major
    Found in src/Propel/Generator/Behavior/Versionable/VersionableBehavior.php - About 2 hrs to fix

      Method addAddVersion has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function addAddVersion(string &$script): void
          {
              $versionTable = $this->behavior->getVersionTable();
              $versionARClassName = $this->builder->getClassNameFromBuilder($this->builder->getNewStubObjectBuilder($versionTable));
      
      

        Method addCrossFKSet has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function addCrossFKSet(string &$script, CrossForeignKeys $crossFKs): void
            {
                $scheduledForDeletionVarName = $this->getCrossScheduledForDeletionVarName($crossFKs);
        
                $multi = 1 < count($crossFKs->getCrossForeignKeys()) || (bool)$crossFKs->getUnclassifiedPrimaryKeys();
        Severity: Minor
        Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 2 hrs to fix

          Method addDoCount has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function addDoCount(string &$script): void
              {
                  $script .= "
          public function doCount(?ConnectionInterface \$con = null): \Propel\Runtime\DataFetcher\DataFetcherInterface
          {
          Severity: Minor
          Found in src/Propel/Generator/Behavior/QueryCache/QueryCacheBehavior.php - About 2 hrs to fix

            Method __call has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function __call(string $name, array $arguments)
                {
                    // Maybe it's a magic call to one of the methods supporting it, e.g. 'findByTitle'
                    static $methods = ['findBy', 'findOneBy', 'requireOneBy', 'filterBy', 'orderBy', 'groupBy'];
                    foreach ($methods as $methodName) {
            Severity: Minor
            Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

              Method addColumns has 49 lines of code (exceeds 25 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 1 hr to fix

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

                    protected function appendPsForUniqueClauseTo(string &$sb, array &$params): void
                    {
                        if (substr_count($this->column, '?') !== 1) {
                            throw new InvalidClauseException(sprintf('Could not build SQL for expression `%s` because Criteria::RAW works only with a clause containing a single question mark placeholder', $this->column));
                        }
                Severity: Major
                Found in src/Propel/Runtime/ActiveQuery/Criterion/RawCriterion.php and 1 other location - About 1 hr to fix
                src/Propel/Runtime/ActiveQuery/Criterion/RawModelCriterion.php on lines 60..71

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

                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 appendPsForUniqueClauseTo(string &$sb, array &$params): void
                    {
                        if (substr_count($this->clause, '?') !== 1) {
                            throw new InvalidClauseException(sprintf('Could not build SQL for expression `%s` because Criteria::MODEL_CLAUSE_RAW works only with a clause containing a single question mark placeholder', $this->column));
                        }
                src/Propel/Runtime/ActiveQuery/Criterion/RawCriterion.php on lines 58..65

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

                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 addRefFKGet has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function addRefFKGet(string &$script, ForeignKey $refFK): void
                    {
                        $fkQueryClassName = $this->getClassNameFromBuilder($this->getNewStubQueryBuilder($refFK->getTable()));
                        $relCol = $this->getRefFKPhpNameAffix($refFK, true);
                        $collName = $this->getRefFKCollVarName($refFK);
                Severity: Minor
                Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix

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

                      public function isUnique(array $keys): bool
                      {
                          if (count($keys) === 1) {
                              $column = $keys[0] instanceof Column ? $keys[0] : $this->getColumn($keys[0]);
                              if ($column) {
                  Severity: Minor
                  Found in src/Propel/Generator/Model/Table.php - About 1 hr to fix

                    Function cleanupSQL has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function cleanupSQL(string &$sql, array &$params, Criteria $values, DatabaseMap $dbMap): void
                        {
                            $i = 1;
                            $paramCols = [];
                            foreach ($params as $param) {
                    Severity: Minor
                    Found in src/Propel/Runtime/Adapter/Pdo/MssqlAdapter.php - About 1 hr 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 addMultipleJoin has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function addMultipleJoin(array $conditions, ?string $joinType = null)
                        {
                            $join = new Join();
                            $join->setIdentifierQuoting($this->isIdentifierQuotingEnabled());
                            $joinCondition = null;
                    Severity: Minor
                    Found in src/Propel/Runtime/ActiveQuery/Criteria.php - About 1 hr 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 appendPsForUniqueClauseTo has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function appendPsForUniqueClauseTo(string &$sb, array &$params): void
                        {
                            $field = ($this->table === null) ? $this->column : $this->table . '.' . $this->column;
                            // NULL VALUES need special treatment because the SQL syntax is different
                            // i.e. table.column IS NULL rather than table.column = null
                    Severity: Minor
                    Found in src/Propel/Runtime/ActiveQuery/Criterion/BasicCriterion.php - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function parseTables(Database $database, ?Table $filterTable = null): void
                        {
                            $sql = 'SHOW FULL TABLES';
                    
                            if ($filterTable) {
                    Severity: Minor
                    Found in src/Propel/Generator/Reverse/MysqlSchemaParser.php - About 1 hr 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 addClassBody has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function addClassBody(string &$script): void
                        {
                            $this->declareClassFromBuilder($this->getStubObjectBuilder());
                            $this->declareClassFromBuilder($this->getStubQueryBuilder());
                            $this->declareClassFromBuilder($this->getTableMapBuilder());
                    Severity: Minor
                    Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr 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 addIndexes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function addIndexes(Table $table): void
                        {
                            /** @var \PDOStatement $stmt */
                            $stmt = $this->dbh->query('PRAGMA index_list("' . $table->getName() . '")');
                    
                    
                    Severity: Minor
                    Found in src/Propel/Generator/Reverse/SqliteSchemaParser.php - About 1 hr 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 addIndexes has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function addIndexes(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

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

                        protected function addDoDelete(string &$script): void
                        {
                            $table = $this->getTable();
                            $script .= "
                        /**
                    Severity: Minor
                    Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 1 hr 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 getColumnDDL has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getColumnDDL(Column $col): string
                        {
                            $domain = $col->getDomain();
                    
                            $ddl = [$this->quoteIdentifier($col->getName())];
                    Severity: Minor
                    Found in src/Propel/Generator/Platform/PgsqlPlatform.php - About 1 hr 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