JoryHogeveen/view-admin-as

View on GitHub
modules/class-role-defaults.php

Summary

Maintainability
D
2 days
Test Coverage

File class-role-defaults.php has 1324 lines of code (exceeds 1000 allowed). Consider refactoring.
Open

<?php
/**
 * View Admin As - Role Defaults Module
 *
 * @author  Jory Hogeveen <info@keraweb.nl>
Severity: Major
Found in modules/class-role-defaults.php - About 1 day to fix

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

                $admin_bar->add_node( array(
                    'id'     => $root . '-export-roles-export',
                    'parent' => $root . '-export',
                    'title'  => VAA_View_Admin_As_Form::do_button( array(
                        'name'    => $root . '-export-roles-export',
    Severity: Major
    Found in modules/class-role-defaults.php and 1 other location - About 4 hrs to fix
    modules/class-role-manager.php on lines 1181..1201

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

    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

                $admin_bar->add_node( array(
                    'id'     => $root . '-import-roles-file',
                    'parent' => $root . '-import',
                    'title'  => VAA_View_Admin_As_Form::do_input( array(
                        'name'    => $root . '-import-roles-file',
    Severity: Major
    Found in modules/class-role-defaults.php and 1 other location - About 3 hrs to fix
    modules/class-role-manager.php on lines 1234..1255

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

    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

    Found precision alignment of 1 spaces.
    Invalid

                             * Credits - Chris Van Patten:

    Found precision alignment of 1 spaces.
    Open

                             */

    Found precision alignment of 3 spaces.
    Open

                               . ': ' . $this->store->get_rolenames( $role ),

    Found precision alignment of 1 spaces.
    Open

                                         // Translators: %s stands for the translated view type label "Roles".

    Found precision alignment of 1 spaces.
    Open

                             * Lock meta boxes in position by disabling sorting.

    Found precision alignment of 2 spaces.
    Open

                                          . ': <code>' . implode( '|', $user_data ) . ' (user_id|role)</code>';

    Found precision alignment of 1 spaces.
    Open

                                         . sprintf( __( 'Please enable the "%s" view type to set role defaults', VIEW_ADMIN_AS_DOMAIN ), $view_type->get_label() ),

    Found precision alignment of 1 spaces.
    Open

                             *

    Found precision alignment of 1 spaces.
    Open

                             * http://wordpress.stackexchange.com/a/44539

    There are no issues that match your filters.

    Category
    Status