felixarntz/wp-encrypt

View on GitHub

Showing 86 of 92 total issues

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

        private static function maybe_create_dir( $path ) {
            $filesystem = self::get_filesystem();

            if ( ! $filesystem->is_dir( $path ) ) {
                if ( ! $filesystem->is_dir( dirname( $path ) ) ) {
Severity: Minor
Found in inc/WPENC/Core/Util.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 schedule_autogenerate_event has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        public static function schedule_autogenerate_event( $generate_timestamp = null, $reschedule = false ) {
            $timestamp = wp_next_scheduled( 'wp_encrypt_generate_certificate' );
            if ( $timestamp && $reschedule ) {
                wp_unschedule_event( $timestamp, 'wp_encrypt_generate_certificate' );
                $timestamp = false;
Severity: Minor
Found in inc/WPENC/Util.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 revoke_certificate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        public function revoke_certificate( $domain ) {
            $certificate = Certificate::get( $domain );
            if ( ! $certificate->exists() ) {
                return new WP_Error( 'cert_not_exist', sprintf( __( 'The certificate <code>%s</code> does not exist.', 'wp-encrypt' ), $domain_path . '/cert.pem' ) );
            }
Severity: Minor
Found in inc/WPENC/Core/CertificateManager.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 register_account has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        protected function register_account( $data = array(), $network_wide = false ) {
            $filesystem_check = $this->maybe_request_filesystem_credentials( $network_wide );
            if ( false === $filesystem_check ) {
                return new WP_Error( 'invalid_filesystem_credentials', __( 'Invalid or missing filesystem credentials.', 'wp-encrypt' ), 'error' );
            }
Severity: Minor
Found in inc/WPENC/ActionHandler.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 set has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        public function set( $certs ) {
            $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 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 check_valid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public function check_valid( $options ) {
            $required_fields = array( 'country_code', 'country_name', 'organization' );
            $valid = true;
            foreach ( $required_fields as $required_field ) {
                if ( ! isset( $options[ $required_field ] ) || empty( $options[ $required_field ] ) ) {
Severity: Minor
Found in inc/WPENC/Admin.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 request has a Cognitive Complexity of 7 (exceeds 5 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 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 get_network_domain has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public static function get_network_domain( $network_id = null ) {
            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 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

Avoid too many return statements within this method.
Open

            return $options[ $field ];
Severity: Major
Found in inc/WPENC/Util.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return $this->parse_wp_error( $result, 'new_cert_invalid_response_code', __( 'Invalid response code for new certificate request.', 'wp-encrypt' ) );
    Severity: Major
    Found in inc/WPENC/Core/CertificateManager.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return array(
                      'domains'    => $all_domains,
                  );
      Severity: Major
      Found in inc/WPENC/Core/CertificateManager.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return trim( $matches[1] );
        Severity: Major
        Found in inc/WPENC/Core/Certificate.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return new WP_Error( 'no_challenge_available', sprintf( __( 'No HTTP challenge available for domain %1$s. Original response: %2$s', 'wp-encrypt' ), $domain, json_encode( $response ) ) );
          Severity: Major
          Found in inc/WPENC/Core/Challenge.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return new WP_Error( 'public_key_cannot_write', sprintf( __( 'Could not write public key into file <code>%s</code>. Please check your filesystem permissions.', 'wp-encrypt' ), $this->path . '/' . self::PUBLIC_NAME ) );
            Severity: Major
            Found in inc/WPENC/Core/KeyPair.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                              return new WP_Error( 'challenge_self_check_failed', sprintf( __( 'Challenge self check failed for domain %s.', 'wp-encrypt' ), $domain ) );
              Severity: Major
              Found in inc/WPENC/Core/Challenge.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return true;
                Severity: Major
                Found in inc/WPENC/Core/KeyPair.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                      return new WP_Error( 'challenge_remote_check_failed', sprintf( __( 'Challenge remote check failed for domain %s.', 'wp-encrypt' ), $domain ) );
                  Severity: Major
                  Found in inc/WPENC/Core/Challenge.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                    return new WP_Error( 'csr_cannot_write', sprintf( __( 'Could not write CSR into file <code>%s</code>. Please check your filesystem permissions.', 'wp-encrypt' ), $this->path . '/last.csr' ) );
                    Severity: Major
                    Found in inc/WPENC/Core/Certificate.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                          return absint( $options[ $field ] );
                      Severity: Major
                      Found in inc/WPENC/Util.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return new WP_Error( 'challenge_cannot_write_file', sprintf( __( 'Could not write challenge to file <code>%s</code>. Please check your filesystem permissions.', 'wp-encrypt' ), $token_path ) );
                        Severity: Major
                        Found in inc/WPENC/Core/Challenge.php - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language