thekuwayama/ocsprf

View on GitHub

Showing 6 of 8 total issues

Method parse_options has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def parse_options(argv = ARGV)
        op = OptionParser.new

        # default value
        opts = {
Severity: Major
Found in lib/ocsp_response_fetch/cli.rb - About 2 hrs to fix

    Method request_and_validate has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def request_and_validate(cid, ocsp_uri, certs)
            ocsp_request = gen_ocsp_request(cid)
            ocsp_response = nil
            begin
              Timeout.timeout(2) do
    Severity: Minor
    Found in lib/ocsp_response_fetch/fetcher.rb - About 1 hr to fix

      Method parse_options has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def parse_options(argv = ARGV)
              op = OptionParser.new
      
              # default value
              opts = {
      Severity: Minor
      Found in lib/ocsp_response_fetch/cli.rb - 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 read_certs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

            def read_certs(subject, issuer = nil)
              subject_cert = OpenSSL::X509::Certificate.new(File.read(subject))
              issuer_cert = nil
              if issuer.nil? || issuer.empty?
                ca_issuer = subject_cert.ca_issuer_uris
      Severity: Minor
      Found in lib/ocsp_response_fetch/cli.rb - 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

      Method request_and_validate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def request_and_validate(cid, ocsp_uri, certs)
              ocsp_request = gen_ocsp_request(cid)
              ocsp_response = nil
              begin
                Timeout.timeout(2) do
      Severity: Minor
      Found in lib/ocsp_response_fetch/fetcher.rb - 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

      Method run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def run
              subject, opts = parse_options
              issuer = opts[:issuer]
              ocsp_response = nil
              begin
      Severity: Minor
      Found in lib/ocsp_response_fetch/cli.rb - About 25 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