kaspernj/baza

View on GitHub
lib/baza/base_sql_driver.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Class BaseSqlDriver has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

class Baza::BaseSqlDriver
  attr_reader :db, :conn, :sep_database, :sep_table, :sep_col, :sep_val, :sep_index
  attr_accessor :tables, :cols, :indexes

  SEPARATOR_DATABASE = "`".freeze
Severity: Minor
Found in lib/baza/base_sql_driver.rb - About 4 hrs to fix

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

      def sql_make_where(arr_terms, _driver = nil)
        sql = ""
    
        first = true
        arr_terms.each do |key, value|
    Severity: Minor
    Found in lib/baza/base_sql_driver.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 quote_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.quote_value(val)
        if val.class.name == "Fixnum" || val.is_a?(Integer)
          val.to_s
        elsif val == nil
          "NULL"
    Severity: Minor
    Found in lib/baza/base_sql_driver.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

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

      def quote_value(val)
        if val.class.name == "Fixnum" || val.is_a?(Integer)
          val.to_s
        elsif val == nil
          "NULL"
    Severity: Minor
    Found in lib/baza/base_sql_driver.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

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

      def insert_multi(tablename, arr_hashes, args = {})
        sql = [] if args && args[:return_sql]
    
        if args && args[:return_sql]
          arr_hashes.each do |hash|
    Severity: Minor
    Found in lib/baza/base_sql_driver.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

    There are no issues that match your filters.

    Category
    Status