woothemes/woocommerce

View on GitHub
includes/legacy/api/v2/class-wc-api-customers.php

Summary

Maintainability
F
2 wks
Test Coverage

File class-wc-api-customers.php has 477 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WooCommerce API Customers Class
 *
 * Handles requests to the /customers endpoint
Severity: Minor
Found in includes/legacy/api/v2/class-wc-api-customers.php - About 7 hrs to fix

    Function update_customer_data has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function update_customer_data( $id, $data, $customer ) {
    
            // Customer first name.
            if ( isset( $data['first_name'] ) ) {
                $customer->set_first_name( wc_clean( $data['first_name'] ) );
    Severity: Minor
    Found in includes/legacy/api/v2/class-wc-api-customers.php - About 3 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

    Function bulk has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        public function bulk( $data ) {
    
            try {
                if ( ! isset( $data['customers'] ) ) {
                    throw new WC_API_Exception( 'woocommerce_api_missing_customers_data', sprintf( __( 'No %1$s data specified to create/edit %1$s', 'woocommerce' ), 'customers' ), 400 );
    Severity: Minor
    Found in includes/legacy/api/v2/class-wc-api-customers.php - About 2 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 query_customers has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function query_customers( $args = array() ) {
    
            // default users per page
            $users_per_page = get_option( 'posts_per_page' );
    
    
    Severity: Minor
    Found in includes/legacy/api/v2/class-wc-api-customers.php - About 1 hr to fix

      Function query_customers has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          private function query_customers( $args = array() ) {
      
              // default users per page
              $users_per_page = get_option( 'posts_per_page' );
      
      
      Severity: Minor
      Found in includes/legacy/api/v2/class-wc-api-customers.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_customer has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function get_customer( $id, $fields = null ) {
              global $wpdb;
      
              $id = $this->validate_request( $id, 'customer', 'read' );
      
      
      Severity: Minor
      Found in includes/legacy/api/v2/class-wc-api-customers.php - About 1 hr to fix

        Method bulk has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function bulk( $data ) {
        
                try {
                    if ( ! isset( $data['customers'] ) ) {
                        throw new WC_API_Exception( 'woocommerce_api_missing_customers_data', sprintf( __( 'No %1$s data specified to create/edit %1$s', 'woocommerce' ), 'customers' ), 400 );
        Severity: Minor
        Found in includes/legacy/api/v2/class-wc-api-customers.php - About 1 hr to fix

          Method add_customer_data has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function add_customer_data( $order_data, $order ) {
          
                  if ( 0 == $order->get_user_id() ) {
          
                      // add customer data from order
          Severity: Minor
          Found in includes/legacy/api/v2/class-wc-api-customers.php - About 1 hr to fix

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

                public function register_routes( $routes ) {
            
                    # GET/POST /customers
                    $routes[ $this->base ] = array(
                        array( array( $this, 'get_customers' ),   WC_API_SERVER::READABLE ),
            Severity: Minor
            Found in includes/legacy/api/v2/class-wc-api-customers.php - About 1 hr to fix

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

                  protected function validate_request( $id, $type, $context ) {
              
                      try {
                          $id = absint( $id );
              
              
              Severity: Minor
              Found in includes/legacy/api/v2/class-wc-api-customers.php - About 1 hr to fix

                Method update_customer_data has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function update_customer_data( $id, $data, $customer ) {
                
                        // Customer first name.
                        if ( isset( $data['first_name'] ) ) {
                            $customer->set_first_name( wc_clean( $data['first_name'] ) );
                Severity: Minor
                Found in includes/legacy/api/v2/class-wc-api-customers.php - About 1 hr to fix

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

                      public function create_customer( $data ) {
                          try {
                              if ( ! isset( $data['customer'] ) ) {
                                  throw new WC_API_Exception( 'woocommerce_api_missing_customer_data', sprintf( __( 'No %1$s data specified to create %1$s', 'woocommerce' ), 'customer' ), 400 );
                              }
                  Severity: Minor
                  Found in includes/legacy/api/v2/class-wc-api-customers.php - About 1 hr to fix

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

                        protected function validate_request( $id, $type, $context ) {
                    
                            try {
                                $id = absint( $id );
                    
                    
                    Severity: Minor
                    Found in includes/legacy/api/v2/class-wc-api-customers.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

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public function create_customer( $data ) {
                            try {
                                if ( ! isset( $data['customer'] ) ) {
                                    throw new WC_API_Exception( 'woocommerce_api_missing_customer_data', sprintf( __( 'No %1$s data specified to create %1$s', 'woocommerce' ), 'customer' ), 400 );
                                }
                    Severity: Major
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 1 other location - About 1 day to fix
                    includes/legacy/api/v3/class-wc-api-customers.php on lines 347..390

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 404.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public function register_routes( $routes ) {
                    
                            # GET/POST /customers
                            $routes[ $this->base ] = array(
                                array( array( $this, 'get_customers' ),   WC_API_SERVER::READABLE ),
                    Severity: Major
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 1 other location - About 1 day to fix
                    includes/legacy/api/v3/class-wc-api-customers.php on lines 57..98

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 354.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        protected function update_customer_data( $id, $data, $customer ) {
                    
                            // Customer first name.
                            if ( isset( $data['first_name'] ) ) {
                                $customer->set_first_name( wc_clean( $data['first_name'] ) );
                    Severity: Major
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 1 other location - About 1 day to fix
                    includes/legacy/api/v3/class-wc-api-customers.php on lines 297..336

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 323.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        protected function validate_request( $id, $type, $context ) {
                    
                            try {
                                $id = absint( $id );
                    
                    
                    Severity: Major
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 1 other location - About 1 day to fix
                    includes/legacy/api/v3/class-wc-api-customers.php on lines 702..745

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 307.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public function edit_customer( $id, $data ) {
                            try {
                                if ( ! isset( $data['customer'] ) ) {
                                    throw new WC_API_Exception( 'woocommerce_api_missing_customer_data', sprintf( __( 'No %1$s data specified to edit %1$s', 'woocommerce' ), 'customer' ), 400 );
                                }
                    Severity: Major
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 1 other location - About 1 day to fix
                    includes/legacy/api/v3/class-wc-api-customers.php on lines 402..443

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 303.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 3 locations. Consider refactoring.
                    Open

                        public function add_customer_data( $order_data, $order ) {
                    
                            if ( 0 == $order->get_user_id() ) {
                    
                                // add customer data from order
                    Severity: Major
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 2 other locations - About 1 day to fix
                    includes/legacy/api/v1/class-wc-api-customers.php on lines 353..395
                    includes/legacy/api/v3/class-wc-api-customers.php on lines 627..669

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 270.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public function get_customer_downloads( $id, $fields = null ) {
                            $id = $this->validate_request( $id, 'customer', 'read' );
                    
                            if ( is_wp_error( $id ) ) {
                                return $id;
                    Severity: Major
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 1 other location - About 6 hrs to fix
                    includes/legacy/api/v3/class-wc-api-customers.php on lines 497..522

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 223.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public function get_customer_orders( $id, $fields = null ) {
                            global $wpdb;
                    
                            $id = $this->validate_request( $id, 'customer', 'read' );
                    
                    
                    Severity: Major
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 1 other location - About 5 hrs to fix
                    includes/legacy/api/v1/class-wc-api-customers.php on lines 251..279

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 193.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public function get_customer_by_email( $email, $fields = null ) {
                            try {
                                if ( is_email( $email ) ) {
                                    $customer = get_user_by( 'email', $email );
                                    if ( ! is_object( $customer ) ) {
                    Severity: Major
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 1 other location - About 4 hrs to fix
                    includes/legacy/api/v3/class-wc-api-customers.php on lines 203..218

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 170.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 3 locations. Consider refactoring.
                    Open

                        public function get_customers( $fields = null, $filter = array(), $page = 1 ) {
                    
                            $filter['page'] = $page;
                    
                            $query = $this->query_customers( $filter );
                    Severity: Major
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 2 other locations - About 2 hrs to fix
                    includes/legacy/api/v1/class-wc-api-customers.php on lines 92..112
                    includes/legacy/api/v3/class-wc-api-customers.php on lines 109..129

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 126.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public function get_customers_count( $filter = array() ) {
                            try {
                                if ( ! current_user_can( 'list_users' ) ) {
                                    throw new WC_API_Exception( 'woocommerce_api_user_cannot_read_customers_count', __( 'You do not have permission to read the customers count', 'woocommerce' ), 401 );
                                }
                    Severity: Major
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 1 other location - About 1 hr to fix
                    includes/legacy/api/v3/class-wc-api-customers.php on lines 229..241

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 117.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Identical blocks of code found in 2 locations. Consider refactoring.
                    Open

                            if ( ! empty( $args['limit'] ) ) {
                                if ( -1 == $args['limit'] ) {
                                    unset( $query_args['number'] );
                                } else {
                                    $query_args['number'] = absint( $args['limit'] );
                    Severity: Minor
                    Found in includes/legacy/api/v2/class-wc-api-customers.php and 1 other location - About 45 mins to fix
                    includes/legacy/api/v3/class-wc-api-customers.php on lines 565..574

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 96.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    There are no issues that match your filters.

                    Category
                    Status