woothemes/woocommerce

View on GitHub
includes/class-wc-privacy.php

Summary

Maintainability
C
1 day
Test Coverage

Method get_privacy_message has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function get_privacy_message() {
        $content = '<div class="wp-suggested-text">' .
            '<p class="privacy-policy-tutorial">' .
                __( 'This sample language includes the basics around what personal data your store may be collecting, storing and sharing, as well as who may have access to that data. Depending on what settings are enabled and which additional plugins are used, the specific information shared by your store will vary. We recommend consulting with a lawyer when deciding what information to disclose on your privacy policy.', 'woocommerce' ) .
            '</p>' .
Severity: Minor
Found in includes/class-wc-privacy.php - About 1 hr to fix

    Method delete_inactive_accounts_query has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected static function delete_inactive_accounts_query( $timestamp, $limit = 20 ) {
            $count      = 0;
            $user_query = new WP_User_Query(
                array(
                    'fields'     => 'ID',
    Severity: Minor
    Found in includes/class-wc-privacy.php - About 1 hr to fix

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

          public static function trash_pending_orders( $limit = 20 ) {
              $option = wc_parse_relative_date_option( get_option( 'woocommerce_trash_pending_orders' ) );
      
              if ( empty( $option['number'] ) ) {
                  return 0;
      Severity: Major
      Found in includes/class-wc-privacy.php and 2 other locations - About 1 hr to fix
      includes/class-wc-privacy.php on lines 203..221
      includes/class-wc-privacy.php on lines 230..248

      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

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

          public static function trash_cancelled_orders( $limit = 20 ) {
              $option = wc_parse_relative_date_option( get_option( 'woocommerce_trash_cancelled_orders' ) );
      
              if ( empty( $option['number'] ) ) {
                  return 0;
      Severity: Major
      Found in includes/class-wc-privacy.php and 2 other locations - About 1 hr to fix
      includes/class-wc-privacy.php on lines 176..194
      includes/class-wc-privacy.php on lines 203..221

      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

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

          public static function trash_failed_orders( $limit = 20 ) {
              $option = wc_parse_relative_date_option( get_option( 'woocommerce_trash_failed_orders' ) );
      
              if ( empty( $option['number'] ) ) {
                  return 0;
      Severity: Major
      Found in includes/class-wc-privacy.php and 2 other locations - About 1 hr to fix
      includes/class-wc-privacy.php on lines 176..194
      includes/class-wc-privacy.php on lines 230..248

      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

      There are no issues that match your filters.

      Category
      Status