lightspeeddevelopment/lsx-search

View on GitHub

Showing 1,518 of 1,518 total issues

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

        if (dropdown.parents('form').find('.combination-toggle.selected').length > 0) {
            dropdown.parents('form').find('.combination-toggle.selected button').attr('data-selection','0');
            var default_title = dropdown.parents('form').find('.combination-toggle.selected a.default').html();
            dropdown.parents('form').find('.combination-toggle.selected button').html(default_title+' <span class="caret"></span>');
            dropdown.parents('form').find('.combination-toggle.selected').removeClass('selected').addClass('hidden');
Severity: Major
Found in assets/js/src/lsx-search.js and 1 other location - About 6 hrs to fix
assets/js/src/lsx-search.js on lines 253..258

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 155.

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

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

        if (dropdown.parents('form').find('.combination-toggle.selected').length > 0) {
            dropdown.parents('form').find('.combination-toggle.selected button').attr('data-selection','0');
            var default_title = dropdown.parents('form').find('.combination-toggle.selected a.default').html();
            dropdown.parents('form').find('.combination-toggle.selected button').html(default_title+' <span class="caret"></span>');
            dropdown.parents('form').find('.combination-toggle.selected').removeClass('selected').addClass('hidden');
Severity: Major
Found in assets/js/src/lsx-search.js and 1 other location - About 6 hrs to fix
assets/js/src/lsx-search.js on lines 266..271

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 155.

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

Frontend has 45 functions (exceeds 25 allowed). Consider refactoring.
Open

class Frontend {

    /**
     * Holds class instance
     *
Severity: Minor
Found in classes/class-frontend.php - About 5 hrs to fix

    Function destination_facet_render has a Cognitive Complexity of 54 (exceeds 25 allowed). Consider refactoring.
    Open

        public function destination_facet_render( $params ) {
            $facet = $params['facet'];
    
            $output = '';
            $values = (array) $params['values'];
    Severity: Minor
    Found in classes/facetwp/class-post-connections.php - About 5 hrs 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 facetwp_index_row_data has a Cognitive Complexity of 39 (exceeds 25 allowed). Consider refactoring.
    Open

        public function facetwp_index_row_data( $rows, $params ) {
            switch ( $params['facet']['source'] ) {
                case 'cf/destination_to_tour':
                case 'cf/destination_to_accommodation':
                    $countries = array();
    Severity: Minor
    Found in classes/facetwp/class-post-connections.php - About 2 hrs 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 search_form has a Cognitive Complexity of 34 (exceeds 25 allowed). Consider refactoring.
    Open

        public function search_form( $atts = array() ) {
            $classes = 'search-form lsx-search-form form-inline';
    
            if ( isset( $atts['class'] ) ) {
                $classes .= $atts['class'];
    Severity: Minor
    Found in classes/class-lsx-search-shortcode.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 set_search_prefix has a Cognitive Complexity of 33 (exceeds 25 allowed). Consider refactoring.
    Open

        private function set_search_prefix( $new_prefixes = false ) {
            $page_for_posts = get_option( 'page_for_posts' );
            if ( false !== $new_prefixes ) {
                $this->taxonomies = array();
                $this->post_types = array();
    Severity: Minor
    Found in classes/class-frontend.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 configure_settings_search_archive_fields has a Cognitive Complexity of 27 (exceeds 25 allowed). Consider refactoring.
    Open

        public function configure_settings_search_archive_fields( $cmb ) {
            $archives       = array();
            $post_type_args = array(
                'public' => true,
            );
    Severity: Minor
    Found in classes/class-admin.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

    The property -moz-box-direction is compatible with -webkit-box-direction and should be included as well.
    Open

    .wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -ms-flex-direction: row; flex-direction: row; }
    Severity: Minor
    Found in assets/css/lsx-search-admin-rtl.css by csslint

    Adjoining classes: .wp-admin.settings_page_lsx-search-settings .wp-filter .filter-links .current
    Open

    .wp-admin.settings_page_lsx-search-settings .wp-filter .filter-links .current { border-bottom: none; font-weight: 600; color: #23282d; }
    Severity: Minor
    Found in assets/css/lsx-search-admin.css by csslint

    The property -ms-box-direction is compatible with -webkit-box-direction and should be included as well.
    Open

    .wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -ms-flex-direction: row; flex-direction: row; }
    Severity: Minor
    Found in assets/css/lsx-search-admin.css by csslint

    Adjoining classes: .wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row h3.cmb2-metabox-title
    Open

    .wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row h3.cmb2-metabox-title { color: #23282d; font-size: 17px; margin: 1em 0; font-weight: 600; -webkit-font-smoothing: subpixel-antialiased; line-height: 1.4em; margin-bottom: 0px; }
    Severity: Minor
    Found in assets/css/lsx-search-admin.css by csslint

    Rule doesn't have all its properties in alphabetical order.
    Open

    .wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row h3.cmb2-metabox-title { color: #23282d; font-size: 17px; margin: 1em 0; font-weight: 600; -webkit-font-smoothing: subpixel-antialiased; line-height: 1.4em; margin-bottom: 0px; }
    Severity: Minor
    Found in assets/css/lsx-search-admin.css by csslint

    Adjoining classes: ul.products.list li.product .gridlist-buttonwrap
    Open

    ul.products.list li.product .gridlist-buttonwrap { margin-bottom: 1.5em; }
    Severity: Minor
    Found in assets/css/lsx-search-rtl.css by csslint

    Rule doesn't have all its properties in alphabetical order.
    Open

      .search .facetwp-sidebar.widget-area, .archive .facetwp-sidebar.widget-area, .blog .facetwp-sidebar.widget-area { padding: 0px 20px 20px 20px; margin-top: 4.25rem; max-width: 271px; margin-right: 5px; margin-left: 5px; }
    Severity: Minor
    Found in assets/css/lsx-search-rtl.css by csslint

    Using width with padding can sometimes make elements larger than you expect.
    Open

    .facetwp-type-search .facetwp-search-wrap .facetwp-search { display: block; width: 100%; height: 50px; color: #4a4a4a; background-color: #fff; background-image: none; border: 1px solid #ddd; border-radius: 2px; border-width: 2px; -webkit-box-shadow: none; box-shadow: none; font-size: 18px; line-height: 1.33; padding: 10px 20px; -webkit-transition: all 150ms ease; transition: all 150ms ease; }
    Severity: Minor
    Found in assets/css/lsx-search-rtl.css by csslint

    Don't use IDs in selectors.
    Open

    @media (min-width: 768px) { #secondary.facetwp-sidebar .facetwp-row { border-radius: 3px 3px 3px 3px; } }
    Severity: Minor
    Found in assets/css/lsx-search-rtl.css by csslint

    Adjoining classes: .lsx-search-form .field.submit-button
    Open

    .lsx-search-form .field.submit-button { width: 20%; }
    Severity: Minor
    Found in assets/css/lsx-search-rtl.css by csslint

    Adjoining classes: .archive .facetwp-sidebar.widget-area .lsx-search-title.lsx-to-search-title-results
    Open

      .blog .facetwp-sidebar.widget-area .lsx-search-title.lsx-to-search-title-results, .archive .facetwp-sidebar.widget-area .lsx-search-title.lsx-to-search-title-results, .search-results .facetwp-sidebar.widget-area .lsx-search-title.lsx-to-search-title-results, .search-no-results .facetwp-sidebar.widget-area .lsx-search-title.lsx-to-search-title-results { padding-bottom: 2rem; } }
    Severity: Minor
    Found in assets/css/lsx-search-rtl.css by csslint

    Adjoining classes: .blog .facetwp-sidebar.widget-area .lsx-search-title.lsx-to-search-title-results
    Open

      .blog .facetwp-sidebar.widget-area .lsx-search-title.lsx-to-search-title-results, .archive .facetwp-sidebar.widget-area .lsx-search-title.lsx-to-search-title-results, .search-results .facetwp-sidebar.widget-area .lsx-search-title.lsx-to-search-title-results, .search-no-results .facetwp-sidebar.widget-area .lsx-search-title.lsx-to-search-title-results { padding-bottom: 2rem; } }
    Severity: Minor
    Found in assets/css/lsx-search-rtl.css by csslint
    Severity
    Category
    Status
    Source
    Language