mmibordeaux/teach

View on GitHub

Showing 30 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

                Similar blocks of code found in 7 locations. Consider refactoring.
                Open

                  def create
                    @user = User.new(user_params)
                
                    respond_to do |format|
                      if @user.save
                Severity: Major
                Found in app/controllers/users_controller.rb and 6 other locations - About 1 hr to fix
                app/controllers/competencies_controller.rb on lines 23..32
                app/controllers/fields_controller.rb on lines 23..32
                app/controllers/jobs_controller.rb on lines 21..30
                app/controllers/keywords_controller.rb on lines 22..31
                app/controllers/objectives_controller.rb on lines 21..30
                app/controllers/promotions_controller.rb on lines 26..35

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 7 locations. Consider refactoring.
                Open

                  def create
                    @promotion = Promotion.new(promotion_params)
                
                    respond_to do |format|
                      if @promotion.save
                Severity: Major
                Found in app/controllers/promotions_controller.rb and 6 other locations - About 1 hr to fix
                app/controllers/competencies_controller.rb on lines 23..32
                app/controllers/fields_controller.rb on lines 23..32
                app/controllers/jobs_controller.rb on lines 21..30
                app/controllers/keywords_controller.rb on lines 22..31
                app/controllers/objectives_controller.rb on lines 21..30
                app/controllers/users_controller.rb on lines 39..48

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 7 locations. Consider refactoring.
                Open

                  def create
                    @objective = Objective.new(objective_params)
                
                    respond_to do |format|
                      if @objective.save
                Severity: Major
                Found in app/controllers/objectives_controller.rb and 6 other locations - About 1 hr to fix
                app/controllers/competencies_controller.rb on lines 23..32
                app/controllers/fields_controller.rb on lines 23..32
                app/controllers/jobs_controller.rb on lines 21..30
                app/controllers/keywords_controller.rb on lines 22..31
                app/controllers/promotions_controller.rb on lines 26..35
                app/controllers/users_controller.rb on lines 39..48

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 7 locations. Consider refactoring.
                Open

                  def create
                    @field = Field.new(field_params)
                
                    respond_to do |format|
                      if @field.save
                Severity: Major
                Found in app/controllers/fields_controller.rb and 6 other locations - About 1 hr to fix
                app/controllers/competencies_controller.rb on lines 23..32
                app/controllers/jobs_controller.rb on lines 21..30
                app/controllers/keywords_controller.rb on lines 22..31
                app/controllers/objectives_controller.rb on lines 21..30
                app/controllers/promotions_controller.rb on lines 26..35
                app/controllers/users_controller.rb on lines 39..48

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 7 locations. Consider refactoring.
                Open

                  def create
                    @job = Job.new(job_params)
                
                    respond_to do |format|
                      if @job.save
                Severity: Major
                Found in app/controllers/jobs_controller.rb and 6 other locations - About 1 hr to fix
                app/controllers/competencies_controller.rb on lines 23..32
                app/controllers/fields_controller.rb on lines 23..32
                app/controllers/keywords_controller.rb on lines 22..31
                app/controllers/objectives_controller.rb on lines 21..30
                app/controllers/promotions_controller.rb on lines 26..35
                app/controllers/users_controller.rb on lines 39..48

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 7 locations. Consider refactoring.
                Open

                  def create
                    @keyword = Keyword.new(keyword_params)
                
                    respond_to do |format|
                      if @keyword.save
                Severity: Major
                Found in app/controllers/keywords_controller.rb and 6 other locations - About 1 hr to fix
                app/controllers/competencies_controller.rb on lines 23..32
                app/controllers/fields_controller.rb on lines 23..32
                app/controllers/jobs_controller.rb on lines 21..30
                app/controllers/objectives_controller.rb on lines 21..30
                app/controllers/promotions_controller.rb on lines 26..35
                app/controllers/users_controller.rb on lines 39..48

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 7 locations. Consider refactoring.
                Open

                  def create
                    @competency = Competency.new(competency_params)
                
                    respond_to do |format|
                      if @competency.save
                Severity: Major
                Found in app/controllers/competencies_controller.rb and 6 other locations - About 1 hr to fix
                app/controllers/fields_controller.rb on lines 23..32
                app/controllers/jobs_controller.rb on lines 21..30
                app/controllers/keywords_controller.rb on lines 22..31
                app/controllers/objectives_controller.rb on lines 21..30
                app/controllers/promotions_controller.rb on lines 26..35
                app/controllers/users_controller.rb on lines 39..48

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 7 locations. Consider refactoring.
                Open

                  def update
                    respond_to do |format|
                      if @promotion.update(promotion_params)
                        format.html { redirect_to @promotion, notice: 'Promotion was successfully updated.' }
                        format.json { render :show, status: :ok, location: @promotion }
                Severity: Major
                Found in app/controllers/promotions_controller.rb and 6 other locations - About 55 mins to fix
                app/controllers/competencies_controller.rb on lines 37..44
                app/controllers/fields_controller.rb on lines 37..44
                app/controllers/jobs_controller.rb on lines 35..42
                app/controllers/keywords_controller.rb on lines 36..43
                app/controllers/objectives_controller.rb on lines 35..42
                app/controllers/users_controller.rb on lines 53..60

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 44.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 7 locations. Consider refactoring.
                Open

                  def update
                    respond_to do |format|
                      if @job.update(job_params)
                        format.html { redirect_to @job, notice: 'Job was successfully updated.' }
                        format.json { render :show, status: :ok, location: @job }
                Severity: Major
                Found in app/controllers/jobs_controller.rb and 6 other locations - About 55 mins to fix
                app/controllers/competencies_controller.rb on lines 37..44
                app/controllers/fields_controller.rb on lines 37..44
                app/controllers/keywords_controller.rb on lines 36..43
                app/controllers/objectives_controller.rb on lines 35..42
                app/controllers/promotions_controller.rb on lines 40..47
                app/controllers/users_controller.rb on lines 53..60

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 44.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 7 locations. Consider refactoring.
                Open

                  def update
                    respond_to do |format|
                      if @user.update(user_params)
                        format.html { redirect_to @user, notice: 'User was successfully updated.' }
                        format.json { render :show, status: :ok, location: @user }
                Severity: Major
                Found in app/controllers/users_controller.rb and 6 other locations - About 55 mins to fix
                app/controllers/competencies_controller.rb on lines 37..44
                app/controllers/fields_controller.rb on lines 37..44
                app/controllers/jobs_controller.rb on lines 35..42
                app/controllers/keywords_controller.rb on lines 36..43
                app/controllers/objectives_controller.rb on lines 35..42
                app/controllers/promotions_controller.rb on lines 40..47

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 44.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 7 locations. Consider refactoring.
                Open

                  def update
                    respond_to do |format|
                      if @field.update(field_params)
                        format.html { redirect_to @field, notice: 'Field was successfully updated.' }
                        format.json { render :show, status: :ok, location: @field }
                Severity: Major
                Found in app/controllers/fields_controller.rb and 6 other locations - About 55 mins to fix
                app/controllers/competencies_controller.rb on lines 37..44
                app/controllers/jobs_controller.rb on lines 35..42
                app/controllers/keywords_controller.rb on lines 36..43
                app/controllers/objectives_controller.rb on lines 35..42
                app/controllers/promotions_controller.rb on lines 40..47
                app/controllers/users_controller.rb on lines 53..60

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 44.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language