le0pard/mongodb_logger

View on GitHub

Showing 86 of 86 total issues

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 partial has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def partial(template, *args)
    template_array = template.to_s.split('/')
    template = template_array[0..-2].join('/') + "/_#{template_array[-1]}"
    options = args.last.is_a?(Hash) ? args.pop : {}
    options.merge!(:layout => false)
Severity: Minor
Found in lib/mongodb_logger/server/helpers/partials.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

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

Function addItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    addItem: function(item) {

        if (typeof(item.name) === 'undefined') {
            throw('addItem() needs a name');
        }
Severity: Minor
Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - 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

Function Legend has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

Rickshaw.Graph.Legend = function(args) {

    var element = this.element = args.element;
    var graph = this.graph = args.graph;

Severity: Minor
Found in app/assets/javascripts/vendors/rickshaw/rickshaw.js - 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