Showing 39 of 41 total issues
File hitme.js
has 479 lines of code (exceeds 250 allowed). Consider refactoring. Open
// returns a unique ID to be used to identify an element within the
// webpage. Depends on the current state of the page, i.e. if we already
// are in ask-skipped-questions-again mode.
function getUniqId(q, a) {
var qid = (typeof q === 'object' ? q.id : q);
Function StatReporting
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function StatReporting() {
var start_time = null;
var end_time = null;
var question_id = null;
var selected_answers = null;
- 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 _showNextQuestion
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
_showNextQuestion: function() {
this.questPositionPointer++;
var q = window.currentQuestion = this.questions[this.questPositionPointer];
var code = '<div style="display:none" id="'+getUniqId(q.id)+'" class="box hideMeOnMore">'; // outer box
Function StatReporting
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
function StatReporting() {
var start_time = null;
var end_time = null;
var question_id = null;
var selected_answers = null;
Function XkcdLoader
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
var XkcdLoader = (function() {
var insertImmediately = false;
var preloaded = false;
var comic = null;
Function _handleQuestionSubmit
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
_handleQuestionSubmit: function() {
// gather details
//~ var question = getQuestionById($(this).data('qid'));
var quest = window.currentQuestion;
var answerChooser = $(this).parent().siblings(".answer-chooser, .answer-chooser-matrix").first();
Function _showNextQuestion
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
_showNextQuestion: function() {
this.questPositionPointer++;
var q = window.currentQuestion = this.questions[this.questPositionPointer];
var code = '<div style="display:none" id="'+getUniqId(q.id)+'" class="box hideMeOnMore">'; // outer box
- 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 overwrite_reviews
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def overwrite_reviews
@question = Question.includes(:reviews).find(params[:question_id])
time = Time.now.strftime("%Y-%m-%d %H:%M")
okay = true
@question.reviews.each do |r|
- 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 duplicate_question_and_answers
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.duplicate_question_and_answers
require 'set'
same = [], diff = []
sql = 'select min(q.id), q2.id from questions as q
Method duplicate_question_and_answers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.duplicate_question_and_answers
require 'set'
same = [], diff = []
sql = 'select min(q.id), q2.id from questions as q
- 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 XkcdLoader
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var XkcdLoader = (function() {
var insertImmediately = false;
var preloaded = false;
var comic = null;
- 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 select_random_roulette
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def select_random_roulette(question_ids, n, user)
logger.debug "### roulette selection"
probs = wrong_ratio_for(question_ids, user)
selected = []
- 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 redirect_to
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def redirect_to(options = {}, response_status = {})
return super(options, response_status) unless Rails.env.production?
case options
when String
- 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 select_random
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def select_random(question_ids, cnt)
big_sample = if signed_in?
# select questions depending on how often they were answered
# correctly.
select_random_roulette(question_ids, cnt, current_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 _handleQuestionSubmit
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_handleQuestionSubmit: function() {
// gather details
//~ var question = getQuestionById($(this).data('qid'));
var quest = window.currentQuestion;
var answerChooser = $(this).parent().siblings(".answer-chooser, .answer-chooser-matrix").first();
- 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 new
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def new
@question = Question.new
if params['parent']
s = params['parent'].split('_', 2)
- 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 suspicious_associations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def suspicious_associations
# fcategories and all associated answers (ignoring subquests)
root_cats = Category.includes(:questions => [:answers])
root_cats_answers = {}
root_cats.each do |rc|
- 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_question_stat_counts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_question_stat_counts(questions = nil)
filter = {}
if questions
questions = [questions] unless questions.is_a?(Array)
- 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 copy_to
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def copy_to
def abort(msg)
flash[:error] = msg
redirect_to @question
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 enroll
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def enroll
key = params[:enrollment_key]
if @user.enrollment_keys && @user.enrollment_keys.split.include?(key)
flash[:warning] = "In diese Veranstaltung bist Du schon eingeschrieben."
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"