Showing 2,813 of 2,813 total issues
Similar blocks of code found in 2 locations. Consider refactoring. Open
it "is able to delete question from a global survey" do
survey_name = 'Global Survey Questionnaire 1'
deploy_global_survey(@next_day, @next_to_next_day, survey_name)
survey_questionnaire = Questionnaire.where(name: survey_name).first
visit '/questionnaires/' + survey_questionnaire.id.to_s + '/edit'
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 69.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
it "test for bequeath" do
assignment = build(Assignment)
course = Course.new
course.name = "newCourse"
course.save
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 68.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
it "test for inherit" do
assignment = build(Assignment)
course = Course.new
course.name = "newCourse"
course.save
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 68.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 save_choices
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def save_choices(questionnaire_id)
return unless params[:new_question] or params[:new_choices]
questions = Question.where(questionnaire_id: questionnaire_id)
question_num = 1
Method create
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
if params[:questionnaire][:name].blank?
flash[:error] = 'A rubric or survey must have a title.'
redirect_to controller: 'questionnaires', action: 'new', model: params[:questionnaire][:type], private: params[:questionnaire][:private]
else
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) ||
(entry.updated_date && entry.updated_date.indexOf(_this.props.filterText) !== -1)) &&
(entry.private == false)) {
Assignment Branch Condition size for get_peer_review_data is too high. [15.17/15] Open
def self.get_peer_review_data(participant_id, timeline_list)
ReviewResponseMap.where(reviewer_id: participant_id).find_each do |rm|
response = Response.where(map_id: rm.id).last
next if response.nil?
timeline = {
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for review_response_report is too high. [15.84/15] 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
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for get_user_list is too high. [15.65/15] Open
def self.get_user_list(user)
courses = Ta.get_mapped_courses(user.id)
participants = []
user_list = []
courses.each do |course_id|
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for path is too high. [15.03/15] Open
def path
raise "Path can not be created. The course must be associated with an instructor." if self.instructor_id.nil?
Rails.root + "/pg_data/" + FileHelper.clean_path(User.find(self.instructor_id).name) + "/" + FileHelper.clean_path(self.directory_path) + "/"
end
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for confirmTopic is too high. [15.39/15] Open
def self.confirmTopic(user_id, team_id, topic_id, assignment_id)
# check whether user has signed up already
user_signup = SignUpSheet.otherConfirmedTopicforUser(assignment_id, team_id)
sign_up = SignedUpTeam.new
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for export is too high. [15.81/15] Open
def self.export(csv, parent_id, options, teamtype)
if teamtype.is_a?(CourseTeam)
teams = CourseTeam.where(parent_id: parent_id)
elsif teamtype.is_a?(AssignmentTeam)
teams = AssignmentTeam.where(parent_id: parent_id)
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for number_of_comments_greater_than_10_words is too high. [15.43/15] Open
def number_of_comments_greater_than_10_words
@list_of_reviews.each do |review|
answers = Answer.where(response_id: review.response_id)
answers.each do |answer|
@list_of_rows.each do |row|
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for export_fields is too high. [15.84/15] Open
def self.export_fields(options)
fields = []
fields.push("name", "full name", "email") if options["personal_details"] == "true"
fields.push("role") if options["role"] == "true"
fields.push("parent") if options["parent"] == "true"
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for cycle_similarity_score is too high. [15.84/15] Open
def cycle_similarity_score(cycle)
similarity_score = 0.0
count = 0.0
for pivot in 0...cycle.size - 1 do
pivot_score = cycle[pivot][1]
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for export_fields is too high. [15.84/15] Open
def self.export_fields(options)
fields = []
fields.push("name", "full name", "email") if options["personal_details"] == "true"
fields.push("role") if options["role"] == "true"
fields.push("parent") if options["parent"] == "true"
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for cycle_deviation_score is too high. [15.68/15] Open
def cycle_deviation_score(cycle)
deviation_score = 0.0
count = 0.0
for member in 0...cycle.size do
participant = AssignmentParticipant.find(cycle[member][0].id)
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for complete_script is too high. [15.81/15] Open
def complete_script(count)
html = '<script>function checkbox' + count.to_s + 'Changed() {'
html += ' var checkbox = jQuery("#responses_' + count.to_s + '_checkbox");'
html += ' var response_score = jQuery("#responses_' + count.to_s + '_score");'
html += 'if (checkbox.is(":checked")) {'
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for distribution is too high. [15.3/15] Open
def distribution(array, num_intervals, x_min = array.min)
distribution = []
interval_size = ((array.max - x_min).to_f / num_intervals).ceil
intervals = (1..num_intervals).to_a.collect {|val| val * interval_size }
intervals.each do |interval_max|
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric