Showing 430 of 4,506 total issues
Method import
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.import(row_hash, _session, assignment_id)
reviewee_user_name = row_hash[:reviewee].to_s
reviewee_user = User.find_by(name: reviewee_user_name)
raise ArgumentError, 'Cannot find reviewee user.' unless reviewee_user
- 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
Function init
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
init:function(automodeperiod){
var persistedtab=ddajaxtabs.getCookie(this.tabinterfaceid) //get position of persisted tab (applicable if persistence is enabled)
var selectedtab=-1 //Currently selected tab index (-1 meaning none)
var selectedtabfromurl=this.urlparamselect(this.tabinterfaceid) //returns null or index from: tabcontent.htm?tabinterfaceid=index
this.automodeperiod=automodeperiod || 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 compute_penalty_on_reviews
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def compute_penalty_on_reviews(review_mappings, review_due_date, num_of_reviews_required)
review_map_created_at_list = []
penalty = 0
# Calculate the number of reviews that the user has completed so far.
review_mappings.each do |map|
- 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 get_next_due_date
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def self.get_next_due_date(assignment_id, topic_id = nil)
if Assignment.find(assignment_id).staggered_deadline?
next_due_date = TopicDueDate.find_by(['parent_id = ? and due_at >= ?', topic_id, Time.zone.now])
# if certion TopicDueDate is not exist, we should query next corresponding AssignmentDueDate.
# eg. Time.now is 08/28/2016
- 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 penalties
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def penalties(assignment_id)
@all_penalties = {}
@assignment = Assignment.find(assignment_id)
calculate_for_participants = true unless @assignment.is_penalty_calculated
Participant.where(parent_id: assignment_id).each do |participant|
- 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_reviewers_for_team
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def assign_reviewers_for_team(assignment_id, review_strategy, participants_hash)
if ReviewResponseMap.where(reviewed_object_id: assignment_id, calibrate_to: 0)
.where('created_at > :time',
time: @@time_create_last_review_mapping_record).size < review_strategy.reviews_needed
- 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 save_topic_deadlines
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def save_topic_deadlines
assignment = Assignment.find(params[:assignment_id])
@assignment_submission_due_dates = assignment.due_dates.select { |due_date| due_date.deadline_type_id == 1 }
@assignment_review_due_dates = assignment.due_dates.select { |due_date| due_date.deadline_type_id == 2 }
due_dates = params[:due_date]
- 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 14 (exceeds 5 allowed). Consider refactoring. Open
def show
@id = params[:id]
@model = params[:model]
@options = params[:options]
@delimiter = get_delimiter(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
Function update
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
update: function(value, duration) {
if (value === true) {//Force update with current value
this._setPercentage(this.getPercent());
return this;
}
Method display_directory_tree
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def display_directory_tree(participant, files, display_to_reviewer_flag)
index = 0
participant = @participant if @participant
assignment = participant.assignment # participant is @map.contributor
topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id) # participant is @map.reviewer
Method create
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@assignment_form = AssignmentForm.new(assignment_form_params)
if params[:button]
# E2138 issue #3
find_existing_assignment = Assignment.find_by(name: @assignment_form.assignment.name, course_id: @assignment_form.assignment.course_id)
Consider simplifying this complex logical expression. Open
if (
((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
(entry.creation_date &&
entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
(entry.institution && entry.institution.indexOf(_this.props.filterText) !== -1) ||
Method all_students_all_reviews
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def all_students_all_reviews
course = Course.find(params[:course_id])
@assignments = course.assignments.reject(&:is_calibrated).reject { |a| a.participants.empty? }
@course_participants = course.get_participants
insure_existence_of(@course_participants, course)
Method calculate_score
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def calculate_score(map, response)
questionnaire = Questionnaire.find(map.reviewed_object_id)
scores = []
valid = true
questions = Question.where(questionnaire_id: questionnaire.id)
Method add_reviews
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_reviews(participant, team, vary)
if @questionnaire_type == 'ReviewQuestionnaire'
reviews = if vary
ReviewResponseMap.get_responses_for_team_round(team, @round)
else
- 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
Function SetHour
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function SetHour(intHour)
{
var MaxHour;
var MinHour;
if (TimeMode==24)
- 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 import
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.import(row_hash, id, options, teamtype)
raise ArgumentError, 'Not enough fields on this line.' if row_hash.empty? || (row_hash[:teammembers].empty? && (options[:has_teamname] == 'true_first' || options[:has_teamname] == 'true_last')) || (row_hash[:teammembers].empty? && (options[:has_teamname] == 'true_first' || options[:has_teamname] == 'true_last'))
if options[:has_teamname] == 'true_first' || options[:has_teamname] == 'true_last'
name = row_hash[:teamname].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 review_response_report
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.review_response_report(id, assignment, type, review_user)
if review_user.nil?
# This is not a search, so find all reviewers for this assignment
response_maps_with_distinct_participant_id =
ResponseMap.select('DISTINCT reviewer_id').where('reviewed_object_id = ? and type = ? and calibrate_to = ?', id, type, 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 add_answer
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def add_answer(answer)
# We want to add each response score from this review (answer) to its corresponding
# question row.
@list_of_rows.each do |row|
next unless row.question_id == answer.question_id
- 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
Function alternate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function alternate(id){
if(document.getElementsByTagName){
var table = document.getElementById(id);
var rows = table.getElementsByTagName("tr");
var displayedRows = [];
- 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"