Showing 2,813 of 2,813 total issues
Method compute_scores
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.compute_scores(assessments, questions)
scores = {}
if assessments.present?
scores[:max] = -999_999_999
scores[:min] = 999_999_999
Method get_team_name_color_in_review_report
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_team_name_color_in_review_report(response_map)
assignment_created = @assignment.created_at
assignment_due_dates = DueDate.where(parent_id: response_map.reviewed_object_id)
if Response.exists?(map_id: response_map.id)
if !response_map.try(:reviewer).try(:review_grade).nil?
Method assign_reviewer_dynamically
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def assign_reviewer_dynamically
assignment = Assignment.find(params[:assignment_id])
reviewer = AssignmentParticipant.where(user_id: params[:reviewer_id], parent_id: assignment.id).first
if params[:i_dont_care].nil? && params[:topic_id].nil? && assignment.topics? && assignment.can_choose_topic_to_review?
Method summarize_reviews_by_criterion
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def summarize_reviews_by_criterion(assignment, summary_ws_url)
# @summary[reviewee][round][question]
# @avg_score_round[reviewee][round]
# @avg_scores_by_criterion[reviewee][round][criterion]
nround = assignment.rounds_of_reviews
Method update
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def update
@penalty_policy = LatePolicy.find(params[:id])
invalid_penalty_per_unit = params[:late_policy][:max_penalty].to_i < params[:late_policy][:penalty_per_unit].to_i
flash[:error] = "The maximum penalty cannot be less than penalty per unit." if invalid_penalty_per_unit
same_policy_name = false
Method db_query
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def db_query(assignment_id, round_num, has_topic, another_assignment_id = 0)
raw_data_array = []
assignment_ids = []
assignment_ids << assignment_id
assignment_ids << another_assignment_id unless another_assignment_id.zero?
Method pending_surveys
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def pending_surveys
unless session[:user] # Check for a valid user
redirect_to '/'
return
end
Method copy_questionnaire_details
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def copy_questionnaire_details(questions, orig_questionnaire)
@questionnaire.instructor_id = assign_instructor_id
@questionnaire.name = 'Copy of ' + orig_questionnaire.name
begin
@questionnaire.created_at = Time.now
Function collapseObj
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function collapseObj(obj, atag){
obj.style.display = 'none';
atag.innerHTML = '<img src="/assets/expand.png">';
files = document.getElementById(obj.id+'_files');
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function() {
return (
<div className="filterable_table">
<SearchBar
filterText={this.state.filterText}
Method delete
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def delete(force = nil)
begin
maps = ReviewResponseMap.where(reviewed_object_id: self.id)
maps.each {|map| map.delete(force) }
rescue StandardError
Method compute_penalty_on_reviews
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
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|
Method run_intelligent_assignment
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def run_intelligent_assignment
priority_info = []
assignment = Assignment.find_by(id: params[:id])
topics = assignment.sign_up_topics
teams = assignment.teams
Method initialize_chart_elements
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize_chart_elements(reviewer)
round = 0
labels = []
reviewer_data = []
all_reviewers_data = []
Method set_priority
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def set_priority
participant = AssignmentParticipant.find_by(id: params[:participant_id])
assignment_id = SignUpTopic.find(params[:topic].first).assignment.id
team_id = participant.team.try(:id)
unless team_id
Consider simplifying this complex logical expression. Open
Open
raise ArgumentError, "Not enough fields on this line." if row_hash.empty? || (row_hash[:teammembers].length < 2 && (options[:has_teamname] == "true_first" || options[:has_teamname] == "true_last")) || (row_hash[:teammembers].empty? && (options[:has_teamname] == "true_first" || options[:has_teamname] == "true_last"))
Consider simplifying this complex logical expression. Open
Open
if (selectedtabfromurl==i || this.enabletabpersistence && selectedtab==-1 && parseInt(persistedtab)==i || !this.enabletabpersistence && selectedtab==-1 && this.getselectedClassTarget(this.tabs[i]).className=="selected"){
selectedtab=i //Selected tab index, if found
}
Consider simplifying this complex logical expression. Open
Open
if (((entry.name && entry.name.indexOf(_this.props.filterText) !== -1) ||
(entry.creation_date && entry.creation_date.indexOf(_this.props.filterText) !== -1) ||
(entry.updated_date && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
(entry.private == false)) {
_rows.push(<ContentTableRow
Consider simplifying this complex logical expression. Open
Open
if map.is_a? ReviewResponseMap
reviewee_team = AssignmentTeam.find(map.reviewee_id)
return current_user_id?(user_id) || reviewee_team.user?(current_user) || current_user.role.name == 'Administrator' ||
(current_user.role.name == 'Instructor' and assignment.instructor_id == current_user.id) ||
(current_user.role.name == 'Teaching Assistant' and TaMapping.exists?(ta_id: current_user.id, course_id: assignment.course.id))
Block has too many lines. [33/25] Open
Open
describe '#update_due_dates' do
context 'when attributes are nil' do
it 'returns false' do
expect(assignment_form.update_due_dates(nil, user)).to be false
end
- Read upRead up
- Exclude checks
This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.