tripal_chado/src/Database/ChadoSchema.php

Summary

Maintainability
C
7 hrs
Test Coverage
F
30%

Function getMainTables has a Cognitive Complexity of 23 (exceeds 7 allowed). Consider refactoring.
Open

  public function getMainTables() {

    // Initialize the base tables with those tables that are missing a type.
    // Ideally they should have a type, but that's for a future version of Chado.
    $base_tables = [
Severity: Minor
Found in tripal_chado/src/Database/ChadoSchema.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

Consider simplifying this complex logical expression.
Open

        if ($tablename == 'cvterm_dbxref' || $tablename == 'cvterm_relationship' ||
          $tablename == 'cvtermpath' || $tablename == 'cvtermprop' || $tablename == 'chadoprop' ||
          $tablename == 'cvtermsynonym' || preg_match('/_relationship$/', $tablename) ||
          preg_match('/_cvterm$/', $tablename) ||
          // Ignore prop tables
Severity: Critical
Found in tripal_chado/src/Database/ChadoSchema.php - About 2 hrs to fix

    Function getSchemaDef has a Cognitive Complexity of 17 (exceeds 7 allowed). Consider refactoring.
    Open

      public function getSchemaDef(array $parameters) :array {
        static $schema_structure = [];
    
        $source = $parameters['source'] ?? 'file';
        $format = strtolower($parameters['format'] ?? '');
    Severity: Minor
    Found in tripal_chado/src/Database/ChadoSchema.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

    There are no issues that match your filters.

    Category
    Status