AgileVentures/MetPlus_PETS

View on GitHub

Showing 70 of 122 total issues

Method my_js_as_jd has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def my_js_as_jd
    raise 'Unsupported request' if not request.xhr?
    term = params[:q] || {}
    term = term[:term] || ''
    term = term.downcase
Severity: Minor
Found in app/controllers/agency_people_controller.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

Method index has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    # Store, or recover, search and items-per-page criteria
    search_params, @items_count, items_per_page =
      process_pagination_params('searched_jobs')

Severity: Minor
Found in app/controllers/jobs_controller.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 load_div_from_url has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    this.load_div_from_url = function(target_idx, url) {

        if(typeof self.successCallback == 'undefined')
            self.successCallback = PaginationFunctions.getSuccessFunction(self.name);
        if(typeof self.errorCallback == 'undefined')
Severity: Minor
Found in app/assets/javascripts/pagination.js - About 1 hr 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 home has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def home
          if request.xhr?
            
            if params[:data_type] == 'skills'
      
      
      Severity: Minor
      Found in app/controllers/company_people_controller.rb - About 1 hr to fix

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

          def assign_job_seeker
            # Assign agency person, in specified role, to the job seeker
        
            @agency_person = AgencyPerson.find(params[:id])
            self.action_description = 'assign a job seeker'
        Severity: Minor
        Found in app/controllers/agency_people_controller.rb - About 1 hr to fix

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

            def update
              @agency_person = AgencyPerson.find(params[:id])
          
              self.action_description = 'edit an agency person'
              authorize @agency_person
          Severity: Minor
          Found in app/controllers/agency_people_controller.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

                Function add_job_property has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  add_job_property: function (job_property, job_prop_plural, attr1, attr2) {
                    // This functions handles the event created when the
                    // "Add <property>" button is clicked on the bootstrap modal.
                
                    // The arguments are:
                Severity: Minor
                Found in app/assets/javascripts/agency_admin.js - About 1 hr to fix

                  Function success has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              success: function (data, status, xhrObject) {
                  
                                var company_id = null;
                                if ($('#company_id') != null) {
                                  company_id = $('#company_id').val();
                  Severity: Minor
                  Found in app/assets/javascripts/agency_admin.js - 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

                        Function spinner has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            spinner: function(target){
                                var self = this;
                                this.spinnerOpts = {
                                    lines: 13 // The number of lines to draw
                                    , length: 28 // The length of each line
                        Severity: Minor
                        Found in app/assets/javascripts/application.js - About 1 hr to fix

                          Method invite_resource has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def invite_resource(&block)
                              user = resource_class.invite!(invite_params, current_inviter, &block)
                              if user.errors.empty?
                                if (person = user.actable)
                                  # If a person is already associated with this user, this means that
                          Severity: Minor
                          Found in app/controllers/people_invitations_controller.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 update_job_property has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            update_job_property: function (job_property, job_prop_plural, attr1, attr2) {
                              // This functions handles the event created when the
                              // "Update <property>" button is clicked on the bootstrap modal.
                          
                              // The arguments are:
                          Severity: Minor
                          Found in app/assets/javascripts/agency_admin.js - About 1 hr to fix

                            Function setup has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              setup: function() {
                                  $('#assignTaskModal').on('shown.bs.modal', function (e) {
                                      $('#assignTaskModal_button').off('click').click( function() {
                                          if ($("#task_assign_select").val() === null) {
                                              return;
                            Severity: Minor
                            Found in app/assets/javascripts/tasks.js - 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 invite_resource has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def invite_resource(&block)
                                    user = resource_class.invite!(invite_params, current_inviter, &block)
                                    if user.errors.empty?
                                      if (person = user.actable)
                                        # If a person is already associated with this user, this means that
                                Severity: Minor
                                Found in app/controllers/people_invitations_controller.rb - About 1 hr to fix

                                  Function reject_action has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      reject_action: function (e) {
                                          var link_url = $(this).attr('href');
                                          if(!RejectAppln.check_for_reason()) {
                                              // Prevent closing the modal
                                              e.preventDefault();
                                  Severity: Minor
                                  Found in app/assets/javascripts/job_applications.js - 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language