lightspeeddevelopment/lsx-business-directory

View on GitHub

Showing 1,804 of 1,804 total issues

Function save has a Cognitive Complexity of 102 (exceeds 25 allowed). Consider refactoring.
Open

    public function save() {
        if ( ! function_exists( 'wc_get_var' ) ) {
            return;
        }
        $nonce_value = wc_get_var( $_REQUEST['lsx-bd-add-listing-nonce'], wc_get_var( $_REQUEST['_wpnonce'], '' ) ); // @codingStandardsIgnoreLine.
Severity: Minor
Found in classes/integrations/woocommerce/class-form-handler.php - About 1 day 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

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

<?php
/**
 * The template for the business directory post type archive.
 *
 * @package     LSX_Business_Directory
Severity: Major
Found in templates/taxonomy-business-directory.php and 1 other location - About 6 hrs to fix
templates/archive-business-directory.php on lines 1..60

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

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

<?php
/**
 * The template for the business directory post type archive.
 *
 * @package     LSX_Business_Directory
Severity: Major
Found in templates/archive-business-directory.php and 1 other location - About 6 hrs to fix
templates/taxonomy-business-directory.php on lines 1..60

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

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 get_listing_form_field_values has a Cognitive Complexity of 47 (exceeds 25 allowed). Consider refactoring.
Open

function get_listing_form_field_values( $sections = array(), $listing_id = false ) {
    $values      = array();
    $defaults    = \lsx\business_directory\includes\get_listing_form_field_defaults();
    $nonce_value = wc_get_var( $_REQUEST['lsx-bd-add-listing-nonce'], wc_get_var( $_REQUEST['_wpnonce'], '' ) ); // @codingStandardsIgnoreLine.
    if ( ! wp_verify_nonce( $nonce_value, 'lsx_bd_add_listing' ) || empty( $_POST['action'] ) || 'save_listing_details' !== $_POST['action'] ) {
Severity: Minor
Found in includes/helpers.php - About 3 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 body_class has a Cognitive Complexity of 28 (exceeds 25 allowed). Consider refactoring.
Open

    public function body_class( $classes = array() ) {
        if ( is_singular( 'business-directory' ) || is_post_type_archive( 'business-directory' ) || is_tax( array( 'industry', 'location' ) ) || is_search() || ( lsx_bd_is_preview() ) ) {
            $classes[] = 'lsx-business-directory-page';

            if ( is_singular( 'business-directory' ) || ( lsx_bd_is_preview() ) ) {
Severity: Minor
Found in classes/class-frontend.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 lsx_bd_get_term_thumbnail has a Cognitive Complexity of 27 (exceeds 25 allowed). Consider refactoring.
Open

function lsx_bd_get_term_thumbnail( $term_id = '', $size = 'lsx-thumbnail-wide', $echo = false, $src = false, $hover = false ) {
    $image = '';
    if ( '' !== $term_id ) {
        $meta_key = 'lsx_bd_thumbnail_id';
        if ( false !== $hover ) {
Severity: Minor
Found in includes/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 lsx_bd_form_field has a Cognitive Complexity of 27 (exceeds 25 allowed). Consider refactoring.
Open

function lsx_bd_form_field( $key, $args, $value = null ) {
    $defaults = array(
        'type'              => 'text',
        'label'             => '',
        'description'       => '',
Severity: Minor
Found in includes/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

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

.wp-admin.business-directory_page_lsx-business-directory-settings .wp-filter .filter-links .current { border-bottom: none; font-weight: 600; color: #23282d; }

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

.wp-admin.business-directory_page_lsx-business-directory-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; }

Adjoining classes: .wp-admin.business-directory_page_lsx-business-directory-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.business-directory_page_lsx-business-directory-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; } }

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

.wp-admin.business-directory_page_lsx-business-directory-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; }

Adjoining classes: .wp-admin.business-directory_page_lsx-business-directory-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-th
Open

.wp-admin.business-directory_page_lsx-business-directory-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; }

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

.wp-admin.business-directory_page_lsx-business-directory-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; }

Adjoining classes: .wp-admin.business-directory_page_lsx-business-directory-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-th
Open

.wp-admin.business-directory_page_lsx-business-directory-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; }

Heading (h3) should not be qualified.
Open

.wp-admin.business-directory_page_lsx-business-directory-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; }

Values of 0 shouldn't have units specified.
Open

.wp-admin.business-directory_page_lsx-business-directory-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-td:nth-of-type(1) { padding-top: 0px !important; }

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

.wp-admin.business-directory_page_lsx-business-directory-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; }

Values of 0 shouldn't have units specified.
Open

.wp-admin.business-directory_page_lsx-business-directory-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-td .cmb2-metabox-title { margin-top: 0px; }

Adjoining classes: .wp-admin.business-directory_page_lsx-business-directory-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-td .cmb2-metabox-title
Open

.wp-admin.business-directory_page_lsx-business-directory-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-td .cmb2-metabox-title { margin-top: 0px; }

Use of !important
Open

.wp-admin.business-directory_page_lsx-business-directory-settings .cmb2-wrap.form-table .tab.tab-nav .cmb-row div.cmb-td { text-align: right !important; padding: 20px 0 20px 10px !important; margin-left: 15px; }
Severity
Category
Status
Source
Language