AgileVentures/MetPlus_PETS

View on GitHub

Showing 70 of 122 total issues

Method create_task has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def create_task(audience, task_type, *args)
        person = nil
        job_application = nil
        company = nil
        job = nil
Severity: Minor
Found in app/models/concerns/task_manager/task_manager.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 apply has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def apply
    @job = Job.find_by(id: params[:job_id])
    unless @job
      flash[:alert] = 'Unable to find the job the user is trying to apply to.'
      redirect_to(jobs_url) && return
Severity: Minor
Found in app/controllers/jobs_controller.rb - About 1 hr to fix

    Function match has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      match: function () {
        $('#match_my_resume').on('click', function() {
          var answer = confirm('This will match your résumé against all active jobs ' +
                               ' and may take a while.     Do you want to proceed?');
          if (answer) {
    Severity: Minor
    Found in app/assets/javascripts/jobs.js - About 1 hr to fix

      Method perform has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def perform(email_addresses, evt_type, *evt_obj)
          case evt_type
          when Event::EVT_TYPE[:JS_REGISTER]
            AgencyMailer.job_seeker_registered(email_addresses, evt_obj[0]).deliver_later
      
      
      Severity: Minor
      Found in app/jobs/notify_email_job.rb - About 1 hr to fix

        Method home has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def home
            if Agency.this_agency(current_user).nil?
              flash[:notice] = 'Current agency cannot be determined'
              redirect_to(root_path) && return
            end
        Severity: Minor
        Found in app/controllers/agency_admin_controller.rb - About 1 hr to fix

          Method process_match_results has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_match_results(results, key_id)
                match_set = {}
                return match_set if results.nil?
          
                # First level of results is a hash of specific matcher results ....
          Severity: Minor
          Found in app/models/concerns/cruncher_utility.rb - About 55 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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              jobseeker_params = form_params
              dispatch_file    = jobseeker_params.delete 'resume'
          
              @jobseeker = JobSeeker.new(jobseeker_params)
          Severity: Minor
          Found in app/controllers/job_seekers_controller.rb - About 55 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 new_task has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  task_type,
                  owner,
                  target_person = nil,
                  target_job_application = nil,
                  target_company = nil,
          Severity: Minor
          Found in app/models/concerns/task_manager/task_manager.rb - About 45 mins to fix

            Method target has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def target
                return person unless person.nil?
                return company unless company.nil?
                return job_application unless job_application.nil?
                return job unless job.nil?
            Severity: Minor
            Found in app/models/task.rb - About 45 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 update_profile has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              def update_profile
                @company_addresses = Company.find(@company_person.company_id).addresses
            
                person_params = handle_user_form_parameters company_person_params
                if @company_person.update_attributes(person_params)
            Severity: Minor
            Found in app/controllers/company_people_controller.rb - About 45 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

            Function PaginationHandler has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            var PaginationHandler = function (url, viewSelector, successCallback, errorCallback, beforeGetCallback) {
            Severity: Minor
            Found in app/assets/javascripts/pagination.js - About 35 mins to fix

              Function change_job_property_success has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                change_job_property_success: function (modal_id, model_errors_id,
                                                       job_prop_plural, company_id,
                                                       user_type) {
              Severity: Minor
              Found in app/assets/javascripts/agency_admin.js - About 35 mins to fix

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

                  def validate(task)
                    if task.try(:owner).nil? and task.try(:owner_company).nil? and task.try(:owner_agency).nil?
                      task.errors[:task_owner] << "need to be set"
                    elsif not task.owner_company.nil? and task.try(:owner_company_role).nil?
                      task.errors[:task_owner] << "no company role set"
                Severity: Minor
                Found in app/validators/task_owner_validator.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_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 upload_file has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.upload_file(file, file_name, file_id)
                    mime_type = MIME::Types.type_for(URI.escape(file_name))
                
                    raise "Invalid MIME type for file: #{file_name}" if mime_type.empty?
                    raise "Unsupported file type for: #{file_name}" unless
                Severity: Minor
                Found in app/services/cruncher_service.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 max_salary_consistent_with_min_salary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def max_salary_consistent_with_min_salary
                    if max_salary.present?
                
                      if min_salary.present?
                        errors.add(:max_salary, 'cannot be less than minimum salary') if
                Severity: Minor
                Found in app/models/job.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 apply has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def apply
                    @job = Job.find_by(id: params[:job_id])
                    unless @job
                      flash[:alert] = 'Unable to find the job the user is trying to apply to.'
                      redirect_to(jobs_url) && return
                Severity: Minor
                Found in app/controllers/jobs_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 match_job_seekers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def match_job_seekers
                    authorize @job
                    Pusher.trigger('pusher_control',
                                   'spinner_start',
                                   user_id: pets_user.user.id,
                Severity: Minor
                Found in app/controllers/jobs_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

                Severity
                Category
                Status
                Source
                Language