archan937/clickhouse

View on GitHub

Showing 4 of 339 total issues

Class Connection has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Connection
    module Query

      def execute(query, body = nil)
        body = post(query, body)
Severity: Minor
Found in lib/clickhouse/connection/query.rb - About 2 hrs to fix

    Method generate_csv has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def generate_csv(rows, names = nil)
            hashes = rows[0].is_a?(Hash)
    
            if hashes
              names ||= rows[0].keys
    Severity: Minor
    Found in lib/clickhouse/connection/query.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

    Method to_select_query has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def to_select_query(options)
            to_select_options(options).collect do |(key, value)|
              next if value.nil? || (value.respond_to?(:empty?) && value.empty?)
    
              statement = [key.to_s.upcase]
    Severity: Minor
    Found in lib/clickhouse/connection/query.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

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

          def to_condition_statements(value)
            value.collect do |attr, val|
              if val == :empty
                "empty(#{attr})"
              elsif val.is_a?(Range)
    Severity: Minor
    Found in lib/clickhouse/connection/query.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