felixarntz/plugin-lib

View on GitHub

Showing 458 of 821 total issues

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

        protected function render_tab_navigation( $current_tab_id ) {
            if ( count( $this->tabs ) > 1 ) {
                ?>
                <h2 class="nav-tab-wrapper">
                    <?php foreach ( $this->tabs as $tab_id => $tab_args ) : ?>
Severity: Minor
Found in src/components/tabbed-settings-page.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_wrap_attrs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public function get_wrap_attrs( $as_string = true ) {
            $this->maybe_resolve_dependencies();

            $wrap_attrs = array(
                'id'    => $this->get_id_attribute() . '-wrap',
Severity: Minor
Found in src/fields/field.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_data_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        protected function get_data_field( $field_path, $data ) {
            if ( empty( $field_path ) ) {
                return $data;
            }

Severity: Minor
Found in src/fields/autocomplete.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 load_class has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public static function load_class( $class_name ) {
            $parts = explode( '\\', $class_name );

            $vendor_name = array_shift( $parts );
            if ( ! isset( self::$namespaces[ $vendor_name ] ) ) {
Severity: Minor
Found in src/autoloader.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 post_validate_single has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        protected function post_validate_single( $value, $original_value = null ) {
            $value = parent::post_validate_single( $value, $original_value );

            if ( ! empty( $this->input_attrs['min'] ) ) {
                if ( empty( $original_value ) && $value === $this->input_attrs['min'] && is_string( $original_value ) && ! is_numeric( $original_value ) ) {
Severity: Minor
Found in src/fields/number.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public function get( $option, $default = false ) {
            if ( $this->is_stored_in_network( $option ) && is_multisite() ) {
                $site_id = get_current_blog_id();

                $options = get_network_option( null, $this->get_prefix() . $option, array() );
Severity: Minor
Found in src/options.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public function add( $option, $value ) {
            if ( $this->is_stored_in_network( $option ) && is_multisite() ) {
                $site_id = get_current_blog_id();

                $options = get_network_option( null, $this->get_prefix() . $option, array() );
Severity: Minor
Found in src/options.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 arrays_to_objects has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        protected function arrays_to_objects( $items ) {
            foreach ( $items as $slug => $item ) {
                if ( is_object( $item ) ) {
                    continue;
                }
Severity: Minor
Found in src/components/item-registry.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 check_handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        protected function check_handle( $handle, $src ) {
            $vendor_directory_names = implode( '|', array( 'vendor', 'node_modules', 'bower_components' ) );

            if ( ( preg_match( '/^(http|https):\/\//', $src ) || 0 === strpos( $src, '//' ) ) && ! strpos( $src, home_url() ) ) {
                $property_name = '.css' === substr( $src, -4 ) ? 'third_party_styles' : 'third_party_scripts';
Severity: Minor
Found in src/assets.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_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public function add_field( $id, $type, $args = array() ) {
            if ( ! isset( $args['section'] ) ) {
                return;
            }

Severity: Minor
Found in src/components/tabbed-settings-page.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 validate_values has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        protected function validate_values( $values, $option, $fields ) {
            $validated_values = get_option( $option, array() );

            foreach ( $fields as $id => $field ) {
                $value = isset( $values[ $id ] ) ? $values[ $id ] : null;
Severity: Minor
Found in src/components/settings-page.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_networks_with_option has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public function get_networks_with_option( $option ) {
            global $wpdb;

            if ( ! $this->is_stored_in_network( $option ) || ! is_multisite() ) {
                $value = $this->get( $option );
Severity: Minor
Found in src/options.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public function add( $id, $type, $args = array() ) {
            if ( ! self::is_field_type_registered( $type ) ) {
                return false;
            }

Severity: Minor
Found in src/fields/field-manager.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 enqueue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public function enqueue() {
            $ret = parent::enqueue();

            if ( version_compare( $GLOBALS['wp_version'], '4.8', '>=' ) ) {
                wp_enqueue_editor();
Severity: Minor
Found in src/fields/wysiwyg.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_for_all_sites has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public function get_for_all_sites( $option, $network_id = null ) {
            if ( ! $this->is_stored_in_network( $option ) || ! is_multisite() ) {
                $value = $this->get( $option );
                if ( false === $value ) {
                    return array();
Severity: Minor
Found in src/options.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 objects_to_arrays has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        protected function objects_to_arrays( $items ) {
            foreach ( $items as $slug => $item ) {
                if ( is_array( $item ) ) {
                    continue;
                }
Severity: Minor
Found in src/components/item-registry.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 error_notice has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        public static function error_notice() {
            foreach ( self::$instances as $plugin ) {
                if ( ! is_wp_error( $plugin->error() ) ) {
                    continue;
                }
Severity: Minor
Found in plugin-loader.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 bootstrap_instance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        private static function bootstrap_instance( $instance, $main_file ) {
            $instance->load();

            add_action( 'plugins_loaded', array( $instance, 'start' ) );

Severity: Minor
Found in plugin-loader.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