Showing 12 of 30 total issues
Class Year
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
class Year < ActiveRecord::Base
has_many :projects
has_many :objectives, through: :projects
Method parse
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse
objects = []
(1..4).each do |index|
Semester.find_or_create_by(number: index)
Method parse
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def self.parse
objects = []
(1..4).each do |index|
Semester.find_or_create_by(number: index)
- 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 Semester
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Semester < ActiveRecord::Base
has_and_belongs_to_many :projects
has_many :teaching_modules
has_many :resources
Class Project
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Project < ActiveRecord::Base
has_many :involvements
has_many :events
has_and_belongs_to_many :fields
Class TeachingModule
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class TeachingModule < ActiveRecord::Base
belongs_to :teaching_unit
belongs_to :teaching_subject
belongs_to :teaching_category
Method create_with
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_with(calendar_event, promotion)
date = calendar_event.dtstart
date_end = calendar_event.dtend
if date.class == Icalendar::Values::Date
# All day event, used for holidays
Method create_with
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.create_with(calendar_event, promotion)
date = calendar_event.dtstart
date_end = calendar_event.dtend
if date.class == Icalendar::Values::Date
# All day event, used for holidays
- 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 click
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function click(d) {
currentDepth = d.depth;
path
.style("visibility", function(d) { return d.depth <= currentDepth + visibleDepth ? 'visible' : 'hidden'; })
Method prepare
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def prepare
@projects = @year.projects
@promotions = @year.promotions
if @involvement.project && @involvement.project.semesters.one?
semester = @involvement.project.semesters.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 involvements
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def involvements
if @involvements.nil?
first_year_promotion_id = first_year_promotion.nil? ? nil : first_year_promotion.id
first_year_module_ids = TeachingModule.where(semester_id: [1, 2]).pluck(:id)
second_year_promotion_id = second_year_promotion.nil? ? nil : second_year_promotion.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 groups
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def groups
unless @groups
@groups = 1.0
@groups = Involvement::GROUPS_TD if td?
@groups = Involvement::GROUPS_TP if tp?
- 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"