awsmug/torro-forms

View on GitHub
src/modules/evaluators/module.php

Summary

Maintainability
C
1 day
Test Coverage

Method maybe_show_evaluation_results has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function maybe_show_evaluation_results( $submissions ) {
        if ( empty( $_GET['form_id'] ) ) { // WPCS: CSRF OK.
            return;
        }

Severity: Major
Found in src/modules/evaluators/module.php - About 2 hrs to fix

    File module.php has 274 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Evaluators module class
     *
     * @package TorroForms
    Severity: Minor
    Found in src/modules/evaluators/module.php - About 2 hrs to fix

      Function maybe_enqueue_submission_results_assets has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function maybe_enqueue_submission_results_assets( $submissions ) {
              if ( empty( $_GET['form_id'] ) ) { // WPCS: CSRF OK.
                  return;
              }
      
      
      Severity: Minor
      Found in src/modules/evaluators/module.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

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

          public function get_shortcode_content( $atts ) {
              $args = $atts;
      
              $atts = shortcode_atts(
                  array(
      Severity: Minor
      Found in src/modules/evaluators/module.php - About 1 hr to fix

        Method maybe_enqueue_submission_results_assets has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function maybe_enqueue_submission_results_assets( $submissions ) {
                if ( empty( $_GET['form_id'] ) ) { // WPCS: CSRF OK.
                    return;
                }
        
        
        Severity: Minor
        Found in src/modules/evaluators/module.php - About 1 hr to fix

          Function maybe_show_evaluation_results has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function maybe_show_evaluation_results( $submissions ) {
                  if ( empty( $_GET['form_id'] ) ) { // WPCS: CSRF OK.
                      return;
                  }
          
          
          Severity: Minor
          Found in src/modules/evaluators/module.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 get_shortcode_content has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function get_shortcode_content( $atts ) {
                  $args = $atts;
          
                  $atts = shortcode_atts(
                      array(
          Severity: Minor
          Found in src/modules/evaluators/module.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

          Avoid too many return statements within this method.
          Open

                      return __( 'Shortcode is using an invalid mode!', 'torro-forms' );
          Severity: Major
          Found in src/modules/evaluators/module.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return str_replace( ' class="torro-evaluations-subtab"', ' class="torro-evaluations-subtab" onclick="' . esc_attr( $onclick ) . '"', ob_get_clean() );
            Severity: Major
            Found in src/modules/evaluators/module.php - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status