Showing 21 of 456 total issues
Method diff_db
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def diff_db(qset_json)
diffs = []
qset_json.each do |qset_name, question_json|
question_set = QuestionSet.find_by_name(qset_name)
if not question_set
- 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 check_tags_exist
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.check_tags_exist(file_qsets)
non_exist_tags = []
file_qsets.keys.each do |qset_name|
question_hash = file_qsets[qset_name]
question_hash.each do |question_text, wrong_answer_list|
- 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 find_edits
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def find_edits(wrong_answer_list)
db_display_list = {} # wrong answers shown (edited or deleted)
upload_display_list = {} #wrong answers shown (edited or added)
db_wrong_answer_list = self.wrong_answers
- 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_admin
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def toggle_admin(id, status)
if id == self.id
return "Cannot unadmin yourself"
else
other_user = User.find_by_id(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 diff_db
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def diff_db(qset_json)
diffs = []
qset_json.each do |qset_name, question_json|
question_set = QuestionSet.find_by_name(qset_name)
if not question_set
Method import
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.import(csv_path)
rows = CSV.read(csv_path)
if not self.verify_first_line(rows[0])
return false
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 cross_check_diffs
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.cross_check_diffs(file_qsets)
#Returns a hash of answers, edits, deletions. Answers and edits contains
#a message, which may be an empty string if we do not want to create a new message
edits = {}
additions = {}
- 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 find_edits
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_edits(wrong_answer_list)
db_display_list = {} # wrong answers shown (edited or deleted)
upload_display_list = {} #wrong answers shown (edited or added)
db_wrong_answer_list = self.wrong_answers
Method cross_check_diffs
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.cross_check_diffs(file_t2c)
#Returns a hash of additions and deletions.
#Note the instances are in json form
additions = []
deletions = []
- 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 seed_db
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def seed_db(qset_json)
# seed db with qsets in json, expect it to be in same format as question.json
# also assumes an empty database except for tags (doesn't check for new questions, qsets, or was)
# so all tags in the seed json should be within tag1-tag10
qset_json.each do |qset_name, question_json|
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def self.import(csv_path)
rows = CSV.read(csv_path)
if not self.verify_first_line(rows[0])
return false
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 aggregate_changes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def aggregate_changes
changes = {}
confirmed_additions = params[:confirmed_additions]
additions = []
if confirmed_additions
Method sort_messages
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sort_messages(sort_type, messages, is_hint)
message_upvotes = {}
message_downvotes = {}
messages.each do |message|
upvotes = 0
Method sort_messages
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def sort_messages(sort_type, messages, is_hint)
message_upvotes = {}
message_downvotes = {}
messages.each do |message|
upvotes = 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 import
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.import(csv_path)
rows = CSV.read(csv_path)
if not self.verify_first_line(rows[0])
return false
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 cross_check_diffs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.cross_check_diffs(file_concepts)
#Returns a hash of answers, edits, deletions. Answers and edits contains
#a message, which may be an empty string if we do not want to create a new message
#Note the instances are in json form
edits = []
- 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 cross_check_diffs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.cross_check_diffs(file_tags)
#Returns a hash of answers, edits, deletions. Answers and edits contains
#a message, which may be an empty string if we do not want to create a new message
#Note the instances are in json form
edits = []
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def self.import(current_user, file)
first_line = file.readline
if not self.verify_first_line(first_line)
return "Users file not correctly formatted. First 2 columns must be Name, Email"
- 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 find_additions_and_edits
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.find_additions_and_edits(question_hash, upload_display_list, db_display_list)
question_hash.each do |question_text, wa_hash|
question = Question.find_by_text(question_text)
if not question
# addition of question
- 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 make_edit
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.make_edit(exist_concept, upload_concept)
#Check if there's an edit. If so, change it but don't save
#Otherwise return False
new_description, new_message = upload_concept
edit = [exist_concept, ""]
- 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"