propelorm/Propel2

View on GitHub

Showing 754 of 754 total issues

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

    protected function addDoDelete(&$script)
    {
        $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 addFindPkSimple has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addFindPkSimple(&$script)
    {
        $table = $this->getTable();

        // this method is not needed if the table has no primary key
Severity: Minor
Found in src/Propel/Generator/Builder/Om/QueryBuilder.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)
    {
        $stmt = $this->dbh->query('PRAGMA index_list("' . $table->getName() . '")');

        while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
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 addScopeAccessors has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    protected function addScopeAccessors(&$script)
    {

        $script .= "
/**

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

    public function getUnclassifiedPrimaryKeys()
    {
        $pks = [];
        foreach ($this->getMiddleTable()->getPrimaryKey() as $pk) {
            //required
Severity: Minor
Found in src/Propel/Generator/Model/CrossForeignKeys.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 comparePrimaryKeys has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function comparePrimaryKeys($caseInsensitive = false)
    {
        $pkDifferences = 0;
        $fromTablePk = $this->getFromTable()->getPrimaryKey();
        $toTablePk = $this->getToTable()->getPrimaryKey();
Severity: Minor
Found in src/Propel/Generator/Model/Diff/TableComparator.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 create has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function create(array $configuration = [], AdapterInterface $adapter, $defaultConnectionClass = self::DEFAULT_CONNECTION_CLASS)
    {
        if (isset($configuration['classname'])) {
            $connectionClass = $configuration['classname'];
        } else {
Severity: Minor
Found in src/Propel/Runtime/Connection/ConnectionFactory.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(&$sb, array &$params)
    {
        $field = (null === $this->table) ? $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 doInsert has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function doInsert(ConnectionInterface $con = null)
    {
        // The primary key
        $id = null;
        if (null === $con) {
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

Method equals has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function equals($crit)
    {
        if (null === $crit || !($crit instanceof Criteria)) {
            return false;
        }
Severity: Minor
Found in src/Propel/Runtime/ActiveQuery/Criteria.php - About 1 hr to fix

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

        public function getModifyTableIndicesDDL(TableDiff $tableDiff)
        {
            $ret = '';
    
            foreach ($tableDiff->getRemovedIndices() as $index) {
    Severity: Major
    Found in src/Propel/Generator/Platform/DefaultPlatform.php and 1 other location - About 1 hr to fix
    src/Propel/Generator/Platform/DefaultPlatform.php on lines 945..964

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

    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

        public function getModifyTableForeignKeysDDL(TableDiff $tableDiff)
        {
            $ret = '';
    
            foreach ($tableDiff->getRemovedFks() as $fk) {
    Severity: Major
    Found in src/Propel/Generator/Platform/DefaultPlatform.php and 1 other location - About 1 hr to fix
    src/Propel/Generator/Platform/DefaultPlatform.php on lines 918..937

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

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

        protected function parseTables(Database $database, Table $filterTable = null)
        {
            $sql = "
            SELECT name
            FROM sqlite_master
    Severity: Minor
    Found in src/Propel/Generator/Reverse/SqliteSchemaParser.php - About 1 hr to fix

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

          public function __call($name, $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 $method) {
      Severity: Minor
      Found in src/Propel/Runtime/ActiveQuery/ModelCriteria.php - About 1 hr to fix

        Method getTableOptions has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function getTableOptions(Table $table)
            {
                $dbVI = $table->getDatabase()->getVendorInfoForType('mysql');
                $tableVI = $table->getVendorInfoForType('mysql');
                $vi = $dbVI->getMergedVendorInfo($tableVI);
        Severity: Minor
        Found in src/Propel/Generator/Platform/MysqlPlatform.php - About 1 hr to fix

          Method addClassBody has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function addClassBody(&$script)
              {
                  $table = $this->getTable();
          
                  $this->declareClasses(
          Severity: Minor
          Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 1 hr to fix

            Method addGetPrimaryKeyFromRow has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function addGetPrimaryKeyFromRow(&$script)
                {
                    $script .= "
                /**
                 * Retrieves the primary key from the DB resultset row
            Severity: Minor
            Found in src/Propel/Generator/Builder/Om/TableMapBuilder.php - About 1 hr to fix

              Method addFindPk has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function addFindPk(&$script)
                  {
                      $class = $this->getObjectClassName();
                      $tableMapClassName = $this->getTableMapClassName();
                      $table = $this->getTable();
              Severity: Minor
              Found in src/Propel/Generator/Builder/Om/QueryBuilder.php - About 1 hr to fix

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

                    protected function addIndexes(Table $table, $oid)
                    {
                        $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 addSetByPosition has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function addSetByPosition(&$script)
                      {
                          $table = $this->getTable();
                          $script .= "
                      /**
                  Severity: Minor
                  Found in src/Propel/Generator/Builder/Om/ObjectBuilder.php - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language