Showing 141 of 177 total issues
Method set_table_sort
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_table_sort(sort_options)
valid_sorts = sort_options[:sorts] or raise ArgumentError.new("You must specify :sorts as an array of valid sort attributes.")
default = sort_options[:default] || { valid_sorts.first.to_sym => :desc }
if params[:sort].present?
- Read upRead up
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 grab_config_with_cmd!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def grab_config_with_cmd!(cmd, opts = {})
config_data = capture(cmd, opts)
$config = {}
if config_data !~ /has no config vars/
config_data.split("\n").map do |line|
- Read upRead up
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 apply_compiled_matchers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def apply_compiled_matchers(matchers, event, &block)
return yield if matchers.nil?
# event.payload.dup does not work; HashWithIndifferentAccess is
# a source of trouble here.
- Read upRead up
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 receive_web_request
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def receive_web_request(request)
params = request.params.except(:action, :controller, :agent_id, :user_id, :format)
method = request.method_symbol.to_s
headers = request.headers
- Read upRead up
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 convert_string
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.convert_string(string, leading_dollarsign_is_jsonpath=false)
if string == true || string == false
# there might be empty *_path attributes for boolean defaults
string
elsif string[0] == '$' && leading_dollarsign_is_jsonpath
- Read upRead up
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 configure_params
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def configure_params(params)
params[:chat_id] = interpolated['chat_id']
params[:disable_notification] =
interpolated['disable_notification'] if interpolated['disable_notification'].present?
if params.has_key?(:text)
- Read upRead up
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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
attrs = agent_params
if agent = current_user.agents.find_by(id: params[:agent_id])
# POST /agents/:id/dry_run
if attrs.present?
- Read upRead up
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
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def send_message(options)
@groups = options[:groups]
@headline = options[:headline]
@body = options[:body]
- Read upRead up
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_workers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def load_workers
workers = {}
@@agents.each do |klass|
next if @options[:only] && !@options[:only].include?(klass)
next if @options[:except] && @options[:except].include?(klass)
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if re && !re.names.include?(index)
errors.add(:base, "no named capture #{index.inspect} found in regexp for #{name.inspect})")
end
Method validate_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_options
errors.add(:base,
"you need to specify password if user name is set") if options['username'].present? and !options['password'].present?
errors.add(:base, "you need to specify your jira URL") unless options['jira_url'].present?
errors.add(:base,
- Read upRead up
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
Avoid deeply nested control flow statements. Open
rescue StandardError => e
errors.add(:base, "invalid regexp for #{name.inspect}: #{e.message}")
Method agent_type_icon
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def agent_type_icon(agent, agents)
receiver_count = links_counter_cache(agents)[:links_as_receiver][agent.id] || 0
control_count = links_counter_cache(agents)[:control_links_as_controller][agent.id] || 0
source_count = links_counter_cache(agents)[:links_as_source][agent.id] || 0
- Read upRead up
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 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(data = {})
super()
case data
when Array
- Read upRead up
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 build_for_type
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_for_type(type, user, attributes = {})
attributes.delete(:type)
if valid_type?(type)
type.constantize.new(attributes).tap do |instance|
- Read upRead up
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 extract_each
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def extract_each(&block)
interpolated['extract'].each_with_object(Output.new) { |(name, extraction_details), output|
if boolify(extraction_details['repeat'])
values = Repeater.new { |repeater|
block.call(extraction_details, repeater)
- Read upRead up
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
Avoid deeply nested control flow statements. Open
case details['xpath']
when String
# ok
when nil
errors.add(:base,
Method <=>
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def <=> other
other = other.array
@array.each_with_index do |e, i|
o = other[i]
case cmp = e <=> o || e.to_s <=> o.to_s
- Read upRead up
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_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_options
cred_name = credential_referenced_by_code
if cred_name
errors.add(:base,
"The credential '#{cred_name}' referenced by code cannot be found") unless credential(cred_name).present?
- Read upRead up
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 receive
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def receive(incoming_events)
# if there are too many, dump a bunch to avoid getting rate limited
if incoming_events.count > 20
incoming_events = incoming_events.first(20)
end
- Read upRead up
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"