propelorm/Propel2

View on GitHub
src/Propel/Generator/Reverse/OracleSchemaParser.php

Summary

Maintainability
C
1 day
Test Coverage

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

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

    Function parse has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function parse(Database $database, array $additionalTables = []): int
        {
            $tables = [];
            /** @var \PDOStatement $stmt */
            $stmt = $this->dbh->query("SELECT OBJECT_NAME FROM USER_OBJECTS WHERE OBJECT_TYPE = 'TABLE'");
    Severity: Minor
    Found in src/Propel/Generator/Reverse/OracleSchemaParser.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 parse has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function parse(Database $database, array $additionalTables = []): int
        {
            $tables = [];
            /** @var \PDOStatement $stmt */
            $stmt = $this->dbh->query("SELECT OBJECT_NAME FROM USER_OBJECTS WHERE OBJECT_TYPE = 'TABLE'");
    Severity: Minor
    Found in src/Propel/Generator/Reverse/OracleSchemaParser.php - About 1 hr to fix

      Function addIndexes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function addIndexes(Table $table): void
          {
              $columnNamesIndexedByIndexName = $this->getColumnNamesIndexedByIndexName($table);
      
              foreach ($columnNamesIndexedByIndexName as $indexName => $columnNames) {
      Severity: Minor
      Found in src/Propel/Generator/Reverse/OracleSchemaParser.php - About 45 mins 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

      There are no issues that match your filters.

      Category
      Status