Showing 141 of 177 total issues
Method schedule_scheduler_agent
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def schedule_scheduler_agent(agent)
job = scheduler_agent_job(agent)
if agent.unavailable?
if job
Function showCorrectRegionsOnStartup
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
showCorrectRegionsOnStartup() {
if ($(".schedule-region")) {
if ($(".schedule-region").data("can-be-scheduled") === true) {
this.showSchedule();
} else {
Method json_serialize
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def json_serialize(*fields)
fields.each do |field|
class_eval <<-CODE
serialize :#{field}, JsonWithIndifferentAccess
Method receive
has 28 lines of code (exceeds 25 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
Method get_issues
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_issues(since)
startAt = 0
issues = []
# JQL doesn't have an ability to specify timezones
Method receive
has a Cognitive Complexity of 10 (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"
Further reading
Method working?
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def working?
return false if recent_error_logs?
if interpolated['expected_update_period_in_days'].present?
return false unless event_created_within?(interpolated['expected_update_period_in_days'])
- 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 diff_with!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def diff_with!(agent)
return unless agent.present?
self.agent = agent
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def receive(incoming_events)
memory['pending_calls'] ||= {}
interpolate_with_each(incoming_events) do |event|
message = (event.payload['message'].presence || event.payload['text'].presence || event.payload['sms'].presence).to_s
if message.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 check
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check
last_message = memory['last_message']
mqtt_client.connect
poll_thread = Thread.new do
- 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_email_options
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def validate_email_options
errors.add(
:base,
"subject and expected_receive_period_in_days are required"
) unless options['subject'].present? && options['expected_receive_period_in_days'].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 check
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def check
hydra = Typhoeus::Hydra.new
request = Typhoeus::Request.new(check_url, followlocation: true)
request.on_success do |response|
page = Nokogiri::XML response.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 sortable_column
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def sortable_column(attribute, default_direction = nil, options = nil)
if options.nil? && (options = Hash.try_convert(default_direction))
default_direction = nil
end
default_direction ||= 'desc'
- 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 included
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.included(mod)
mod.module_exec do
include HasAuthors
include HasEnclosure
include HasLinks
- 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 execute_js
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute_js(js_function, incoming_events = [])
js_function = js_function == "check" ? "check" : "receive"
context = MiniRacer::Context.new
context.eval(setup_javascript)
Method open_ftp
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def open_ftp(uri)
ftp = Net::FTP.new
log "Connecting to #{uri.host}#{':%d' % uri.port if uri.port != uri.default_port}"
ftp.connect(uri.host, uri.port)
Method handle_request
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_request
user = User.find_by_id(params[:user_id])
if user
agent = user.agents.find_by_id(params[:agent_id])
if agent
Consider simplifying this complex logical expression. Open
unless options['account_sid'].present? && options['auth_token'].present? && options['sender_cell'].present? && options['receiver_cell'].present? && options['expected_receive_period_in_days'].present? && options['receive_call'].present? && options['receive_text'].present?
errors.add(:base,
'account_sid, auth_token, sender_cell, receiver_cell, receive_text, receive_call and expected_receive_period_in_days are all required')
end
Method validate_options
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def validate_options
if (spec = options['schedule']).present?
begin
cron = Fugit::Cron.new(spec) or raise ArgumentError
unless second_precision_enabled || (cron.seconds - [0, 15, 30, 45, 60]).empty?
- 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 handle_data
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def handle_data(body, url, existing_payload)
# Beware, url may be a URI object, string or nil
doc = parse(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"