felixarntz/wp-encrypt

View on GitHub

Showing 92 of 92 total issues

Function signed_request has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

        public function signed_request( $endpoint, $data = null ) {
            $account_keypair = AccountKeyPair::get();

            $account_key_resource = $account_keypair->read_private();
            if ( is_wp_error( $account_key_resource ) ) {
Severity: Minor
Found in inc/WPENC/Core/Client.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 signed_request has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function signed_request( $endpoint, $data = null ) {
            $account_keypair = AccountKeyPair::get();

            $account_key_resource = $account_keypair->read_private();
            if ( is_wp_error( $account_key_resource ) ) {
Severity: Minor
Found in inc/WPENC/Core/Client.php - About 1 hr to fix

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

            private function parse_wp_error( $response, $code = false, $message = false, $data = '' ) {
                if ( ! $code ) {
                    $code = 'letsencrypt_error';
                }
    
    
    Severity: Minor
    Found in inc/WPENC/Core/CertificateManager.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 needs_filesystem_credentials has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

            public static function needs_filesystem_credentials( $credentials = false ) {
                $paths = self::get_filesystem_paths();
                $type = 'direct';
                $is_direct = true;
                foreach ( $paths as $key => $path ) {
    Severity: Minor
    Found in inc/WPENC/Core/Util.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 maybe_request_filesystem_credentials has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

            protected function maybe_request_filesystem_credentials( $network_wide = false ) {
                if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
                    $credentials = array();
    
                    $fields = array( 'hostname', 'port', 'username', 'password', 'public_key', 'private_key', 'connection_type' );
    Severity: Minor
    Found in inc/WPENC/ActionHandler.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 setup_filesystem has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public static function setup_filesystem( $form_post, $extra_fields = array() ) {
                global $wp_filesystem;
    
                $paths = self::get_filesystem_paths();
                $type = 'direct';
    Severity: Minor
    Found in inc/WPENC/Core/Util.php - About 1 hr to fix

      Method get_network_addon_domains has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public static function get_network_addon_domains( $network_id = null, $global = false ) {
                  if ( version_compare( get_bloginfo( 'version' ), '4.6', '<' ) ) {
                      if ( ! $network_id ) {
                          $network = get_current_site();
                      } else {
      Severity: Minor
      Found in inc/WPENC/Util.php - About 1 hr to fix

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

                protected function handle_request( $mode = 'admin' ) {
                    $ajax = false;
                    $prefix = 'admin_action_wpenc_';
                    $args = $_REQUEST;
        
        
        Severity: Minor
        Found in inc/WPENC/ActionHandler.php - About 1 hr to fix

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

                  public static function get_network_site_ids( $global = false ) {
                      $ids = array();
          
                      if ( version_compare( get_bloginfo( 'version' ), '4.6', '<' ) ) {
                          $args = array();
          Severity: Minor
          Found in inc/WPENC/Util.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 generate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public function generate() {
                      $filesystem = Util::get_filesystem();
          
                      $status = Util::maybe_create_letsencrypt_certificates_dir();
                      if ( is_wp_error( $status ) ) {
          Severity: Minor
          Found in inc/WPENC/Core/KeyPair.php - About 1 hr to fix

            Method render_apache_instructions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    protected function render_apache_instructions( $site_domain, $site_dir, $certificate_dirs ) {
                        $config = '<VirtualHost 192.168.0.1:443>
            DocumentRoot ' . untrailingslashit( $site_dir ) . '
            ServerName ' . $site_domain . '
            SSLEngine on
            Severity: Minor
            Found in inc/WPENC/Admin.php - About 1 hr to fix

              Function validate_settings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                      public function validate_settings( $options = array() ) {
                          $options = array_map( 'strip_tags', array_map( 'trim', $options ) );
              
                          if ( isset( $options['country_code'] ) ) {
                              $options['country_code'] = strtoupper( substr( $options['country_code'], 0, 2 ) );
              Severity: Minor
              Found in inc/WPENC/Admin.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 maybe_show_expire_warning has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                      public function maybe_show_expire_warning() {
                          if ( ! Util::get_option( 'show_warning' ) ) {
                              return;
                          }
              
              
              Severity: Minor
              Found in inc/WPENC/Admin.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 get_option has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public static function get_option( $field ) {
                          $options = get_site_option( 'wp_encrypt_settings', array() );
                          if ( ! isset( $options[ $field ] ) ) {
                              switch ( $field ) {
                                  case 'organization':
              Severity: Minor
              Found in inc/WPENC/Util.php - About 1 hr to fix

                Method maybe_show_expire_warning has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public function maybe_show_expire_warning() {
                            if ( ! Util::get_option( 'show_warning' ) ) {
                                return;
                            }
                
                
                Severity: Minor
                Found in inc/WPENC/Admin.php - About 1 hr to fix

                  Method render_help_getting_started has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public function render_help_getting_started() {
                              ?>
                              <p><?php _e( 'To obtain your first SSL certificate, follow these steps:', 'wp-encrypt' ); ?></p>
                  
                              <ol>
                  Severity: Minor
                  Found in inc/WPENC/Admin.php - About 1 hr to fix

                    Function generate_csr has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public function generate_csr( $key_resource, $domains, $dn = array() ) {
                                $filesystem = Util::get_filesystem();
                    
                                $status = Util::maybe_create_letsencrypt_certificates_dir();
                                if ( is_wp_error( $status ) ) {
                    Severity: Minor
                    Found in inc/WPENC/Core/Certificate.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 request has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public function request( $endpoint, $method = 'GET', $data = null ) {
                                if ( is_array( $data ) ) {
                                    $data = json_encode( $data );
                                }
                    
                    
                    Severity: Minor
                    Found in inc/WPENC/Core/Client.php - About 1 hr to fix

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

                              protected function render_nginx_instructions( $site_domain, $site_dir, $certificate_dirs ) {
                                  $config = 'server {
                      
                          listen   443;
                      
                      
                      Severity: Minor
                      Found in inc/WPENC/Admin.php - About 1 hr to fix

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

                                public function update_network_option() {
                                    if ( ! isset( $_POST['option_page'] ) || ! isset( $_POST['action'] ) || 'update' !== $_POST['action'] ) {
                                        return;
                                    }
                        
                        
                        Severity: Minor
                        Found in inc/WPENC/NetworkSettingsAPI.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

                        Severity
                        Category
                        Status
                        Source
                        Language