le0pard/mongodb_logger

View on GitHub

Showing 64 of 86 total issues

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

    def ensure_write_to_mongodb
      @insert_block.call
    rescue
      begin
        # try to nice serialize record
Severity: Minor
Found in lib/mongodb_logger/logger.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 create_logger has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create_logger(config)
      path = config.paths['log'].first
      level = RailsLogger.const_get(config.log_level.to_s.upcase)
      logger = MongodbLogger::Logger.new(path, level)
      # decorating with TaggedLogging
Severity: Minor
Found in lib/mongodb_logger/initializer_mixin.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 rescue_connection_failure has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def rescue_connection_failure(max_retries = 40)
      success = false
      retries = 0
      while !success
        begin
Severity: Minor
Found in lib/mongodb_logger/replica_set_helper.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 set_params_to_methods has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def set_params_to_methods
        @params.each do |k,v|
          self.send("#{k}=", v) if self.respond_to?(k) && v && !v.blank?
        end unless @params.blank?
      end
Severity: Minor
Found in lib/mongodb_logger/server/model/base.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