ronin-rb/ronin-db

View on GitHub

Showing 4 of 4 total issues

Method validate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def self.validate(path,data)
        unless data.kind_of?(Hash)
          raise(InvalidConfig,"config data must be a Hash: #{data.inspect}")
        end

Severity: Minor
Found in lib/ronin/db/config_file.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 parse_uri has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

        def parse_uri(uri)
          if (match = uri.match(/\Asqlite(?:3)?:(.+)\z/))
            {
              adapter: 'sqlite3',
              database: normalize_sqlite3_path(match[1])
Severity: Minor
Found in lib/ronin/db/cli/uri_methods.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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

          def run(name=nil)
            config = ConfigFile.load

            if name
              unless (hash = config[name.to_sym])
Severity: Minor
Found in lib/ronin/db/cli/commands/list.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 import_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def import_file(path)
          unless File.file?(path)
            print_error "no such file or directory: #{path}"
            exit(-1)
          end
Severity: Minor
Found in lib/ronin/db/cli/modifiable.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