felixarntz/wp-site-identity

View on GitHub

Showing 71 of 247 total issues

Method action_render_settings_page has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function action_render_settings_page( $admin_page ) {
        if ( ! is_a( $admin_page, 'WP_Site_Identity_Admin_Submenu_Page' ) || 'options-general.php' !== $admin_page->get_parent_slug() ) {
            require ABSPATH . 'wp-admin/options-head.php';
        }

Severity: Minor
Found in src/class-wp-site-identity-bootstrap-admin-pages.php - About 1 hr to fix

    Method set_default_default_for_type has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function set_default_default_for_type( array $args ) {
            $type = isset( $args['type'] ) ? $args['type'] : '';
            $min  = isset( $args['min'] ) ? $args['min'] : false;
    
            switch ( $type ) {
    Severity: Minor
    Found in src/settings/class-wp-site-identity-setting-factory.php - About 1 hr to fix

      Method build_rest_schema_for_wp has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function build_rest_schema_for_wp( WP_Site_Identity_Setting $setting ) {
              $default_schema = array(
                  'type'        => $setting->get_type(),
                  'description' => $setting->get_description(),
                  'default'     => $setting->get_default(),
      Severity: Minor
      Found in src/settings/class-wp-site-identity-standard-setting-registry.php - About 1 hr to fix

        Function initializeImageField has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function initializeImageField( field ) {
                var selectButton = document.createElement( 'button' );
                var deleteButton = document.createElement( 'button' );
                var value        = parseInt( field.value, 10 );
                var attachment   = document.getElementById( field.id + '-attachment-data' );
        Severity: Minor
        Found in assets/dist/js/settings-page.js - About 1 hr to fix

          Function initializeImageField has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function initializeImageField( field ) {
                  var selectButton = document.createElement( 'button' );
                  var deleteButton = document.createElement( 'button' );
                  var value        = parseInt( field.value, 10 );
                  var attachment   = document.getElementById( field.id + '-attachment-data' );
          Severity: Minor
          Found in assets/src/js/settings-page.js - About 1 hr to fix

            Method wpsi_requirements_notice has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function wpsi_requirements_notice() {
                $plugin_file = plugin_basename( __FILE__ );
            
                // WordPress before 4.9 didn't have a dedicated capability for this.
                if ( version_compare( $GLOBALS['wp_version'], '4.9', '<' ) ) {
            Severity: Minor
            Found in wp-site-identity.php - About 1 hr to fix

              Method get_as_html has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function get_as_html( $name ) {
                      switch ( $name ) {
                          case 'phone_link':
                          case 'email_link':
                          case 'website_link':
              Severity: Minor
              Found in src/class-wp-site-identity-owner-data.php - About 1 hr to fix

                Function validate_numeric_value has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function validate_numeric_value( $value, $args ) {
                        if ( ! is_numeric( $value ) ) {
                            /* translators: 1: value, 2: type name */
                            throw new WP_Site_Identity_Setting_Validation_Error_Exception( sprintf( __( '%1$s is not of type %2$s.', 'wp-site-identity' ), $value, $args['type'] ) );
                        }
                Severity: Minor
                Found in src/settings/class-wp-site-identity-setting-validator.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 action_handle_settings_page has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function action_handle_settings_page() {
                        $setting_registry = $this->plugin->services()->get( 'setting_registry' );
                
                        $factory = $this->plugin->services()->get( 'settings_form_registry' )->factory();
                
                
                Severity: Minor
                Found in src/class-wp-site-identity-bootstrap-admin-pages.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

                Method action_enqueue_settings_page has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function action_enqueue_settings_page() {
                        $dependencies = array();
                        $l10n         = array();
                
                        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
                Severity: Minor
                Found in src/class-wp-site-identity-bootstrap-admin-pages.php - About 1 hr to fix

                  Function get_theme_support has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function get_theme_support( $feature ) {
                          $support = get_theme_support( 'wp_site_identity' );
                          if ( ! $support ) {
                              return false;
                          }
                  Severity: Minor
                  Found in src/class-wp-site-identity.php - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function __construct( $slug, array $args = array(), WP_Site_Identity_Admin_Page_Registry $registry = null ) {
                          $this->slug = $slug;
                  
                          if ( ! empty( $args['title'] ) ) {
                              $this->title = $args['title'];
                  Severity: Minor
                  Found in src/admin-pages/class-wp-site-identity-admin-page.php - About 55 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_rest_schema_for_wp has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function build_rest_schema_for_wp( WP_Site_Identity_Setting $setting ) {
                          $default_schema = array(
                              'type'        => $setting->get_type(),
                              'description' => $setting->get_description(),
                              'default'     => $setting->get_default(),
                  Severity: Minor
                  Found in src/settings/class-wp-site-identity-standard-setting-registry.php - About 55 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 action_render_settings_page has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function action_render_settings_page( $admin_page ) {
                          if ( ! is_a( $admin_page, 'WP_Site_Identity_Admin_Submenu_Page' ) || 'options-general.php' !== $admin_page->get_parent_slug() ) {
                              require ABSPATH . 'wp-admin/options-head.php';
                          }
                  
                  
                  Severity: Minor
                  Found in src/class-wp-site-identity-bootstrap-admin-pages.php - About 55 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 attrs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function attrs( array $attrs ) {
                          foreach ( $attrs as $attr => $value ) {
                              if ( is_array( $value ) || is_object( $value ) ) {
                                  $value = wp_json_encode( $value );
                              }

                  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_object_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function validate_object_value( $value, $args ) {
                          if ( $value instanceof stdClass ) {
                              $value = (array) $value;
                          }
                  
                  
                  Severity: Minor
                  Found in src/settings/class-wp-site-identity-setting-validator.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

                  Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public function __construct( $id_base, $name, $description, $render_callback, array $fields = array(), WP_Site_Identity_Widget_Registry $registry = null ) {
                  Severity: Minor
                  Found in src/widgets/class-wp-site-identity-widget.php - About 45 mins to fix

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

                        protected function generate_schema_for_setting( $setting ) {
                            $base_schema = array(
                                'type'        => $setting->get_type(),
                                'description' => $setting->get_description(),
                                'default'     => $setting->get_default(),
                    Severity: Minor
                    Found in src/settings/class-wp-site-identity-aggregate-setting.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

                    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function __construct( $prefix, $group, WP_Site_Identity_Setting_Feedback_Handler $feedback_handler = null, WP_Site_Identity_Setting_Validator $validator = null, WP_Site_Identity_Setting_Sanitizer $sanitizer = null ) {
                    Severity: Minor
                    Found in src/settings/class-wp-site-identity-standard-setting-registry.php - About 35 mins to fix

                      Method create_widget has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          public function create_widget( $id_base, $name, $description, $render_callback, array $fields = array() ) {
                      Severity: Minor
                      Found in src/widgets/class-wp-site-identity-widget-factory.php - About 35 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language