felixarntz/plugin-lib

View on GitHub

Showing 458 of 821 total issues

Avoid too many return statements within this method.
Open

            return metadata_exists( $meta_type, $object_id, $meta_key );
Severity: Major
Found in src/meta.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

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

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

              public function query( $query ) {
                  if ( isset( $query['fields'] ) ) {
                      if ( 'ids' === $query['fields'] ) {
                          $query['fields'] = 'ID';
                      } else {
      Severity: Minor
      Found in src/db-objects/queries/user-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

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

              public static function get_args_parsers() {
                  $reflection = new ReflectionClass( get_called_class() );
                  $methods    = $reflection->getMethods( ReflectionMethod::IS_STATIC );
      
                  $parsers = array();
      Severity: Minor
      Found in src/traits/args-service-trait.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 __construct has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public function __construct( $manager ) {
                  $this->manager = $manager;
      
                  $this->fetcher = new CLI_Model_Fetcher( $this->manager );
      
      
      Severity: Minor
      Found in src/db-objects/cli-models-command.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 build_columns has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              protected function build_columns() {
                  $columns       = array();
                  $columns['cb'] = '<input type="checkbox" />';
      
                  if ( method_exists( $this->manager, 'get_title_property' ) ) {
      Severity: Minor
      Found in src/db-objects/models-list-table.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 set_value_type_safe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              protected function set_value_type_safe( $property, $value ) {
                  if ( is_int( $this->$property ) ) {
                      $this->$property = intval( $value );
                  } elseif ( is_float( $this->$property ) ) {
                      $this->$property = floatval( $value );
      Severity: Minor
      Found in src/db-objects/model.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 add_hooks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public function add_hooks() {
                  if ( $this->hooks_added ) {
                      return false;
                  }
      
      
      Severity: Minor
      Found in src/traits/hook-service-trait.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 maybe_set_slug_property has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public function maybe_set_slug_property( $ret, $model ) {
                  $slug_property = $this->get_slug_property();
      
                  if ( empty( $model->$slug_property ) ) {
                      $generated_slug = $this->generate_slug( $model );
      Severity: Minor
      Found in src/db-objects/traits/slug-manager-trait.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 get_meta_orderby_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              private function get_meta_orderby_fields() {
                  if ( empty( $this->meta_query->queries ) ) {
                      return array();
                  }
      
      
      Severity: Minor
      Found in src/db-objects/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

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

              public function __construct( $manager ) {
                  $this->manager = $manager;
      
                  $prefix = $this->manager->get_prefix();
                  if ( '_' === substr( $prefix, -1 ) ) {
      Severity: Minor
      Found in src/db-objects/rest-models-controller.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 register_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public function register_action( $name, $callback, $args = array() ) {
                  if ( doing_action( 'admin_init' ) || did_action( 'admin_init' ) ) {
                      return new WP_Error( 'ajax_registered_too_late', sprintf( $this->get_translation( 'ajax_registered_too_late' ), '<code>admin_init</code>' ) );
                  }
      
      
      Severity: Minor
      Found in src/ajax.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 set_args has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              protected function set_args( $args ) {
                  parent::set_args( $args );
      
                  if ( ! isset( $this->args['label'] ) ) {
                      $this->args['label'] = '';
      Severity: Minor
      Found in src/db-objects/model-type.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 sync_downstream has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public function sync_downstream() {
                  if ( ! $this->primary_property_value() ) {
                      return new WP_Error( 'db_fetch_error_missing_id', $this->manager->get_message( 'db_fetch_error_missing_id' ) );
                  }
      
      
      Severity: Minor
      Found in src/db-objects/model.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 sanitize_set_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public function sanitize_set_status( $status, $request, $parameter ) {
                  $capabilities = $this->manager->capabilities();
      
                  $public_statuses = $this->manager->statuses()->get_public();
      
      
      Severity: Minor
      Found in src/db-objects/rest-models-controller.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 get_table has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public function get_table( $table, $mode = 'raw' ) {
                  if ( ! $this->table_exists( $table ) ) {
                      return null;
                  }
      
      
      Severity: Minor
      Found in src/db.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 remove_hooks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public function remove_hooks() {
                  if ( ! $this->hooks_added ) {
                      return false;
                  }
      
      
      Severity: Minor
      Found in src/traits/hook-service-trait.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 to_json has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public function to_json( $include_meta = true ) {
                  $data = array(
                      'total'  => $this->total,
                      'fields' => $this->fields,
                      'models' => $this->models,
      Severity: Minor
      Found in src/db-objects/collection.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 set_unique_slug has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public function set_unique_slug( $model, $slug = '' ) {
                  $primary_property = $this->get_primary_property();
                  $slug_property    = $this->get_slug_property();
      
                  if ( empty( $slug ) ) {
      Severity: Minor
      Found in src/db-objects/traits/slug-manager-trait.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 map_matches_to_query_vars has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              public function map_matches_to_query_vars( $matches ) {
                  $query_vars = array();
      
                  foreach ( $matches as $key => $value ) {
                      if ( is_numeric( $key ) ) {
      Severity: Minor
      Found in src/db-objects/view-routing.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