awsmug/torro-forms

View on GitHub

Showing 375 of 503 total issues

File admin-form-builder.js has 1714 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Torro Forms Version 1.0.8 (https://torro-forms.com)
 * Licensed under GNU General Public License v2 (or later) (http://www.gnu.org/licenses/gpl-2.0.html)
 */
window.torro = window.torro || {};
Severity: Major
Found in assets/dist/js/admin-form-builder.js - About 4 days to fix

    Function upgrade_legacy_form_meta has a Cognitive Complexity of 118 (exceeds 5 allowed). Consider refactoring.
    Open

        public function upgrade_legacy_form_meta( $form_id ) {
            global $wpdb;
    
            $prefix = $this->get_prefix();
    
    
    Severity: Minor
    Found in src/components/legacy-upgrades.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 form-edit-page-handler.php has 751 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Form edit page handler class
     *
     * @package TorroForms
    Severity: Major
    Found in src/db-objects/forms/form-edit-page-handler.php - About 1 day to fix

      Function handle_form_submission has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function handle_form_submission( $form, $submission, $data = array() ) {
              if ( $submission->has_errors() ) {
                  $submission->reset_errors();
              }
      
      
      Severity: Minor
      Found in src/db-objects/forms/form-frontend-submission-handler.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

      Function get_values has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
      Open

          public function get_values( $element, $submission = null ) {
              $values = array();
              if ( $submission ) {
                  $all_values = $submission->get_element_values_data();
                  if ( isset( $all_values[ $element->id ] ) ) {
      Severity: Minor
      Found in src/db-objects/elements/element-types/element-type.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

      Function can_access has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

          public function can_access( $form, $submission = null ) {
              if ( $this->get_form_option( $form->id, 'prevent_edit_others_submission', true ) && $submission ) {
                  $others_submission_error = new WP_Error( 'others_submission', __( 'You do not have access to this form submission.', 'torro-forms' ) );
                  
                  $skip_further_checks = false;
      Severity: Minor
      Found in src/modules/access-controls/user-identification.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 element-view.js has 545 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      ( function( torro, $, _, fieldsAPI, dummyFieldManager ) {
          'use strict';
      
          function deepClone( input ) {
              var output = _.clone( input );
      Severity: Major
      Found in assets/src/js/admin-form-builder/views/element-view.js - About 1 day to fix

        File form-settings-page.php has 534 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        /**
         * Form settings page class
         *
         * @package TorroForms
        Severity: Major
        Found in src/db-objects/forms/form-settings-page.php - About 1 day to fix

          Method register_assets has 211 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function register_assets() {
                  $this->register_style(
                      'frontend',
                      'assets/dist/css/frontend.css',
                      array(
          Severity: Major
          Found in src/assets.php - About 1 day to fix

            Function parseFields has 196 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function parseFields( fields, element ) {
                    var parsedFields = [];
                    var hasLabel = false;
            
                    _.each( fields, function( field ) {
            Severity: Major
            Found in assets/src/js/admin-form-builder/views/element-view.js - About 7 hrs to fix

              Function parseFields has 196 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function parseFields( fields, element ) {
                      var parsedFields = [];
                      var hasLabel = false;
              
                      _.each( fields, function( field ) {
              Severity: Major
              Found in assets/dist/js/admin-form-builder.js - About 7 hrs to fix

                File legacy-upgrades.php has 473 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * Legacy upgrades class
                 *
                 * @package TorroForms
                Severity: Minor
                Found in src/components/legacy-upgrades.php - About 7 hrs to fix

                  Method upgrade_legacy_form_meta has 169 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function upgrade_legacy_form_meta( $form_id ) {
                          global $wpdb;
                  
                          $prefix = $this->get_prefix();
                  
                  
                  Severity: Major
                  Found in src/components/legacy-upgrades.php - About 6 hrs to fix

                    Function map_capabilities has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function map_capabilities( $mode ) {
                            $this->capability_mappings = array();
                    
                            if ( $mode ) {
                                $this->capability_mappings[ $this->meta_capabilities['edit_item'] ]   = array( $this, 'map_edit_item' );
                    Severity: Minor
                    Found in src/db-objects/form-categories/form-category-capabilities.php - About 6 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

                    File members.php has 446 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /**
                     * Members access control class
                     *
                     * @package TorroForms
                    Severity: Minor
                    Found in src/modules/access-controls/members.php - About 6 hrs to fix

                      File email-notifications.php has 443 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      /**
                       * Email notifications action class
                       *
                       * @package TorroForms
                      Severity: Minor
                      Found in src/modules/actions/email-notifications.php - About 6 hrs to fix

                        Method register_template_tag_handlers has 161 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function register_template_tag_handlers() {
                                $tags = array(
                                    'sitetitle'          => array(
                                        'group'       => 'global',
                                        'label'       => __( 'Site Title', 'torro-forms' ),
                        Severity: Major
                        Found in src/modules/actions/email-notifications.php - About 6 hrs to fix

                          Method setup_hooks has 159 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              protected function setup_hooks() {
                                  parent::setup_hooks();
                          
                                  if ( method_exists( $this, 'register_rest_routes' ) ) {
                                      $this->filters[] = array(
                          Severity: Major
                          Found in src/db-objects/forms/form-manager.php - About 6 hrs to fix

                            File torro-forms.php has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            <?php
                            /**
                             * Plugin main class
                             *
                             * @package TorroForms
                            Severity: Minor
                            Found in src/torro-forms.php - About 6 hrs to fix

                              Function upgrade_legacy_settings has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function upgrade_legacy_settings() {
                                      $prefix = $this->get_prefix();
                              
                                      $general_mappings = array(
                                          'modules'        => array( $prefix . 'settings_general_modules', 'modules' ),
                              Severity: Minor
                              Found in src/components/legacy-upgrades.php - About 5 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

                              Severity
                              Category
                              Status
                              Source
                              Language