MinnPost/object-sync-for-salesforce

View on GitHub

Showing 241 of 364 total issues

Method get_wordpress_object_fields has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get_wordpress_object_fields( $wordpress_object, $id_field = 'ID' ) {

        $object_table_structure = $this->get_wordpress_table_structure( $wordpress_object );

        $meta_table      = $object_table_structure['meta_table'];
Severity: Minor
Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

    Function display_checkboxes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function display_checkboxes( $args ) {
            $type       = 'checkbox';
            $name       = $args['name'];
            $options    = get_option( $name, array() );
            $group_desc = $args['desc'];
    Severity: Minor
    Found in classes/class-object-sync-sf-admin.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 save_salesforce_user_fields has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function save_salesforce_user_fields( $user_id ) {
            $post_data = filter_input_array( INPUT_POST, FILTER_UNSAFE_RAW );
            if ( isset( $post_data['salesforce_update_mapped_user'] ) && true === filter_var( $post_data['salesforce_update_mapped_user'], FILTER_VALIDATE_BOOLEAN ) ) {
                $mapping_objects = $this->mappings->get_all_object_maps(
                    array(
    Severity: Minor
    Found in classes/class-object-sync-sf-admin.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 check_for_action_scheduler has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function check_for_action_scheduler( $upgrader_object, $hook_extra ) {
    
            // skip if this action isn't this plugin being updated.
            if ( 'plugin' !== $hook_extra['type'] && 'update' !== $hook_extra['action'] && $hook_extra['plugin'] !== $this->slug ) {
                return;
    Severity: Minor
    Found in classes/class-object-sync-sf-activate.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 api_call has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function api_call( $path, $params = array(), $method = 'GET', $options = array(), $type = 'rest' ) {
            if ( ! $this->get_access_token() ) {
                $this->refresh_token();
            }
            $this->response = $this->api_http_request( $path, $params, $method, $options, $type );
    Severity: Minor
    Found in classes/class-object-sync-sf-salesforce.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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public function process( WP_REST_Request $request ) {
            // see methods: https://developer.wordpress.org/reference/classes/wp_rest_request/
            // use error_log( 'request is ' . print_r( $request, true ) ); to log the request.
            $http_method = $request->get_method();
            $route       = $request->get_route();
    Severity: Minor
    Found in classes/class-object-sync-sf-rest.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 create_wp_meta has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private function create_wp_meta( $params, $parent_object_id, $parent_object_type ) {
            $success = true;
            $errors  = array();
            if ( ! is_wp_error( $parent_object_id ) && is_array( $params ) && ! empty( $params ) ) {
                foreach ( $params as $key => $value ) {
    Severity: Minor
    Found in classes/class-object-sync-sf-wordpress.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 tabs has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function tabs( $tabs, $tab = '' ) {
    
            $get_data        = filter_input_array( INPUT_GET, FILTER_SANITIZE_SPECIAL_CHARS );
            $consumer_key    = $this->login_credentials['consumer_key'];
            $consumer_secret = $this->login_credentials['consumer_secret'];
    Severity: Minor
    Found in classes/class-object-sync-sf-admin.php - About 1 hr to fix

      Method check_for_action_scheduler has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function check_for_action_scheduler( $upgrader_object, $hook_extra ) {
      
              // skip if this action isn't this plugin being updated.
              if ( 'plugin' !== $hook_extra['type'] && 'update' !== $hook_extra['action'] && $hook_extra['plugin'] !== $this->slug ) {
                  return;
      Severity: Minor
      Found in classes/class-object-sync-sf-activate.php - About 1 hr to fix

        Method add_actions has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function add_actions() {
        
                // settings link.
                add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 5 );
        
        
        Severity: Minor
        Found in classes/class-object-sync-sf-admin.php - About 1 hr to fix

          Method restrict_logs_by_type has 29 lines of code (exceeds 25 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 1 hr to fix

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

                public function request_token( $code ) {
                    $data = array(
                        'code'          => $code,
                        'grant_type'    => 'authorization_code',
                        'client_id'     => $this->consumer_key,
            Severity: Minor
            Found in classes/class-object-sync-sf-salesforce.php - About 1 hr to fix

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

                  public function get_object_maps( $conditions = array(), $reset = false ) {
                      $table = $this->object_map_table;
                      $order = ' ORDER BY object_updated, created';
                      if ( ! empty( $conditions ) ) { // get multiple but with a limitation.
                          $mappings = array();
              Severity: Minor
              Found in classes/class-object-sync-sf-mapping.php - About 1 hr to fix

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

                    private function create_wp_meta( $params, $parent_object_id, $parent_object_type ) {
                        $success = true;
                        $errors  = array();
                        if ( ! is_wp_error( $parent_object_id ) && is_array( $params ) && ! empty( $params ) ) {
                            foreach ( $params as $key => $value ) {
                Severity: Minor
                Found in classes/class-object-sync-sf-wordpress.php - About 1 hr to fix

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

                      public function register_routes() {
                          $namespace   = $this->namespace;
                          $method_list = WP_REST_Server::ALLMETHODS;
                          register_rest_route(
                              $namespace,
                  Severity: Minor
                  Found in classes/class-object-sync-sf-rest.php - About 1 hr to fix

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

                        public function get_wordpress_object_fields( $wordpress_object, $id_field = 'ID' ) {
                    
                            $object_table_structure = $this->get_wordpress_table_structure( $wordpress_object );
                    
                            $meta_table      = $object_table_structure['meta_table'];
                    Severity: Minor
                    Found in classes/class-object-sync-sf-wordpress.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 setup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function setup( $title_or_params, $message = '', $trigger = 0, $parent = 0, $status = '' ) {
                    
                            if ( is_array( $title_or_params ) ) {
                                $title   = $title_or_params['title'];
                                $message = $title_or_params['message'];
                    Severity: Minor
                    Found in classes/class-object-sync-sf-logging.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 objects has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function objects(
                            $conditions = array(
                                'updateable'  => true,
                                'triggerable' => true,
                            ),
                    Severity: Minor
                    Found in classes/class-object-sync-sf-salesforce.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 display_select has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function display_select( $args ) {
                            $type = $args['type'];
                            $id   = $args['label_for'];
                            $name = $args['name'];
                            $desc = $args['desc'];
                    Severity: Minor
                    Found in classes/class-object-sync-sf-admin.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 object_upsert has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function object_upsert( $name, $key, $value, $methods, $params, $pull_to_drafts = false, $check_only = false ) {
                    
                            $structure = $this->get_wordpress_table_structure( $name );
                            $id_field  = $structure['id_field'];
                    
                    
                    Severity: Minor
                    Found in classes/class-object-sync-sf-wordpress.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

                    Severity
                    Category
                    Status
                    Source
                    Language