linchpin/mesh

View on GitHub

Showing 133 of 2,608 total issues

Function save_post has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring.
Open

    public function save_post( $post_id, $post ) {
        // Skip revisions and autosaves.
        if ( wp_is_post_revision( $post_id ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
            return;
        }
Severity: Minor
Found in class.mesh.php - About 2 days 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 mesh_section_background has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
Open

function mesh_section_background( $post_id = 0, $echo = true, $size_large = 'large', $size_medium = 'large', $size_xlarge = 'large', $size_small = 'small' ) {

    global $post;

    if ( empty( $post_id ) ) {
Severity: Minor
Found in includes/utilities.php - About 2 days 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

File class.mesh.php has 748 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Meat of most of Mesh Functionality
 *
 * @since   1.0
Severity: Major
Found in class.mesh.php - About 1 day to fix

File admin-mesh-core.js has 651 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var mesh = mesh || {};
mesh.integrations = mesh.integrations || {}; // @since 1.2 store integrations.

mesh.admin = function ($) {

Severity: Major
Found in assets/js/admin-mesh-core.js - About 1 day to fix

Method save_post has 257 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function save_post( $post_id, $post ) {
        // Skip revisions and autosaves.
        if ( wp_is_post_revision( $post_id ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
            return;
        }
Severity: Major
Found in class.mesh.php - About 1 day to fix

File utilities.php has 503 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * This file includes useful utility / middle man methods used within Mesh
 * or by developers looking for more advanced implementations of Mesh
 *
Severity: Major
Found in includes/utilities.php - About 1 day to fix

File admin-mesh-blocks.js has 475 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Controls Block Administration
 *
 * @since 0.4.1
 */
Severity: Minor
Found in assets/js/admin-mesh-blocks.js - About 7 hrs to fix

Method settings_init has 130 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function settings_init() {

        register_setting( self::$settings_page, 'mesh_settings' );
        register_setting( self::$settings_page, 'mesh_post_types', array( 'Mesh_Settings', 'validate_mesh_post_types' ) );

Severity: Major
Found in class.mesh-settings.php - About 5 hrs to fix

Method mesh_section_controls has 127 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function mesh_section_controls( $section, $blocks, $visible = false ) {

        $controls = array(
            'visible_options' => array(
                'template'      => array(
Severity: Major
Found in class.mesh-controls.php - About 5 hrs to fix

Function exports has 107 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (grunt) {

    // Load all grunt tasks
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

Severity: Major
Found in Gruntfile.js - About 4 hrs to fix

Method mesh_block_controls has 101 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function mesh_block_controls( $block, $section_blocks ) {

        $controls = array(
            'css-class'  => array(
                'label'         => esc_html__( 'CSS Class', 'mesh' ),
Severity: Major
Found in class.mesh-controls.php - About 4 hrs to fix

Function mesh_block_controls has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function mesh_block_controls( $block, $section_blocks ) {

        $controls = array(
            'css-class'  => array(
                'label'         => esc_html__( 'CSS Class', 'mesh' ),
Severity: Minor
Found in class.mesh-controls.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

Method mesh_section_background has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function mesh_section_background( $post_id = 0, $echo = true, $size_large = 'large', $size_medium = 'large', $size_xlarge = 'large', $size_small = 'small' ) {

    global $post;

    if ( empty( $post_id ) ) {
Severity: Major
Found in includes/utilities.php - About 3 hrs to fix

Method mesh_get_allowed_html has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function mesh_get_allowed_html() {
    $mesh_allowed = apply_filters( 'mesh_default_allowed_html', array(
        'iframe'   => array(
            'src'                   => true,
            'style'                 => true,
Severity: Major
Found in includes/utilities.php - About 3 hrs to fix

File class.mesh-controls.php has 318 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Handle displaying controls within sections and blocks
 *
 * @package     Mesh
Severity: Minor
Found in class.mesh-controls.php - About 3 hrs to fix

File class.mesh-settings.php has 310 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Control all of our plugin Settings
 *
 * @since      1.0.0
Severity: Minor
Found in class.mesh-settings.php - About 3 hrs to fix

Method init has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function init() {

        $labels = array(
            'name'                => esc_html_x( 'Mesh Templates', 'Mesh Templates', 'mesh' ),
            'singular_name'       => esc_html_x( 'Mesh Template', 'Mesh Template', 'mesh' ),
Severity: Major
Found in class.mesh-templates.php - About 3 hrs to fix

File mesh.php has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Plugin Name: Mesh
 * Plugin URI: https://meshplugin.com?utm_source=mesh&utm_medium=plugin-admin-page&utm_campaign=wp-plugin
 * Description: Adds multiple sections for content on a post by post basis. Mesh also has settings to enable it for specific post types
Severity: Minor
Found in mesh.php - About 2 hrs to fix

Method get_grid_systems has 70 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function get_grid_systems() {

        self::$grid_systems = array(
            'css'        => array( // @since 1.2.5
                'columns'       => array(
Severity: Major
Found in class.mesh-reponsive-grid.php - About 2 hrs to fix

Function rerender_blocks has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        rerender_blocks: function ( $tinymce_editors ) {

            $tinymce_editors.each(function () {
                var editor_id = $(this).prop('id'),
                    proto_id = 'content',
Severity: Major
Found in assets/js/admin-mesh-blocks.js - About 2 hrs to fix
Severity
Category
Status
Source
Language