CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.php

Summary

Maintainability
F
5 days
Test Coverage

File class.akismet.php has 532 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

class Akismet {
    const API_HOST = 'rest.akismet.com';
    const API_PORT = 80;
Severity: Major
Found in Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.php - About 1 day to fix

    Function cron_recheck has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function cron_recheck() {
            global $wpdb;
    
            $api_key = self::get_api_key();
    
    
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.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

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

        public static function auto_check_comment( $commentdata ) {
            self::$last_comment_result = null;
    
            $comment = $commentdata;
    
    
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.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

    Akismet has 39 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Akismet {
        const API_HOST = 'rest.akismet.com';
        const API_PORT = 80;
        const MAX_DELAY_BEFORE_MODERATION_EMAIL = 86400; // One day in seconds
    
    
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.php - About 5 hrs to fix

      Function auto_check_update_meta has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function auto_check_update_meta( $id, $comment ) {
      
              // failsafe for old WP versions
              if ( !function_exists('add_comment_meta') )
                  return false;
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.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

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

          public static function auto_check_comment( $commentdata ) {
              self::$last_comment_result = null;
      
              $comment = $commentdata;
      
      
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.php - About 3 hrs to fix

        Method cron_recheck has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function cron_recheck() {
                global $wpdb;
        
                $api_key = self::get_api_key();
        
        
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.php - About 2 hrs to fix

          Method bail_on_activation has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function bail_on_activation( $message, $deactivate = true ) {
          ?>
          <!doctype html>
          <html>
          <head>

            Method auto_check_update_meta has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function auto_check_update_meta( $id, $comment ) {
            
                    // failsafe for old WP versions
                    if ( !function_exists('add_comment_meta') )
                        return false;

              Method http_post has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function http_post( $request, $path, $ip=null ) {
              
                      $akismet_ua = sprintf( 'WordPress/%s | Akismet/%s', $GLOBALS['wp_version'], constant( 'AKISMET_VERSION' ) );
                      $akismet_ua = apply_filters( 'akismet_ua', $akismet_ua );
              
              

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

                    public static function get_user_roles( $user_id ) {
                        $roles = false;
                
                        if ( !class_exists('WP_User') )
                            return false;
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.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

                Function bail_on_activation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function bail_on_activation( $message, $deactivate = true ) {
                ?>
                <!doctype html>
                <html>
                <head>
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.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 disable_moderation_emails_if_unreachable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function disable_moderation_emails_if_unreachable( $emails, $comment_id ) {
                        if ( ! empty( self::$prevent_moderation_email_for_these_comments ) && ! empty( $emails ) ) {
                            $comment = get_comment( $comment_id );
                
                            foreach ( self::$prevent_moderation_email_for_these_comments as $possible_match ) {
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.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 delete_old_comments_meta has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function delete_old_comments_meta() {
                        global $wpdb;
                
                        $interval = apply_filters( 'akismet_delete_commentmeta_interval', 15 );
                
                
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-content/plugins/akismet/class.akismet.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

                There are no issues that match your filters.

                Category
                Status