propelorm/Propel2

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

Summary

Maintainability
B
6 hrs
Test Coverage

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

    protected function addIndexes(Table $table)
    {
        $dataFetcher = $this->dbh->query("sp_indexes_rowset '" . $table->getName() . "'");
        $dataFetcher->setStyle(\PDO::FETCH_ASSOC);

Severity: Minor
Found in src/Propel/Generator/Reverse/MssqlSchemaParser.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 addColumns has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function addColumns(Table $table)
    {
        $dataFetcher = $this->dbh->query("sp_columns '" . $table->getName() . "'");
        $dataFetcher->setStyle(\PDO::FETCH_ASSOC);

Severity: Minor
Found in src/Propel/Generator/Reverse/MssqlSchemaParser.php - About 1 hr to fix

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

        protected function addIndexes(Table $table)
        {
            $dataFetcher = $this->dbh->query("sp_indexes_rowset '" . $table->getName() . "'");
            $dataFetcher->setStyle(\PDO::FETCH_ASSOC);
    
    
    Severity: Minor
    Found in src/Propel/Generator/Reverse/MssqlSchemaParser.php - About 1 hr to fix

      Method addForeignKeys has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function addForeignKeys(Table $table)
          {
              $database = $table->getDatabase();
              
              $dataFetcher = $this->dbh->query("select fk.name as CONSTRAINT_NAME, lcol.name as COLUMN_NAME, rtab.name as FK_TABLE_NAME, rcol.name as FK_COLUMN_NAME
      Severity: Minor
      Found in src/Propel/Generator/Reverse/MssqlSchemaParser.php - About 1 hr to fix

        Function addColumns has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            protected function addColumns(Table $table)
            {
                $dataFetcher = $this->dbh->query("sp_columns '" . $table->getName() . "'");
                $dataFetcher->setStyle(\PDO::FETCH_ASSOC);
        
        
        Severity: Minor
        Found in src/Propel/Generator/Reverse/MssqlSchemaParser.php - About 35 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

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

            public function parse(Database $database, array $additionalTables = [])
            {
                $dataFetcher = $this->dbh->query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME <> 'dtproperties'");
        
                // First load the tables (important that this happen before filling out details of tables)
        Severity: Minor
        Found in src/Propel/Generator/Reverse/MssqlSchemaParser.php - About 25 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