Showing 25 of 27 total issues

Method start has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring.
Open

      def start(port=8081)
        serv = TCPServer.new("localhost", port)
        MIDB::Interface::Server.info(:start, port)

        # Manage the requests
Severity: Minor
Found in lib/midb/serverengine_controller.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 do_set has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

      def do_set()
        MIDB::Interface::Errors.die(:syntax) if @args.length < 2
        subset = @args[1].split(":")[0]
        subcmd = @args[1].split(":")[1]
        set = @args.length < 3 ? false : true
Severity: Minor
Found in lib/midb/server_controller.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 start has 117 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def start(port=8081)
        serv = TCPServer.new("localhost", port)
        MIDB::Interface::Server.info(:start, port)

        # Manage the requests
Severity: Major
Found in lib/midb/serverengine_controller.rb - About 4 hrs to fix

File server_model.rb has 345 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'midb/server_controller'
require 'midb/dbengine_model'
require 'midb/server_view'
require 'midb/hooks'

Severity: Minor
Found in lib/midb/server_model.rb - About 4 hrs to fix

Method post has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

      def post(data)
        jss = self.get_structure() # For referencing purposes

        input = self.query_to_hash(data)
        bad_request = false
Severity: Minor
Found in lib/midb/server_model.rb - About 3 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 get_matching_rows has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

      def get_matching_rows(column, pattern)
        jso = Hash.new() 
        jss = self.get_structure()
        db_column = nil
        # Is the column recognized?
Severity: Minor
Found in lib/midb/server_model.rb - About 3 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_set has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def do_set()
        MIDB::Interface::Errors.die(:syntax) if @args.length < 2
        subset = @args[1].split(":")[0]
        subcmd = @args[1].split(":")[1]
        set = @args.length < 3 ? false : true
Severity: Major
Found in lib/midb/server_controller.rb - About 2 hrs to fix

Method post has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def post(data)
        jss = self.get_structure() # For referencing purposes

        input = self.query_to_hash(data)
        bad_request = false
Severity: Major
Found in lib/midb/server_model.rb - About 2 hrs to fix

Method put has 58 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def put(id, data)
        jss = self.get_structure() # For referencing purposes

        input = self.query_to_hash(data)
        bad_request = false
Severity: Major
Found in lib/midb/server_model.rb - About 2 hrs to fix

Method get_entries has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def get_entries(id)
        jso = Hash.new()

        dbe = MIDB::API::Dbengine.new(@engine.config, @db)
        dblink = dbe.connect()
Severity: Minor
Found in lib/midb/server_model.rb - About 2 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 get_matching_rows has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def get_matching_rows(column, pattern)
        jso = Hash.new() 
        jss = self.get_structure()
        db_column = nil
        # Is the column recognized?
Severity: Minor
Found in lib/midb/server_model.rb - About 2 hrs to fix

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

      def put(id, data)
        jss = self.get_structure() # For referencing purposes

        input = self.query_to_hash(data)
        bad_request = false
Severity: Minor
Found in lib/midb/server_model.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 delete has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def delete(id)
        # Check if the ID exists
        db = MIDB::API::Dbengine.new(@engine.config, @db)
        dbc = db.connect()
        dbq = db.query(dbc, "SELECT * FROM #{self.get_structure.values[0].split('/')[0]} WHERE id=#{id};")
Severity: Minor
Found in lib/midb/server_model.rb - About 1 hr to fix

Method get_column_entries has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def get_column_entries(column)
        jso = Hash.new() 
        jss = self.get_structure()
        db_column = nil
        # Is the column recognized?
Severity: Minor
Found in lib/midb/server_model.rb - About 1 hr to fix

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

      def get_all_entries()
        jso = Hash.new()
     
        # Connect to database
        dbe = MIDB::API::Dbengine.new(@engine.config, @db)
Severity: Minor
Found in lib/midb/server_model.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 delete has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def delete(id)
        # Check if the ID exists
        db = MIDB::API::Dbengine.new(@engine.config, @db)
        dbc = db.connect()
        dbq = db.query(dbc, "SELECT * FROM #{self.get_structure.values[0].split('/')[0]} WHERE id=#{id};")
Severity: Minor
Found in lib/midb/server_model.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 get_entries has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def get_entries(id)
        jso = Hash.new()

        dbe = MIDB::API::Dbengine.new(@engine.config, @db)
        dblink = dbe.connect()
Severity: Minor
Found in lib/midb/server_model.rb - About 1 hr to fix

Method get_column_entries has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def get_column_entries(column)
        jso = Hash.new() 
        jss = self.get_structure()
        db_column = nil
        # Is the column recognized?
Severity: Minor
Found in lib/midb/server_model.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 help has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def self.help(what)
        case what
        when :list
          puts "midb v1.1.1 has several commands that you can use. For detailed information, see `midb help command`."
          puts " "
Severity: Minor
Found in lib/midb/server_view.rb - About 1 hr to fix

Method get_all_entries has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def get_all_entries()
        jso = Hash.new()
     
        # Connect to database
        dbe = MIDB::API::Dbengine.new(@engine.config, @db)
Severity: Minor
Found in lib/midb/server_model.rb - About 1 hr to fix
Severity
Category
Status
Source
Language