promiscuous-io/promiscuous

View on GitHub

Showing 27 of 27 total issues

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

    def db_operation_and_select
      # XXX This is only supported by Postgres and should be in the postgres driver
      @connection.transaction do
        if @connection.supports_returning_statments?
          @connection.exec_insert("#{@connection.to_sql(@arel, @binds)} RETURNING *", @operation_name, @binds).tap do |result|
Severity: Minor
Found in lib/promiscuous/publisher/operation/active_record.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 trace has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def trace(msg, options={})
    level = ENV['TRACE'].to_i - options[:level].to_i
    return if level < 0

    backtrace = options[:backtrace]
Severity: Minor
Found in lib/promiscuous/publisher/context/base.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def execute(&db_operation)
      return db_operation.call unless model
      ensure_transaction!

      super do |query|
Severity: Minor
Found in lib/promiscuous/publisher/operation/active_record.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 publish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def publish(*args, &block)
      super

      args.extract_options!
      attributes = args
Severity: Minor
Found in lib/promiscuous/publisher/model/mock.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 subscribe_on has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.subscribe_on(method, options={})
      define_method(method) do |name, *args, &block|
        super(name, *args, &block)
        if @in_subscribe_block
          name = args.last[:as] if args.last.is_a?(Hash) && args.last[:as]
Severity: Minor
Found in lib/promiscuous/subscriber/model/mongoid.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 with_instance_locked_for has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def with_instance_locked_for(operation, &block)
    return yield unless operation.version

    key = "#{app}:#{operation.key}"
    lock = Redis::Lock.new(key, LOCK_OPTIONS.merge(:redis => Promiscuous::Redis.connection))
Severity: Minor
Found in lib/promiscuous/subscriber/unit_of_work.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 publish_on has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.publish_on(method, options={})
      define_method(method) do |name, *args, &block|
        super(name, *args, &block)
        if self.in_publish_block?
          name = args.last[:as] if args.last.is_a?(Hash) && args.last[:as]
Severity: Minor
Found in lib/promiscuous/publisher/model/mongoid.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