Showing 20 of 22 total issues
Method update_values
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def update_values
@checklist = Checklist.find params[:id]
@checklist.grade_callback = params[:checklist][:grade_callback]
@checklist.title = params[:checklist][:title]
@checklist.save
- 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 activateTable
has 164 lines of code (exceeds 25 allowed). Consider refactoring. Open
function activateTable() {
var table = $(this);
var container = table.parents('.topicContainer');
var topic_id = table.attr('id').replace('topic_','');
var min_text = table.find('.min');
Method yaml_to_topics
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def yaml_to_topics(yaml)
ordering = 1
topics = YAML.load(yaml).map do |thash|
thash = parse_ids_from :topic, thash
if thash.has_key? "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
Method update_values
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_values
@checklist = Checklist.find params[:id]
@checklist.grade_callback = params[:checklist][:grade_callback]
@checklist.title = params[:checklist][:title]
@checklist.save
File checklists_controller.rb
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ChecklistsController < ApplicationController
def index
@checklists = Checklist.order :title
end
Function addTopics
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addTopics(checklist, topicData) {
$.each(topicData, function(topic_id,topic) {
var checks = {}
$.each(topic.checks, function(check_id,check) {
var element = $("#"+check_id);
Method topics_to_yaml
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def topics_to_yaml (topics)
StyledYAML.dump format_nice(topics.map{ |topic|
ret = topic.attributes.reject {|key,value|
%w(ordering checklist_id scoretype_id).include? key or value.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
Class Registration
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Registration < ActiveRecord::Base
attr_accessible :repository, :topic, :active, :review1, :review2
belongs_to :course
belongs_to :user
Class User
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
attr_accessible :email, :forename, :student_number, :surename, :password, :password_confirmation
has_secure_password
Method yaml_to_topics
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def yaml_to_topics(yaml)
ordering = 1
topics = YAML.load(yaml).map do |thash|
thash = parse_ids_from :topic, thash
if thash.has_key? "id"
Function autograding
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.autograding = function(topicData) {
var feedbackContainer = $(this).find('.feedbacks');
var scoreContainer = $(this).find('.scores');
var initScores = getScoreInitializer(topicData.scoretypes);
var final_grade_callback = topicData.grade_callback;
Function autogrow
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.autogrow = function(callback)
{
return this.filter('textarea').each(function()
{
var self = this;
Method prepare_based_on
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def prepare_based_on earlier_feedback, params
week_feedback = earlier_feedback
week_feedback.text += "\n-------------------\n" unless params[:week_feedback][:text].empty?
week_feedback.text += params[:week_feedback][:text] unless params[:week_feedback][:text].empty?
week_feedback.hidden_text = "" if week_feedback.hidden_text.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 toggle_review_participation
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def toggle_review_participation round
if round==1
self.participate_review1 = participate_review1 ? false : true
else
self.participate_review2 = participate_review2 ? false : true
- 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 calc
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function calc() {
var min = 0;
var max = 0;
for(var i=0; i<cells1.length; i++) {
var val1 = parseFloat(cells1[i].value,10);
Function activateRows
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function activateRows() {
table.find('tr:not(.activated)').each(function() {
var row = $(this);
row.addClass("activated");
row.find('.nametext').click(function() {
Method email
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def email(from, to, body, subject, cc, course="Ohjelmoinnin harjoitustyo")
Method scalar
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def scalar value, anchor, tag, plain, quoted, style
Method unique_assignment
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def unique_assignment
return true if Course.active.review_round == 1
# there exists some cases where an unique assignment is not possible,.. the following is for those
@trials ||= 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 format_nice
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def format_nice (coll)
if coll.is_a? Hash
coll.each do |key, value|
coll[key] = format_nice(value)
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"