ronin-rb/ronin-support

View on GitHub
lib/ronin/support/encoding/uri.rb

Summary

Maintainability
C
7 hrs
Test Coverage

Consider simplifying this complex logical expression.
Open

            if (byte == 33) || (byte == 36) || (byte == 38) || ((byte >= 39) && (byte <= 59)) || (byte == 61) || ((byte >= 63) && (byte <= 91)) || (byte == 93) || (byte == 95) || ((byte >= 97) && (byte <= 122)) || (byte == 126)
              byte.chr
            else
              encode_byte(byte,**kwargs)
            end
Severity: Critical
Found in lib/ronin/support/encoding/uri.rb - About 3 hrs to fix

    Consider simplifying this complex logical expression.
    Open

                if (byte == 42) || (byte == 45) || (byte == 46) || ((byte >= 48) && (byte <= 57)) || ((byte >= 65) && (byte <= 90)) || (byte == 95) || ((byte >= 97) && (byte <= 122))
                  byte.chr
                else
                  encode_byte(byte,**kwargs)
                end
    Severity: Critical
    Found in lib/ronin/support/encoding/uri.rb - About 2 hrs to fix

      Method escape_byte has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

              def self.escape_byte(byte,**kwargs)
                if (byte >= 0) && (byte <= 0xff)
                  if (byte == 33) || (byte == 36) || (byte == 38) || ((byte >= 39) && (byte <= 59)) || (byte == 61) || ((byte >= 63) && (byte <= 91)) || (byte == 93) || (byte == 95) || ((byte >= 97) && (byte <= 122)) || (byte == 126)
                    byte.chr
                  else
      Severity: Minor
      Found in lib/ronin/support/encoding/uri.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 escape_byte has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

                def self.escape_byte(byte,**kwargs)
                  if (byte == 42) || (byte == 45) || (byte == 46) || ((byte >= 48) && (byte <= 57)) || ((byte >= 65) && (byte <= 90)) || (byte == 95) || ((byte >= 97) && (byte <= 122))
                    byte.chr
                  else
                    encode_byte(byte,**kwargs)
      Severity: Minor
      Found in lib/ronin/support/encoding/uri.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

      There are no issues that match your filters.

      Category
      Status