woothemes/woocommerce

View on GitHub
includes/export/abstract-wc-csv-exporter.php

Summary

Maintainability
C
1 day
Test Coverage

WC_CSV_Exporter has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class WC_CSV_Exporter {

    /**
     * Type of export used in filter names.
     *
Severity: Minor
Found in includes/export/abstract-wc-csv-exporter.php - About 3 hrs to fix

    Function format_term_ids has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        public function format_term_ids( $term_ids, $taxonomy ) {
            $term_ids = wp_parse_id_list( $term_ids );
    
            if ( ! count( $term_ids ) ) {
                return '';
    Severity: Minor
    Found in includes/export/abstract-wc-csv-exporter.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 format_term_ids has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function format_term_ids( $term_ids, $taxonomy ) {
            $term_ids = wp_parse_id_list( $term_ids );
    
            if ( ! count( $term_ids ) ) {
                return '';
    Severity: Minor
    Found in includes/export/abstract-wc-csv-exporter.php - About 1 hr to fix

      Function export_row has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function export_row( $row_data, $key, $buffer ) {
              $columns    = $this->get_column_names();
              $export_row = array();
      
              foreach ( $columns as $column_id => $column_name ) {
      Severity: Minor
      Found in includes/export/abstract-wc-csv-exporter.php - About 35 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 format_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function format_data( $data ) {
              if ( ! is_scalar( $data ) ) {
                  if ( is_a( $data, 'WC_Datetime' ) ) {
                      $data = $data->date( 'Y-m-d G:i:s' );
                  } else {
      Severity: Minor
      Found in includes/export/abstract-wc-csv-exporter.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

      There are no issues that match your filters.

      Category
      Status