Thruio/ActiveRecord

View on GitHub

Showing 46 of 50 total issues

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

    public function processUpdate(DatabaseLayer\Update $thing)
    {
        // SELECTORS
        if (count($thing->getTables()) > 1) {
            throw new Exception("Active Record Cannot update into more than one table at a time!");
Severity: Minor
Found in src/DatabaseLayer/Sql/Mysql.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

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

    public function processInsert(DatabaseLayer\Insert $thing)
    {
        // SELECTORS
        if (count($thing->getTables()) > 1) {
            throw new Exception("Active Record Cannot insert into more than one table at a time!");
Severity: Minor
Found in src/DatabaseLayer/Sql/Mysql.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

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

    public function query($query, $model = 'StdClass')
    {
        try {
            $result = parent::query($query, $model);
            $error = parent::errorInfo();
Severity: Minor
Found in src/DatabaseLayer/Sql/Sqlite.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

Avoid too many return statements within this method.
Open

                return $this->processPassthru($thing);
Severity: Major
Found in src/DatabaseLayer/Sql/GenericSql.php - About 30 mins to fix

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

        public function __fieldFix()
        {
            $schema = $this->getClassSchema();
            foreach ($this->__calculateSaveDownRows() as $column) {
                if (!isset($schema[$column]['type'])) {
    Severity: Minor
    Found in src/ActiveRecord.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

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

        public function handleError($model, $query, \PDOException $e)
        {
            // echo "*** Model in handleError: " . $model . "\n";
            switch ($e->getCode()) {
              // MySQL table missing
    Severity: Minor
    Found in src/DatabaseLayer/Sql/Base.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