lesterchan/wp-sweep

View on GitHub

Showing 19 of 316 total issues

Function sweep has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring.
Open

    public function sweep( $name ) {
        global $wpdb;

        $message = '';

Severity: Minor
Found in wp-sweep.php - About 2 days 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

File wp-sweep.php has 647 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WP-Sweep wp-sweep.php
 *
 * @package wp-sweep
Severity: Major
Found in wp-sweep.php - About 1 day to fix

    File admin.php has 554 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * WP-Sweep admin.php
     *
     * @package wp-sweep
    Severity: Major
    Found in admin.php - About 1 day to fix

      Method sweep has 224 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function sweep( $name ) {
              global $wpdb;
      
              $message = '';
      
      
      Severity: Major
      Found in wp-sweep.php - About 1 day to fix

        Function details has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

            public function details( $name ) {
                global $wpdb;
        
                $details = array();
        
        
        Severity: Minor
        Found in wp-sweep.php - About 4 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 count has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

            public function count( $name ) {
                global $wpdb;
        
                $count = 0;
        
        
        Severity: Minor
        Found in wp-sweep.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

        Method details has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function details( $name ) {
                global $wpdb;
        
                $details = array();
        
        
        Severity: Major
        Found in wp-sweep.php - About 3 hrs to fix

          Method count has 75 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function count( $name ) {
                  global $wpdb;
          
                  $count = 0;
          
          
          Severity: Major
          Found in wp-sweep.php - About 3 hrs to fix

            Method ajax_sweep has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function ajax_sweep() {
                    if ( ! empty( $_GET['action'] )
                        && ! empty( $_GET['sweep_name'] )
                        && ! empty( $_GET['sweep_type'] )
                    ) {
            Severity: Major
            Found in wp-sweep.php - About 2 hrs to fix

              WPSweep has 21 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class WPSweep {
                  /**
                   * Limit the number of items to show for sweep details
                   *
                   * @since 1.0.3
              Severity: Minor
              Found in wp-sweep.php - About 2 hrs to fix

                Method __construct has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function __construct() {
                        add_action(
                            'rest_api_init', function() {
                                register_rest_route(
                                    $this->namespace, 'count/(?P<name>\w+)', array(
                Severity: Minor
                Found in inc/class-wpsweep-api.php - About 1 hr to fix

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

                      public function total_count( $name ) {
                          global $wpdb;
                  
                          $count = 0;
                  
                  
                  Severity: Minor
                  Found in wp-sweep.php - About 1 hr to fix

                    Function total_count has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function total_count( $name ) {
                            global $wpdb;
                    
                            $count = 0;
                    
                    
                    Severity: Minor
                    Found in wp-sweep.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 __invoke has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function __invoke( $args, $assoc_args ) {
                    
                            $items = array();
                    
                            $default_items = array(
                    Severity: Minor
                    Found in inc/class-wpsweep-command.php - About 1 hr to fix

                      Function ajax_sweep has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function ajax_sweep() {
                              if ( ! empty( $_GET['action'] )
                                  && ! empty( $_GET['sweep_name'] )
                                  && ! empty( $_GET['sweep_type'] )
                              ) {
                      Severity: Minor
                      Found in wp-sweep.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 get_default_taxonomy_termids has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function get_default_taxonomy_termids() {
                              $taxonomies       = get_taxonomies();
                              $default_term_ids = array();
                              if ( $taxonomies ) {
                                  $tax = array_keys( $taxonomies );
                      Severity: Minor
                      Found in wp-sweep.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 plugin_activation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function plugin_activation( $network_wide ) {
                              if ( is_multisite() && $network_wide ) {
                                  $ms_sites = (array) get_sites();
                      
                                  if ( 0 < count( $ms_sites ) ) {
                      Severity: Minor
                      Found in wp-sweep.php - About 45 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 __invoke has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function __invoke( $args, $assoc_args ) {
                      
                              $items = array();
                      
                              $default_items = array(
                      Severity: Minor
                      Found in inc/class-wpsweep-command.php - About 45 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 plugin_deactivation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function plugin_deactivation( $network_wide ) {
                              if ( is_multisite() && $network_wide ) {
                                  $ms_sites = (array) get_sites();
                      
                                  if ( 0 < count( $ms_sites ) ) {
                      Severity: Minor
                      Found in wp-sweep.php - About 45 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

                      Severity
                      Category
                      Status
                      Source
                      Language