emotionLoop/visualCaptcha-WordPress

View on GitHub

Showing 12 of 12 total issues

File visualcaptcha.jquery.src.js has 820 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*! visualCaptcha - v0.0.7 - 2015-07-13
* http://visualcaptcha.net
* Copyright (c) 2015 emotionLoop; Licensed MIT */

(function( root, factory ) {
Severity: Major
Found in public/visualcaptcha.jquery.src.js - About 1 day to fix

    Function visualcaptcha_options has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
    Open

    function visualcaptcha_options() {
          if ( ! current_user_can( 'manage_options' ) )  {
                wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
          }
    
    
    Severity: Minor
    Found in visualcaptcha.php - About 1 day 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 visualcaptcha_do_filter has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
    Open

    function visualcaptcha_do_filter( $arg1, $arg2 = null, $arg3 = null ) {
        if ( ! empty( $_POST['namespace'] ) ) {
            $session = new \visualCaptcha\Session( 'visualcaptcha_' . $_POST[ 'namespace' ] );
        } else {
            $session = new \visualCaptcha\Session();
    Severity: Minor
    Found in visualcaptcha.php - About 1 day 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 visualcaptcha_options has 156 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function visualcaptcha_options() {
          if ( ! current_user_can( 'manage_options' ) )  {
                wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
          }
    
    
    Severity: Major
    Found in visualcaptcha.php - About 6 hrs to fix

      File visualcaptcha.php has 312 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /*
        Plugin Name: visualCaptcha
        Version: 5.0.6
      Severity: Minor
      Found in visualcaptcha.php - About 3 hrs to fix

        Function visualcaptcha_plugin_init has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        function visualcaptcha_plugin_init() {
        
            $visualcaptcha_current_hooks = visualcaptcha_hooks();
        
            if ( is_array($visualcaptcha_current_hooks) && ! empty($visualcaptcha_current_hooks) ) {
        Severity: Minor
        Found in visualcaptcha.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 normalize has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function normalize(name, baseName) {
                var nameParts, nameSegment, mapValue, foundMap, lastIndex,
                    foundI, foundStarMap, starI, i, j, part,
                    baseParts = baseName && baseName.split("/"),
                    map = config.map,
        Severity: Major
        Found in public/visualcaptcha.jquery.src.js - About 2 hrs to fix

          Method visualcaptcha_do_filter has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function visualcaptcha_do_filter( $arg1, $arg2 = null, $arg3 = null ) {
              if ( ! empty( $_POST['namespace'] ) ) {
                  $session = new \visualCaptcha\Session( 'visualcaptcha_' . $_POST[ 'namespace' ] );
              } else {
                  $session = new \visualCaptcha\Session();
          Severity: Major
          Found in visualcaptcha.php - About 2 hrs to fix

            Function visualCaptcha has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                $.fn.visualCaptcha = function( options ) {
                    var config;
            
                    config = $.extend( {
                        imgPath: '/',
            Severity: Minor
            Found in public/visualcaptcha.jquery.src.js - About 1 hr to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (mapValue) {
                                          mapValue = mapValue[nameSegment];
                                          if (mapValue) {
                                              //Match, update name to the new value.
                                              foundMap = mapValue;
              Severity: Major
              Found in public/visualcaptcha.jquery.src.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (i === 1 && (name[2] === '..' || name[0] === '..')) {
                                            //End of the line. Keep at least one non-dot
                                            //path segment at the front so it can be mapped
                                            //correctly to disk. Otherwise, there is likely
                                            //no path mapping for a path starting with '..'.
                Severity: Major
                Found in public/visualcaptcha.jquery.src.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if ( is_array( $arg1 ) && isset( $arg1[ 'comment_post_ID' ] ) && !empty( $arg1[ 'comment_post_ID' ] ) ) {
                                          wp_die( __( 'ERROR: You failed the human verification test. Please go back and try again.', 'visualcaptcha' ) );
                                      }
                  Severity: Major
                  Found in visualcaptcha.php - About 45 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language