Pink-Crab/WPDB-Table-Builder

View on GitHub

Showing 3 of 3 total issues

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

    protected function type_mapper( string $type, ?int $length, ?int $precision ): string {
        $type = strtoupper( $type );
        switch ( $type ) {
            // With length
            case 'CHAR':
Severity: Minor
Found in src/Engines/WPDB_DB_Delta/DB_Delta_Translator.php - About 1 hr to fix

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            Schema $schema,
            array $validation_errors,
            string $message = '',
            int $code = 0,
            ?Throwable $previous = null
    Severity: Minor
    Found in src/Exception/WPDB_DB_Delta/WPDB_Validator_Exception.php - About 35 mins to fix

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

          public function validate_foreign_keys( Schema $schema ): void {
              // All defined colum names.
              $column_names = array_keys( $schema->get_columns() );
      
              // Missing columns in local table
      Severity: Minor
      Found in src/Engines/WPDB_DB_Delta/DB_Delta_Validator.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

      Severity
      Category
      Status
      Source
      Language