mmibordeaux/teach

View on GitHub

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

Severity: Minor
Found in app/models/year.rb - About 6 hrs to fix

    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)
    Severity: Major
    Found in app/models/ppn.rb - About 4 hrs to fix

      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)
      Severity: Minor
      Found in app/models/ppn.rb - About 3 hrs to fix

      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
      Severity: Minor
      Found in app/models/semester.rb - About 3 hrs to fix

        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
        Severity: Minor
        Found in app/models/project.rb - About 3 hrs to fix

          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
          Severity: Minor
          Found in app/models/teaching_module.rb - About 2 hrs to fix

            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
            Severity: Major
            Found in app/models/event.rb - About 2 hrs to fix

              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
              Severity: Minor
              Found in app/models/event.rb - About 1 hr to fix

              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'; })
              Severity: Minor
              Found in app/assets/javascripts/sunburst.js - About 1 hr to fix

                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
                Severity: Minor
                Found in app/controllers/years/involvements_controller.rb - About 35 mins to fix

                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
                Severity: Minor
                Found in app/models/year.rb - About 35 mins to fix

                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?
                Severity: Minor
                Found in app/models/event.rb - About 25 mins to fix

                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

                Severity
                Category
                Status
                Source
                Language