Showing 122 of 224 total issues
Method execute
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def execute
submission =
TimelineEvent.transaction do
timeline_event_params =
(
- 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
Consider simplifying this complex logical expression. Open
if checklist.respond_to?(:all?) &&
checklist.all? { |item|
item["title"].is_a?(String) &&
item["kind"].in?(Assignment.valid_checklist_kind_types) &&
item["status"] == TimelineEvent::CHECKLIST_STATUS_NO_ANSWER &&
Consider simplifying this complex logical expression. Open
if (e.hasOwnProperty && e.hasOwnProperty("addEventListener")) {
for (var n = e.addEventListener; n._rollbarOldAdd && n.belongsToShim; )
n = n._rollbarOldAdd;
var t = function (e, o, t) {
n.call(this, e, r.wrap(o), t);
Consider simplifying this complex logical expression. Open
if review_checklist.respond_to?(:all?) &&
review_checklist.all? { |item|
valid_title?(item["title"]) && item["result"].respond_to?(:all?) &&
item["result"].all? do |result|
valid_title?(result["title"]) &&
Consider simplifying this complex logical expression. Open
if @checklist.respond_to?(:all?) &&
@checklist.all? { |item|
item["title"].is_a?(String) &&
item["kind"].in?(Assignment.valid_checklist_kind_types) &&
item["status"].in?(
Function loadFull
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
(i.prototype.loadFull = function (r, e, o, n, t) {
Method validate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validate(_object, _context, value)
assignment =
Target.find_by(id: value[:target_id]).assignments.not_archived.last
checklist = value[:checklist]
assignment
- 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 first_five_topics_from_cache
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def first_five_topics_from_cache(update_type, community_ids)
topics = []
@topic_details_cache[update_type].each do |topic|
next unless topic[:community_id].in?(community_ids)
- 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 assign
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def assign(faculty)
if faculty.school != @course.school
raise 'Faculty must in same school as course'
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 oauth_callback
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def oauth_callback
@email = email_from_auth_hash
if oauth_origin.present? && oauth_origin[:session_id]
if oauth_origin[:link_data].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 prepare_courses
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def prepare_courses
cohorts = @organisation.cohorts.includes(:course).uniq
courses =
cohorts.each_with_object({}) do |cohort, courses|
- 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 issue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def issue(certificate: nil, issuer: nil)
certificate_to_issue = certificate || active_certificate
return if certificate_to_issue.blank? || issued_certificate_exists?
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def execute(assignment_params)
Assignment.transaction do
@assignment.role = assignment_params[:role]
@assignment.completion_instructions =
assignment_params[:completion_instructions]
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def create
@form =
if params[:password_sign_in]
Users::Sessions::SignInWithPasswordForm.new(Reform::OpenForm.new)
elsif params[:email_link]
- 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 links_to_adjacent_targets
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def links_to_adjacent_targets
links = {}
sorted_target_ids =
@target
- 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 target_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def target_type(target)
assignment = target.assignments.not_archived.first
if assignment
if assignment.evaluation_criteria.present?
"Graded"
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def execute
return unless @user.discord_user_id.present? && configuration.configured?
role_ids = [
@user.cohorts.pluck(:discord_role_ids),
- 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 too many return
statements within this method. Open
return true if course.faculty.exists?(user: current_user)
Avoid too many return
statements within this method. Open
return true if course.faculty.exists?(user: current_user)
Avoid too many return
statements within this method. Open
return false