Showing 52 of 52 total issues
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return error if error
Method watched_broken_scrapers_ordered_by_urgency
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def watched_broken_scrapers_ordered_by_urgency
watched_broken_scrapers.sort do |a, b|
time_a = a.latest_successful_run_time
time_b = b.latest_successful_run_time
if time_b.nil? && time_a.nil?
- 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 spanning_rowid_table
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.spanning_rowid_table(table, db1, db2)
min1, max1 = min_and_max_rowid(table, db1)
min2, max2 = min_and_max_rowid(table, db2)
if min1.nil? && max1.nil? && min2.nil? && max2.nil?
min = 1
- 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 find_all_runs_on_the_queue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.find_all_runs_on_the_queue
queue = []
# Runs on the retry queue
Sidekiq::RetrySet.new.each do |job|
queue << job.args.first if job.klass == RUN_WORKER_CLASS_NAME
- 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 alert_scrapers_summary_sentence
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def alert_scrapers_summary_sentence(success_count, broken_count)
result = []
result << pluralize(success_count, "scraper")
result << " you are watching "
result << (success_count == 1 ? "has" : "have")
- 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 owner_image
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def owner_image(owner, size:, show_tooltip: true, tooltip_text: nil)
options = { size: "#{size}x#{size}", class: "" }
options[:class] += " img-circle" if owner.user?
if show_tooltip
options[:class] += " has-tooltip"
- 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 show
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show
# Whether this user has just become a supporter
@new_supporter = T.let(session[:new_supporter], T.nilable(T::Boolean))
# Only do this once
session[:new_supporter] = false if @new_supporter
- 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 synchronise_repo
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def synchronise_repo(repo_path, git_url_https)
repo, error = synchronise_repo_ignore_submodules(repo_path, git_url_https)
return error if error
repo.submodules.each do |submodule|
- 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 directory_size
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.directory_size(directory)
r = 0
if File.exist?(directory)
# Ick
files = Dir.entries(directory)
- 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 database_changes_in_words
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def database_changes_in_words(run)
sections = []
sections << "#{pluralize(run.records_added, 'record')} added" if run.records_added&.positive?
sections << "#{pluralize(run.records_removed, 'record')} removed" if run.records_removed&.positive?
sections << "#{pluralize(run.records_changed, 'record')} updated" if run.records_changed&.positive?
- 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 copy_config_to_directory
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.copy_config_to_directory(source, dest, copy_config)
Dir.entries(source).each do |entry|
next if [".", ".."].include?(entry)
unless copy_config ^ ALL_CONFIG_FILENAMES.include?(entry)
- 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"