AgileVentures/MetPlus_PETS

View on GitHub
app/models/event.rb

Summary

Maintainability
F
3 days
Test Coverage

File event.rb has 402 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Event
  include ActiveModel::Model
  require 'agency_person' # provide visibility to AR model methods

  def self.delay_seconds=(delay_seconds)
Severity: Minor
Found in app/models/event.rb - About 5 hrs to fix

    Method evt_jd_apply has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.evt_jd_apply(evt_obj) # evt_obj = job_app
        # Job is applied by job developer for his job seeker
        # Business rules:
        #    Notify job seeker
        #    Notify company contact associated with the job
    Severity: Minor
    Found in app/models/event.rb - About 1 hr to fix

      Method create has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.create(evt_type, evt_obj)
          case evt_type
          when :JS_REGISTER
            evt_js_register(evt_obj)
          when :COMP_REGISTER
      Severity: Minor
      Found in app/models/event.rb - About 1 hr to fix

        Method evt_app_rejected has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.evt_app_rejected(evt_obj)
            # evt_obj = job application
            # Business rules:
            # Notify job seeker's job developer (email and popup)
            # Notify job seeker's case manager (email and popup)
        Severity: Minor
        Found in app/models/event.rb - About 1 hr to fix

          Method evt_app_accepted has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def self.evt_app_accepted(evt_obj)
              # evt_obj = job application
              # Business rules:
              # Notify job seeker's job developer (email and popup)
              # Notify job seeker's case manager (email and popup)
          Severity: Minor
          Found in app/models/event.rb - About 1 hr to fix

            Method evt_app_processing has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.evt_app_processing(evt_obj)
                # evt_obj = job application
                # Business rules:
                # Notify job seeker's job developer (email and popup)
                # Notify job seeker's case manager (email and popup)
            Severity: Minor
            Found in app/models/event.rb - About 1 hr to fix

              Method evt_job_revoked has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.evt_job_revoked(evt_obj)
                  # evt_obj = struct(:job, :agency)
                  # Notify all job developers in agency (email and popup)
              
                  job_developers = Agency.job_developers(evt_obj.agency)
              Severity: Minor
              Found in app/models/event.rb - About 1 hr to fix

                Method evt_app_rejected has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.evt_app_rejected(evt_obj)
                    # evt_obj = job application
                    # Business rules:
                    # Notify job seeker's job developer (email and popup)
                    # Notify job seeker's case manager (email and popup)
                Severity: Minor
                Found in app/models/event.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 evt_app_processing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.evt_app_processing(evt_obj)
                    # evt_obj = job application
                    # Business rules:
                    # Notify job seeker's job developer (email and popup)
                    # Notify job seeker's case manager (email and popup)
                Severity: Minor
                Found in app/models/event.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 evt_app_accepted has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.evt_app_accepted(evt_obj)
                    # evt_obj = job application
                    # Business rules:
                    # Notify job seeker's job developer (email and popup)
                    # Notify job seeker's case manager (email and popup)
                Severity: Minor
                Found in app/models/event.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 notify_list_for_js_apply_event has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.notify_list_for_js_apply_event(appl)
                    # Returns an array containing two arrays.  The first such array contains
                    # user ids, and the second email addresses of the people to be notified
                    id_list    = []
                    email_list = []
                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

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

                  def self.evt_app_accepted(evt_obj)
                    # evt_obj = job application
                    # Business rules:
                    # Notify job seeker's job developer (email and popup)
                    # Notify job seeker's case manager (email and popup)
                Severity: Major
                Found in app/models/event.rb and 2 other locations - About 2 hrs to fix
                app/models/event.rb on lines 253..295
                app/models/event.rb on lines 299..340

                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 99.

                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 3 locations. Consider refactoring.
                Open

                  def self.evt_app_processing(evt_obj)
                    # evt_obj = job application
                    # Business rules:
                    # Notify job seeker's job developer (email and popup)
                    # Notify job seeker's case manager (email and popup)
                Severity: Major
                Found in app/models/event.rb and 2 other locations - About 2 hrs to fix
                app/models/event.rb on lines 207..249
                app/models/event.rb on lines 299..340

                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 99.

                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 3 locations. Consider refactoring.
                Open

                  def self.evt_app_rejected(evt_obj)
                    # evt_obj = job application
                    # Business rules:
                    # Notify job seeker's job developer (email and popup)
                    # Notify job seeker's case manager (email and popup)
                Severity: Major
                Found in app/models/event.rb and 2 other locations - About 2 hrs to fix
                app/models/event.rb on lines 207..249
                app/models/event.rb on lines 253..295

                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 99.

                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 2 locations. Consider refactoring.
                Open

                  def self.evt_jd_assigned_js(evt_obj)
                    # This event occurs when a job developer is assigned a job seeker,
                    # by an agency admin.
                    # evt_obj = struct(:job_seeker, :agency_person)
                    # Business rules:
                Severity: Major
                Found in app/models/event.rb and 1 other location - About 1 hr to fix
                app/models/event.rb on lines 403..427

                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 72.

                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 2 locations. Consider refactoring.
                Open

                  def self.evt_cm_assigned_js(evt_obj)
                    # This event occurs when a case manager is assigned a job seeker,
                    # by an agency admin.
                    # evt_obj = struct(:job_seeker, :agency_person)
                    # Business rules:
                Severity: Major
                Found in app/models/event.rb and 1 other location - About 1 hr to fix
                app/models/event.rb on lines 344..368

                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 72.

                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 2 locations. Consider refactoring.
                Open

                  def self.evt_cm_self_assigned_js(evt_obj)
                    # This event occurs when a case manager assigns himself to a job seeker.
                    # evt_obj = struct(:job_seeker, :agency_person)
                    # Business rules:
                    #    Notify job seeker
                Severity: Minor
                Found in app/models/event.rb and 1 other location - About 45 mins to fix
                app/models/event.rb on lines 371..384

                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 41.

                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 2 locations. Consider refactoring.
                Open

                  def self.evt_jd_self_assigned_js(evt_obj)
                    # This event occurs when a job developer assigns himself to a job seeker.
                    # evt_obj = struct(:job_seeker, :agency_person)
                    # Business rules:
                    #    Notify job seeker
                Severity: Minor
                Found in app/models/event.rb and 1 other location - About 45 mins to fix
                app/models/event.rb on lines 387..400

                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 41.

                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

                There are no issues that match your filters.

                Category
                Status