Showing 316 of 336 total issues

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

    def assign_attributes(attrs, initial_setup = false, skip_changes = false)
      attrs = wrap_values(attrs)

      if attrs
        # When doing a mass-assign, we don't validate or save until the end.
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 generate_view_code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def generate_view_code
      code = ''
      views_path = "#{@component_path}/views/"

      exts = Preprocessors.extensions
Severity: Minor
Found in lib/volt/server/component_templates.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(socket, ips, port, message_bus, server=false, peer_server_id=nil)
        @message_bus = message_bus
        @ips = ips
        @port = port
        @server = server
Severity: Minor
Found in lib/volt/server/message_bus/peer_to_peer/peer_connection.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 self.validate(model, field_name, args)
      errors = {}
      value  = model.get(field_name)
      if !value || value.blank?
        if args.is_a?(Hash) && args[:message]
Severity: Minor
Found in lib/volt/models/validators/presence_validator.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 count has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def count(&block)
      if block
        count = 0

        Volt.run_in_mode(:no_model_promises) do
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 process_message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def process_message(message)
      # Messages are json and wrapped in an array
      begin
        message = EJSON.parse(message).first
      rescue JSON::ParserError => e
Severity: Minor
Found in lib/volt/server/socket_connection_handler.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 find_by_binding_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def find_by_binding_id(binding_id)
      return self if @binding_id == binding_id

      @nodes.each do |node|
        if node.is_a?(ComponentNode)
Severity: Minor
Found in lib/volt/page/targets/binding_document/component_node.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 remove_duplicate_connections has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def remove_duplicate_connections
        peer_server_ids = {}

        # remove any we are connected to twice
        @peer_connections.keys.each do |peer|
Severity: Minor
Found in lib/volt/server/message_bus/peer_to_peer.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 send_message_all has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.send_message_all(skip_channel = nil, *args)
      return unless defined?(@@channels)
      @@channels.each do |channel|
        next if skip_channel && channel == skip_channel
        channel.send_message(*args)
Severity: Minor
Found in lib/volt/server/socket_connection_handler.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 run_callbacks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def run_callbacks(callback_name, action=nil)
      callbacks = self.class.send(:"#{callback_name}_callbacks")

      callbacks ||= []
      if action
Severity: Minor
Found in lib/volt/utils/lifecycle_callbacks.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 write_cookie has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def write_cookie(key, value, options = {})
        options[:path] ||= '/'
        parts = []

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

    def inspect
      Computation.run_without_tracking do
        str = "#<#{self.class}"


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

  def copy_options
    if @options[:coc] or yes?("\nDo you want to include a code of conduct in this gem?\n\n\
Codes of conduct can increase contributions to your project by contributors who \
prefer collaborative, safe spaces. You can read more about the code of conduct at \
contributor-covenant.org. Having a code of conduct means agreeing to the responsibility \
Severity: Minor
Found in lib/volt/cli/new_gem.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 link_clicked has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def link_clicked(url = '', event = nil)
      target = nil
      `target = $(event.target).attr('target');`
      `if (!target) {`
        `target = #{nil};`
Severity: Minor
Found in lib/volt/volt/client_setup/browser.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 load_stored_page has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def load_stored_page
      if Volt.client?
        if `sessionStorage`
          page = Volt.current_app.page
          page_obj_str = nil
Severity: Minor
Found in lib/volt/volt/client_setup/browser.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
      # Use VOLT_ENV or RACK_ENV to set the environment
      @env = ENV['VOLT_ENV'] || ENV['RACK_ENV']

      # If we're in opal, we can set the env from JS before opal loads
Severity: Minor
Found in lib/volt/volt/environment.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