clayton/sslcheck

View on GitHub

Showing 10 of 10 total issues

Class Certificate has 23 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Certificate
    def initialize(cert, clock=nil)
      @cert = bootstrap_certificate(cert)
      @clock = clock || DateTime
    end
Severity: Minor
Found in lib/sslcheck/certificate.rb - About 2 hrs to fix

    Method has too many lines. [31/30]
    Open

        def get(url)
          begin
            Timeout::timeout(Client.timeout_seconds) {
              uri = determine_uri(url)
    
    
    Severity: Minor
    Found in lib/sslcheck/client.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method get has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def get(url)
          begin
            Timeout::timeout(Client.timeout_seconds) {
              uri = determine_uri(url)
    
    
    Severity: Minor
    Found in lib/sslcheck/client.rb - About 1 hr to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      module SSLCheck
        module Validators
          class IssueDate < GenericValidator
            def validate(clock=DateTime)
              return nil if clock.now > @peer_cert.not_before
      Severity: Minor
      Found in lib/sslcheck/validators/issue_date.rb and 1 other location - About 25 mins to fix
      lib/sslcheck/validators/expiration_date.rb on lines 3..8

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 30.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      module SSLCheck
        module Validators
          class ExpirationDate < GenericValidator
            def validate(clock=DateTime)
              return nil if clock.now < @peer_cert.not_after
      Severity: Minor
      Found in lib/sslcheck/validators/expiration_date.rb and 1 other location - About 25 mins to fix
      lib/sslcheck/validators/issue_date.rb on lines 3..8

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 30.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          xcontext "when the certificate is on a subdomain, but not a wildcard cert" do
            before do
              @check = Checker.new.check("https://www.httpbin.org")
            end
            it 'should be valid' do
      Severity: Minor
      Found in acceptance/checking_certificates_spec.rb and 1 other location - About 20 mins to fix
      acceptance/checking_certificates_spec.rb on lines 45..53

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 27.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          context "when the common name is not correct" do
            before do
              @check = Checker.new.check('https://wrong.host.badssl.com/')
            end
            it 'should not be valid' do
      Severity: Minor
      Found in acceptance/checking_certificates_spec.rb and 1 other location - About 20 mins to fix
      acceptance/checking_certificates_spec.rb on lines 34..42

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 27.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Shadowing outer local variable - ext.
      Open

            ext = @cert.extensions.find{|ext| ext.oid == "subjectAltName" }
      Severity: Minor
      Found in lib/sslcheck/certificate.rb by rubocop

      This cop looks for use of the same name as outer local variables for block arguments or block local variables. This is a mimic of the warning "shadowing outer local variable - foo" from ruby -cw.

      Example:

      # bad
      
      def some_method
        foo = 1
      
        2.times do |foo| # shadowing outer `foo`
          do_something(foo)
        end
      end

      Example:

      # good
      
      def some_method
        foo = 1
      
        2.times do |bar|
          do_something(bar)
        end
      end

      Do not suppress exceptions.
      Open

                rescue OpenSSL::X509::StoreError

      This cop checks for rescue blocks with no body.

      Example:

      # bad
      
      def some_method
        do_something
      rescue
        # do nothing
      end

      Example:

      # bad
      
      begin
        do_something
      rescue
        # do nothing
      end

      Example:

      # good
      
      def some_method
        do_something
      rescue
        handle_exception
      end

      Example:

      # good
      
      begin
        do_something
      rescue
        handle_exception
      end

      Do not suppress exceptions.
      Open

              rescue OpenSSL::X509::StoreError

      This cop checks for rescue blocks with no body.

      Example:

      # bad
      
      def some_method
        do_something
      rescue
        # do nothing
      end

      Example:

      # bad
      
      begin
        do_something
      rescue
        # do nothing
      end

      Example:

      # good
      
      def some_method
        do_something
      rescue
        handle_exception
      end

      Example:

      # good
      
      begin
        do_something
      rescue
        handle_exception
      end
      Severity
      Category
      Status
      Source
      Language