moserrya/knod

View on GitHub

Showing 4 of 4 total issues

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

  class Server
    include FileUtilities

    attr_reader :server, :client, :request

Severity: Minor
Found in lib/knod/server.rb - About 2 hrs to fix

    Method patch_merge! has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def patch_merge!(other_hash, &block)
          other_hash.each_pair do |k, v|
            tv = self[k]
            if tv.is_a?(Hash) && v.is_a?(Hash)
              self[k] = tv.patch_merge(v, &block)
    Severity: Minor
    Found in lib/knod/patch_merge.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 do_GET has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def do_GET(head = false)
          path = requested_path
    
          if file?(path)
            File.open(path, 'rb') do |file|
    Severity: Minor
    Found in lib/knod/server.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 requested_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def requested_path
          local_path = URI.unescape(URI(request.uri).path)
    
          clean = []
    
    
    Severity: Minor
    Found in lib/knod/server.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

    Severity
    Category
    Status
    Source
    Language