MinnPost/object-sync-for-salesforce

View on GitHub
classes/class-object-sync-sf-activate.php

Summary

Maintainability
C
1 day
Test Coverage

Function log_trigger_settings has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    private function log_trigger_settings() {
        $triggers_to_log = get_option( $this->option_prefix . 'triggers_to_log', array() );
        if ( ! empty( $triggers_to_log ) ) {
            // in version 2.0.0 of this plugin, we replaced the bit flags with strings to make them more legible.
            // when the database version changes to 2.0.0, we should update the option value to use the new strings.
Severity: Minor
Found in classes/class-object-sync-sf-activate.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

Method wordpress_salesforce_tables has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function wordpress_salesforce_tables() {

        $charset_collate = $this->wpdb->get_charset_collate();

        $field_map_table = $this->wpdb->prefix . 'object_sync_sf_field_map';
Severity: Major
Found in classes/class-object-sync-sf-activate.php - About 2 hrs to fix

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

        private function log_trigger_settings() {
            $triggers_to_log = get_option( $this->option_prefix . 'triggers_to_log', array() );
            if ( ! empty( $triggers_to_log ) ) {
                // in version 2.0.0 of this plugin, we replaced the bit flags with strings to make them more legible.
                // when the database version changes to 2.0.0, we should update the option value to use the new strings.
    Severity: Minor
    Found in classes/class-object-sync-sf-activate.php - About 1 hr to fix

      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

      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

        Function wordpress_salesforce_tables has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            public function wordpress_salesforce_tables() {
        
                $charset_collate = $this->wpdb->get_charset_collate();
        
                $field_map_table = $this->wpdb->prefix . 'object_sync_sf_field_map';
        Severity: Minor
        Found in classes/class-object-sync-sf-activate.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