otahi/pacproxy

View on GitHub

Showing 9 of 9 total issues

Method do_CONNECT has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def do_CONNECT(req, res)
      # Proxy Authentication
      proxy_auth(req, res)

      ua = Thread.current[:WEBrickSocket]  # User-Agent
Severity: Minor
Found in lib/pacproxy/pacproxy.rb - About 4 hrs 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 do_CONNECT has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def do_CONNECT(req, res)
      # Proxy Authentication
      proxy_auth(req, res)

      ua = Thread.current[:WEBrickSocket]  # User-Agent
Severity: Major
Found in lib/pacproxy/pacproxy.rb - About 2 hrs to fix

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

        def initialize
          c = Config.instance.config['general_log']
          return @logger = nil unless c
    
          location = c['location'] ? c['location'] : STDOUT
    Severity: Minor
    Found in lib/pacproxy/general_logger.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 initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def initialize
            js = File.join(File.dirname(__FILE__), 'find.js')
    
            retries = 3
            begin
    Severity: Minor
    Found in lib/pacproxy/runtimes/node/node.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 initialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def initialize
            js = File.join(File.dirname(__FILE__), 'find.js')
    
            retries = 3
            begin
    Severity: Minor
    Found in lib/pacproxy/runtimes/node/node.rb - About 1 hr to fix

      Method call_find has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def call_find(uri, retries = 3)
              proxy = nil
              begin
                mon = Monitor.new
                cond = mon.new_cond
      Severity: Minor
      Found in lib/pacproxy/runtimes/node/node.rb - About 1 hr to fix

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

            def initialize
              c = Config.instance.config['access_log']
              @format = WEBrick::AccessLog::COMMON_LOG_FORMAT
              return @logger = nil unless c
        
        
        Severity: Minor
        Found in lib/pacproxy/access_logger.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 create_proxy_uri has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def create_proxy_uri(proxy, header)
              return nil unless proxy
              return URI.parse("http://#{proxy}") unless
                @auth || header.key?('proxy-authorization')
        
        
        Severity: Minor
        Found in lib/pacproxy/pacproxy.rb - 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

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

            def self.which(cmd)
              exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
              ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
                exts.each do |ext|
                  exe = File.join(path, "#{cmd}#{ext}")
        Severity: Minor
        Found in lib/pacproxy/util.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