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');
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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');
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Frontend
has 45 functions (exceeds 25 allowed). Consider refactoring. Open
class Frontend {
/**
* Holds class instance
*
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'];
- Read upRead up
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();
- Read upRead up
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'];
- Read upRead up
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();
- Read upRead up
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,
);
- Read upRead up
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
Adjoining classes: .wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row.cmb-type-colorpicker .cmb-td Open
@media only screen and (min-width: 1000px) { .wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row.cmb-type-colorpicker .cmb-td { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-orient: horizontal; -webkit-box-direction: normal; -ms-flex-direction: row; flex-direction: row; } }
- Exclude checks
Adjoining classes: .wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-th Open
.wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-th { text-align: right; padding: 20px 0 20px 10px; width: 200px; font-size: 14px; line-height: 1.3; font-weight: 600; color: #23282d; text-shadow: none; vertical-align: baseline; min-width: 210px !important; }
- Exclude checks
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 div.cmb-td select { font-size: 14px; line-height: 2; color: #32373c; border-color: #7e8993; -webkit-box-shadow: none; box-shadow: none; border-radius: 3px; padding: 0 8px 0 24px; min-height: 30px; max-width: 25rem; -webkit-appearance: none; background-size: 16px 16px; cursor: pointer; vertical-align: middle; }
- Exclude checks
Element (input.cmb2-upload-file) is overqualified, just use .cmb2-upload-file without element name. Open
.wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-td input.cmb2-upload-file { margin-left: 15px; }
- Exclude checks
Rule doesn't have all its properties in alphabetical order. Open
.wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table { margin-top: 0; border: 1px solid transparent; }
- Exclude checks
Adjoining classes: .wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-td .cmb2-media-status Open
.wp-admin.settings_page_lsx-search-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-td .cmb2-media-status { padding-top: 10px; }
- Exclude checks
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 input[type=radio] { margin-top: -4px; margin-right: 4px; float: none; }
- Exclude checks
Use of !important Open
ul.products.list li.product { float: none !important; width: 100% !important; text-align: right !important; }
- Exclude checks
Use of !important Open
ul.products.list li.product { float: none !important; width: 100% !important; text-align: right !important; }
- Exclude checks
Adjoining classes: ul.products.list li.product hr Open
ul.products.list li.product hr { clear: both; }
- Exclude checks
Adjoining classes: .search .content.role.row Open
@media (min-width: 992px) { .search .content.role.row, .archive .content.role.row, .blog .content.role.row { margin-left: auto; margin-right: auto; }
- Exclude checks
Adjoining classes: .blog .facetwp-sidebar.widget-area + .content-area Open
.search .facetwp-sidebar.widget-area + .content-area, .archive .facetwp-sidebar.widget-area + .content-area, .blog .facetwp-sidebar.widget-area + .content-area { margin-top: 4.25rem; width: 100%; max-width: 695px; padding-right: 20px; padding-left: 0; }
- Exclude checks