MinnPost/object-sync-for-salesforce

View on GitHub

Showing 241 of 364 total issues

Avoid too many return statements within this method.
Open

            return $result;
Severity: Major
Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return $result;
    Severity: Major
    Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return $result;
      Severity: Major
      Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $result;
        Severity: Major
        Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return $existing_id;
          Severity: Major
          Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return $existing_id;
            Severity: Major
            Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $result;
              Severity: Major
              Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                    return new WP_Error( 'rest_forbidden', esc_html__( 'This kind of request is not allowed.', 'object-sync-for-salesforce' ), array( 'status' => 401 ) );
                Severity: Major
                Found in classes/class-object-sync-sf-rest.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return $existing_id;
                  Severity: Major
                  Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                        return $string;
                    Severity: Major
                    Found in bin/wp-readme.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return $result;
                      Severity: Major
                      Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                            return new WP_Error( 'rest_forbidden', esc_html__( 'This kind of request is not allowed.', 'object-sync-for-salesforce' ), array( 'status' => 401 ) );
                        Severity: Major
                        Found in classes/class-object-sync-sf-rest.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                              return new WP_Error( 'rest_forbidden', esc_html__( 'You do not have permissions to view this data.', 'object-sync-for-salesforce' ), array( 'status' => 401 ) );
                          Severity: Major
                          Found in classes/class-object-sync-sf-rest.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                            return $existing_id;
                            Severity: Major
                            Found in classes/class-object-sync-sf-wordpress.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                      return true;
                              Severity: Major
                              Found in classes/class-object-sync-sf-rest.php - About 30 mins to fix

                                Function manual_pull has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function manual_pull( $object_type, $salesforce_id = '' ) {
                                
                                        if ( '' === $salesforce_id ) {
                                            $sf_sync_trigger = $this->mappings->sync_sf_create;
                                        } else {
                                Severity: Minor
                                Found in classes/class-object-sync-sf-salesforce-pull.php - About 25 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 restrict_logs_by_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function restrict_logs_by_type( $post_type ) {
                                        $type     = 'wp_log';
                                        $taxonomy = 'wp_log_type';
                                        // only add filter to post type you want.
                                        if ( 'wp_log' === $post_type ) {
                                Severity: Minor
                                Found in classes/class-object-sync-sf-logging.php - About 25 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 is_push_allowed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    private function is_push_allowed( $object_type, $object, $sf_sync_trigger, $mapping, $map_sync_triggers ) {
                                
                                        // default is push is allowed.
                                        $push_allowed = true;
                                
                                
                                Severity: Minor
                                Found in classes/class-object-sync-sf-salesforce-push.php - About 25 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 push_to_salesforce has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function push_to_salesforce( $wordpress_object = '', $wordpress_id = '', $force_return = false ) {
                                        $post_data = filter_input_array( INPUT_POST, FILTER_UNSAFE_RAW );
                                        if ( empty( $wordpress_object ) && empty( $wordpress_id ) ) {
                                            $wordpress_object = isset( $post_data['wordpress_object'] ) ? sanitize_text_field( wp_unslash( $post_data['wordpress_object'] ) ) : '';
                                            $wordpress_id     = isset( $post_data['wordpress_id'] ) ? absint( $post_data['wordpress_id'] ) : '';
                                Severity: Minor
                                Found in classes/class-object-sync-sf-admin.php - About 25 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 object_edit_link has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function object_edit_link( $object_type, $wordpress_id ) {
                                        $edit_link = '';
                                        if ( 'user' === $object_type ) {
                                            $edit_link = get_edit_user_link( $wordpress_id );
                                        } elseif ( 'post' === $object_type || 'page' === $object_type || 'attachment' === $object_type ) {
                                Severity: Minor
                                Found in classes/class-object-sync-sf-wordpress.php - About 25 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

                                Severity
                                Category
                                Status
                                Source
                                Language