Showing 316 of 336 total issues

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

    def method_missing(method_name, *args, &block)
      method_name = method_name.to_sym
      if @locals && @locals.key?(method_name)
        obj = @locals[method_name]

Severity: Minor
Found in lib/volt/page/sub_context.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def update(value)
      # Since we're checking things like size, we don't want this to be re-triggered on a
      # size change, so we run without tracking.
      Computation.run_without_tracking do
        # Adjust to the new size
Severity: Minor
Found in lib/volt/page/bindings/each_binding.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(app, options = {})
      @app = app
      @options = Volt.config.http_content_types ? Volt.config.http_content_types.dup : {}
      @options.merge!(options)
      @parsers = @options[:parsers] || {}
Severity: Minor
Found in lib/volt/server/rack/http_content_types.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 permissions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def permissions(*actions, &block)
          # Store the permissions block so we can run it in validations
          self.__permissions__ ||= {}

          # if no action was specified, assume all actions
Severity: Minor
Found in lib/volt/models/permissions.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 delete has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def delete(val)
      # Check to make sure the models are allowed to be deleted
      if !val.is_a?(Model)
        # Not a model, return as a Promise
        super(val).then
Severity: Minor
Found in lib/volt/models/array_model.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 setup_port_ranges has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def setup_port_ranges
          port_ranges = Volt.config.message_bus.try(:bind_port_ranges)

          if port_ranges
            # Expand any ranges, then sample one from the array
Severity: Minor
Found in lib/volt/server/message_bus/peer_to_peer/peer_server.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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate(field_name = nil, options = nil, &block)
      if block
        # Setup a custom validation inside of the current validations block.
        if field_name || options
          fail 'validate should be passed a field name and options or a block, not both.'
Severity: Minor
Found in lib/volt/models/validations/validations.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 save_to_db! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def save_to_db!(values)
          # Check to make sure the model has no validation errors.
          errors = @model.errors
          return errors if errors.present?

Severity: Minor
Found in lib/volt/models/persistors/model_store.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 advance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def advance(options)
    t = self
    t = advance_years(options[:years]) if options[:years]
    t = advance_months(options[:months]) if options[:months]
    t = advance_days(options[:days]) if options[:days]
Severity: Minor
Found in lib/volt/helpers/time/calculations.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 transform_keys has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.transform_keys(data, &block)
      if data.is_a?(Hash)
        data.map do |key, value|
          key = transform_keys(key, &block)
          value = transform_keys(value, &block)
Severity: Minor
Found in lib/volt/utils/data_transformer.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 nested_params_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def nested_params_hash(params, path = [])
      results = {}

      params.each_pair do |key, value|
        unless value.nil?
Severity: Minor
Found in lib/volt/models/url.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 fetch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def fetch(&block)
        Volt.logger.warn('Deprication warning: in 0.9.3.pre4, all query methods on store now return Promises, so you can juse use .all or .first instead of .fetch')
        promise = Promise.new

        # Run the block after resolve if a block is passed in
Severity: Minor
Found in lib/volt/models/persistors/array_store.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 belongs_to has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def belongs_to(method_name, options = {})
        collection  ||= options.fetch(:collection, method_name).pluralize
        foreign_key ||= options.fetch(:foreign_key, :id)
        local_key   ||= options.fetch(:local_key, "#{method_name}_id")

Severity: Minor
Found in lib/volt/models/associations.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 on has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def on(*events, &callback)
      fail '.on requires an event' if events.size == 0

      listener = Listener.new(self, events, callback)

Severity: Minor
Found in lib/volt/reactive/eventable.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 exists_here_or_up? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.exists_here_or_up?(file)
      # Check for a gemfile here or up a directory
      pwd = Dir.pwd

      loop do
Severity: Minor
Found in lib/volt/utils/recursive_exists.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 read_new_model has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def read_new_model(method_name)
      if @persistor && @persistor.respond_to?(:read_new_model)
        return @persistor.read_new_model(method_name)
      else
        opts = @options.merge(parent: self, path: path + [method_name])
Severity: Minor
Found in lib/volt/models/model.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 transform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.transform(data, &block)
      if data.is_a?(Hash)
        data.map do |key, value|
          key = transform(key, &block)
          value = transform(value, &block)
Severity: Minor
Found in lib/volt/utils/data_transformer.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 release_write_lock has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def release_write_lock
    loop do
      c = @counter.value
      if @counter.compare_and_swap(c, c - RUNNING_WRITER)
        @reader_mutex.synchronize { @reader_q.broadcast }
Severity: Minor
Found in lib/volt/utils/read_write_lock.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 all? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def all?
      if block_given?
        size.times do |index|
          val = self[index]

Severity: Minor
Found in lib/volt/reactive/reactive_array.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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(url)
      if url[0] == '#'
        # url only updates fragment
        self.fragment = url[1..-1]
        update!
Severity: Minor
Found in lib/volt/models/url.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