felixarntz/theme-boilerplate

View on GitHub
inc/library/assets/class-assets.php

Summary

Maintainability
A
3 hrs
Test Coverage

Method register_main_assets has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function register_main_assets() {
        $this->register_asset( new Super_Awesome_Theme_Script(
            'wp-i18n',
            get_theme_file_uri( '/assets/dist/js/wp-i18n.js' ),
            array(
Severity: Minor
Found in inc/library/assets/class-assets.php - About 1 hr to fix

    Function __call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function __call( $method, $args ) {
            switch ( $method ) {
                case 'register_main_assets':
                case 'disable_special_page_styles':
                case 'print_detect_js_svg_support_script':
    Severity: Minor
    Found in inc/library/assets/class-assets.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 get_jed_locale_data_for_domain has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        private function get_jed_locale_data_for_domain( $domain ) {
            $translations = get_translations_for_domain( $domain );
    
            $locale = array(
                '' => array(
    Severity: Minor
    Found in inc/library/assets/class-assets.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

    There are no issues that match your filters.

    Category
    Status