gios-asu/nectary

View on GitHub

Showing 26 of 26 total issues

Function sanitize_order_by has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    function sanitize_order_by( $string ) {
        if ( strtolower( trim( rtrim( $string ) ) ) === 'rand()' ) {
            return 'RAND()'; }
        if ( strrpos( $string, ';' ) !== false ) {
            return ''; }
Severity: Minor
Found in src/utilities/dao-utilities.php - About 3 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

Function get_unique_items has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_unique_items() : array {
        $unique = [];

        foreach ( $this->items as $i => $item_a ) {
            $duplicate = false;
Severity: Minor
Found in src/models/implementations/json-feed.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

Method to_title_case has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function to_title_case( $title ) {
        $title = (string) $title;
        // Our array of 'small words' which shouldn't be capitalised if
        // they aren't the first word. Add your own words to taste.
        $small_words = array(
Severity: Minor
Found in src/utilities/string-utilities.php - About 1 hr to fix

    Method do_route has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function do_route( $class_name, $method_name, $named_arguments, $on_error ) {
            if ( \is_object( $class_name ) ) {
                return $this->call(
                    array(
                        $class_name,
    Severity: Minor
    Found in src/routers/router.php - About 1 hr to fix

      Function add_data has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          public function add_data( $data ) : View_Factory {
              if ( \is_array( $data ) ) {
                  foreach ( $data as $key => $value ) {
                      $data_to_add = $value;
                      if ( $value instanceof Presentable_Model ) {
      Severity: Minor
      Found in src/factories/implementations/view-factory.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

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

          function present( $any, array $options = [] ) {
              $presented = null;
      
              if ( is_array( $any ) ) {
                  $presented = [];
      Severity: Minor
      Found in src/utilities/view-utilities.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 validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function validate( $error_callback ) {
              $rules = $this->validation_rules();
      
              $results = [];
      
      
      Severity: Minor
      Found in src/requests/request.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

      Avoid too many return statements within this method.
      Open

              return $value;
      Severity: Major
      Found in src/view/extensions/handlebars-view.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return ''; }
        Severity: Major
        Found in src/utilities/dao-utilities.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $string;
          Severity: Major
          Found in src/utilities/dao-utilities.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return ''; }
            Severity: Major
            Found in src/utilities/dao-utilities.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return false;
              Severity: Major
              Found in src/view/extensions/handlebars-view.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return $value_a > $value_b;
                Severity: Major
                Found in src/view/extensions/handlebars-view.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return ''; }
                  Severity: Major
                  Found in src/utilities/dao-utilities.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return $value_a || $value_b;
                    Severity: Major
                    Found in src/view/extensions/handlebars-view.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return ''; }
                      Severity: Major
                      Found in src/utilities/dao-utilities.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return $value_a && $value_b;
                        Severity: Major
                        Found in src/view/extensions/handlebars-view.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return ''; }
                          Severity: Major
                          Found in src/utilities/dao-utilities.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return ''; }
                            Severity: Major
                            Found in src/utilities/dao-utilities.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                              return $value_a >= $value_b;
                              Severity: Major
                              Found in src/view/extensions/handlebars-view.php - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language