felixarntz/theme-boilerplate

View on GitHub

Showing 194 of 194 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function __call( $method, $args ) {
        switch ( $method ) {
            case 'handle_ajax_comment':
            case 'add_main_script_data':
            case 'maybe_enqueue_comment_reply_script':
Severity: Minor
Found in inc/library/comments/class-comments.php and 1 other location - About 35 mins to fix
inc/library/image-sizes/class-image-sizes.php on lines 97..107

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    public function __call( $method, $args ) {
        switch ( $method ) {
            case 'register_sizes':
            case 'filter_selectable_sizes':
            case 'calculate_content_image_sizes':
Severity: Minor
Found in inc/library/image-sizes/class-image-sizes.php and 1 other location - About 35 mins to fix
inc/library/comments/class-comments.php on lines 122..132

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 92.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

                Avoid too many return statements within this method.
                Open

                                    return $post_types;
                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( $post_types );
                  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;
                    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 matches[1];
                      Severity: Major
                      Found in assets/vendor/selectWoo/dist/js/selectWoo.full.js - About 30 mins to fix

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            public function register_font( Super_Awesome_Theme_Font $font ) {
                                $id = $font->get_prop( Super_Awesome_Theme_Font::PROP_ID );
                        
                                if ( isset( $this->fonts[ $id ] ) ) {
                                    return false;
                        Severity: Minor
                        Found in inc/library/fonts/class-fonts.php and 1 other location - About 30 mins to fix
                        inc/library/colors/class-colors.php on lines 81..94

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 90.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 2 locations. Consider refactoring.
                        Open

                            public function register_color( Super_Awesome_Theme_Color $color ) {
                                $id = $color->get_prop( Super_Awesome_Theme_Color::PROP_ID );
                        
                                if ( isset( $this->colors[ $id ] ) ) {
                                    return false;
                        Severity: Minor
                        Found in inc/library/colors/class-colors.php and 1 other location - About 30 mins to fix
                        inc/library/fonts/class-fonts.php on lines 86..99

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 90.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Severity
                        Category
                        Status
                        Source
                        Language