seb86/Auto-Load-Next-Post

View on GitHub
includes/admin/class-alnp-admin-settings.php

Summary

Maintainability
F
6 days
Test Coverage

Function output_fields has a Cognitive Complexity of 111 (exceeds 5 allowed). Consider refactoring.
Open

        public static function output_fields( $options ) {
            foreach ( $options as $key => $value ) {

            if ( ! isset( $value['type'] ) ) {
                    continue;
Severity: Minor
Found in includes/admin/class-alnp-admin-settings.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

Method output_fields has 269 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public static function output_fields( $options ) {
            foreach ( $options as $key => $value ) {

            if ( ! isset( $value['type'] ) ) {
                    continue;
Severity: Major
Found in includes/admin/class-alnp-admin-settings.php - About 1 day to fix

    Function save_fields has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

            public static function save_fields( $options ) {
                if ( empty( $_POST ) ) {
                    return false;
                }
    
    
    Severity: Minor
    Found in includes/admin/class-alnp-admin-settings.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

    File class-alnp-admin-settings.php has 433 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Auto Load Next Post - Admin Settings Class.
     *
     * @since    1.0.0
    Severity: Minor
    Found in includes/admin/class-alnp-admin-settings.php - About 6 hrs to fix

      Method save_fields has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public static function save_fields( $options ) {
                  if ( empty( $_POST ) ) {
                      return false;
                  }
      
      
      Severity: Major
      Found in includes/admin/class-alnp-admin-settings.php - About 3 hrs to fix

        Function get_option has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

                public static function get_option( $option_name, $default = '' ) {
                    // Array value
                    if ( strstr( $option_name, '[' ) ) {
                        parse_str( $option_name, $option_array );
        
        
        Severity: Minor
        Found in includes/admin/class-alnp-admin-settings.php - About 1 hr 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 show_messages has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                public static function show_messages() {
                    if ( count( self::$errors ) > 0 ) {
                        foreach ( self::$errors as $error ) {
                            echo '<div class="notice notice-error"><p><strong>' . esc_html( $error ) . '</strong></p></div>';
                        }
        Severity: Minor
        Found in includes/admin/class-alnp-admin-settings.php - About 55 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