thekuwayama/tttls1.3

View on GitHub
lib/tttls1.3/server.rb

Summary

Maintainability
F
3 days
Test Coverage

Method accept has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
Open

    def accept
      @transcript = Transcript.new
      key_schedule = nil # TTTLS13::KeySchedule
      priv_key = nil # OpenSSL::PKey::$Object
      hs_wcipher = nil # TTTLS13::Cryptograph::$Object
Severity: Minor
Found in lib/tttls1.3/server.rb - 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 accept has 167 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def accept
      @transcript = Transcript.new
      key_schedule = nil # TTTLS13::KeySchedule
      priv_key = nil # OpenSSL::PKey::$Object
      hs_wcipher = nil # TTTLS13::Cryptograph::$Object
Severity: Major
Found in lib/tttls1.3/server.rb - About 6 hrs to fix

    File server.rb has 438 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module TTTLS13
      using Refinements
    
      module ServerState
        # initial value is 0, eof value is -1
    Severity: Minor
    Found in lib/tttls1.3/server.rb - About 6 hrs to fix

      Class Server has 28 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Server
          include Logging
      
          attr_reader :transcript
      
      
      Severity: Minor
      Found in lib/tttls1.3/server.rb - About 3 hrs to fix

        Method gen_certificate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def gen_certificate(crt, ch, chain = [], ocsp_response = nil)
              exs = Message::Extensions.new
              # status_request
              exs << Message::Extension::OCSPResponse.new(ocsp_response) \
                unless ocsp_response.nil?
        Severity: Minor
        Found in lib/tttls1.3/server.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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(socket, **settings)
              @connection = Connection.new(socket, :server)
              @settings = DEFAULT_SERVER_SETTINGS.merge(settings)
              logger.level = @settings[:loglevel]
        
        
        Severity: Minor
        Found in lib/tttls1.3/server.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 valid_settings? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def valid_settings?
              mod = CipherSuite
              defined = mod.constants.map { |c| mod.const_get(c) }
              return false unless (@settings[:cipher_suites] - defined).empty?
        
        
        Severity: Minor
        Found in lib/tttls1.3/server.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

        There are no issues that match your filters.

        Category
        Status