duxet/laravel-rethinkdb

View on GitHub

Showing 15 of 15 total issues

Builder has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

class Builder extends QueryBuilder
{
    /**
     * The query instance.
     *
Severity: Minor
Found in src/Query/Builder.php - About 3 hrs to fix

    Method buildBasicFilter has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function buildBasicFilter($where)
        {
            $operator = isset($where['operator']) ? $where['operator'] : '=';
            $operator = strtolower($operator);
    
    
    Severity: Minor
    Found in src/RQL/FilterBuilder.php - About 2 hrs to fix

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

          public function getFresh($columns = [])
          {
              $this->compileOrders();
              $this->compileWheres();
      
      
      Severity: Minor
      Found in src/Query/Builder.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 compileWheres has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function compileWheres($wheres)
          {
              $chain = null;
      
              foreach ($wheres as $i => &$where) {
      Severity: Minor
      Found in src/RQL/FilterBuilder.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 $field->ne($value);
      Severity: Major
      Found in src/RQL/FilterBuilder.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $field->contains($value);
        Severity: Major
        Found in src/RQL/FilterBuilder.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return $field->typeOf()->eq('STRING')->rAnd($match);
          Severity: Major
          Found in src/RQL/FilterBuilder.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $field->typeOf()->eq('STRING')->rAnd($match);
            Severity: Major
            Found in src/RQL/FilterBuilder.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return $field->typeOf()->eq('ARRAY')->rAnd($size);
              Severity: Major
              Found in src/RQL/FilterBuilder.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return $field->typeOf()->eq('NUMBER')->rAnd($mod);
                Severity: Major
                Found in src/RQL/FilterBuilder.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return $field->typeOf()->eq(strtoupper($value));
                  Severity: Major
                  Found in src/RQL/FilterBuilder.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return ($value) ? $field : $field->not();
                    Severity: Major
                    Found in src/RQL/FilterBuilder.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                      return $field->typeOf()->eq('STRING')->rAnd($match);
                      Severity: Major
                      Found in src/RQL/FilterBuilder.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $field->eq($value);
                        Severity: Major
                        Found in src/RQL/FilterBuilder.php - About 30 mins to fix

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

                              private function nativeArray($val)
                              {
                                  if (is_array($val)) {
                                      foreach ($val as $k => $v) {
                                          $val[$k] = $this->nativeArray($v);
                          Severity: Minor
                          Found in src/Query.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