felixarntz/wp-site-identity

View on GitHub

Showing 71 of 247 total issues

Function sanitize_object_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    protected function sanitize_object_value( $value, $args ) {
        if ( $value instanceof stdClass ) {
            $value = (array) $value;
        }

Severity: Minor
Found in src/settings/class-wp-site-identity-setting-sanitizer.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 $value;
Severity: Major
Found in src/settings/class-wp-site-identity-setting-validator.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return $this->sanitize_string_value( $value, $args );
    Severity: Major
    Found in src/settings/class-wp-site-identity-setting-sanitizer.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return $this->sanitize_numeric_value( $value, $args );
      Severity: Major
      Found in src/settings/class-wp-site-identity-setting-sanitizer.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return $this->validate_string_value( $value, $args );
        Severity: Major
        Found in src/settings/class-wp-site-identity-setting-validator.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return $value;
          Severity: Major
          Found in src/settings/class-wp-site-identity-setting-sanitizer.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $this->validate_numeric_value( $value, $args );
            Severity: Major
            Found in src/settings/class-wp-site-identity-setting-validator.php - About 30 mins to fix

              Function get_as_html has a Cognitive Complexity of 6 (exceeds 5 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 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 wpsi_requirements_notice has a Cognitive Complexity of 6 (exceeds 5 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 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_current_tab has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function get_current_tab( array $settings_forms = null ) {
                      if ( null === $settings_forms ) {
                          $settings_forms = $this->plugin->services()->get( 'settings_form_registry' )->get_all_forms();
                      }
              
              
              Severity: Minor
              Found in src/class-wp-site-identity-bootstrap-admin-pages.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( $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 ) {
                      $this->prefix = $prefix;
                      $this->group  = $group;
              
                      $this->factory = new WP_Site_Identity_Setting_Factory( $this );
              Severity: Minor
              Found in src/settings/class-wp-site-identity-standard-setting-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

              Severity
              Category
              Status
              Source
              Language