felixarntz/theme-boilerplate

View on GitHub

Showing 153 of 194 total issues

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

    public function __call( $method, $args ) {
        switch ( $method ) {
            case 'register_main_assets':
            case 'disable_special_page_styles':
            case 'print_detect_js_svg_support_script':
Severity: Minor
Found in inc/library/assets/class-assets.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 add_dropdown_icon_to_menu_link has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function add_dropdown_icon_to_menu_link( $title, $item, $args ) {
        if ( in_array( $args->theme_location, array( 'primary', 'primary_df' ), true ) ) {
            foreach ( $item->classes as $value ) {
                if ( 'menu-item-has-children' === $value || 'page_item_has_children' === $value ) {
                    $title .= $this->get_dependency( 'icons' )->get_svg( 'angle-down' );
Severity: Minor
Found in inc/library/navbar/class-navbar.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 register_widget_areas has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function register_widget_areas( $widgets ) {
        $widgets->register_widget_area( new Super_Awesome_Theme_Widget_Area(
            'primary',
            array(
                Super_Awesome_Theme_Widget_Area::PROP_TITLE       => __( 'Primary Sidebar', 'super-awesome-theme' ),
Severity: Minor
Found in inc/library/sidebar/class-sidebar.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 deeply nested control flow statements.
Open

                    if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
                        continue;
                    } else if (i > 0) {
                        name.splice(i - 1, 2);
                        i -= 2;
Severity: Major
Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 45 mins to fix

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

        private function get_jed_locale_data_for_domain( $domain ) {
            $translations = get_translations_for_domain( $domain );
    
            $locale = array(
                '' => array(
    Severity: Minor
    Found in inc/library/assets/class-assets.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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function render( array $instance ) {
            $login_url      = '';
            $login_label    = '';
            $register_url   = '';
            $register_label = '';
    Severity: Minor
    Found in inc/library/widgets/class-login-links-widget.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 super_awesome_theme_infinite_scroll_render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    function super_awesome_theme_infinite_scroll_render() {
        while ( have_posts() ) {
            the_post();
            if ( is_search() ) :
                get_template_part( 'template-parts/content', 'search' );
    Severity: Minor
    Found in inc/plugin-compat/jetpack.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 add_size has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function add_size( $slug, $width, $height, $crop = false, $selectable = false ) {
    Severity: Minor
    Found in inc/library/image-sizes/class-image-sizes.php - About 35 mins to fix

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

          initializeDropdownMenus( menu ) {
              const options = this.options;
      
              let parentLinks;
      
      
      Severity: Minor
      Found in assets/src/js/theme/navigation.js - 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

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

          public function get_svg( $icon, array $args = array() ) {
              $this->needs_svg = true;
      
              $args = wp_parse_args( $args, array(
                  'title'    => '',
      Severity: Minor
      Found in inc/library/icons/class-icons.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

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

          initializeMenuFocus( menu ) {
              let links;
      
              if ( ! menu ) {
                  return;
      Severity: Minor
      Found in assets/src/js/theme/navigation.js - 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

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

      function super_awesome_theme_get_template_part( $slug, $name = null, $data = null ) {
          global $wp_query;
      
          $do_change = false;
          if ( null !== $data ) {
      Severity: Minor
      Found in inc/template-functions.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

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

          protected function add_menu_social_icons( $item_output, $item, $depth, $args ) {
              if ( $this->link_before === $args->link_before && $this->link_after === $args->link_after ) {
                  $social_icons = $this->get_social_links_icons();
      
                  foreach ( $social_icons as $attr => $value ) {
      Severity: Minor
      Found in inc/library/social-navigation/class-social-navigation.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 function.
      Open

          return method;
      Severity: Major
      Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                            return;
        Severity: Major
        Found in inc/library/content-types/class-content-types.php - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return null;
          Severity: Major
          Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return '';
            Severity: Major
            Found in inc/library/content-types/class-content-types.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                      return reset( $taxonomy->object_type );
              Severity: Major
              Found in inc/library/content-types/class-content-types.php - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return null;
                Severity: Major
                Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return null;
                  Severity: Major
                  Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language