AgileVentures/MetPlus_PETS

View on GitHub
app/controllers/jobs_controller.rb

Summary

Maintainability
C
1 day
Test Coverage

File jobs_controller.rb has 324 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class JobsController < ApplicationController
  include JobsViewer
  include CruncherUtility
  include PaginationUtility

Severity: Minor
Found in app/controllers/jobs_controller.rb - About 3 hrs to fix

    Class JobsController has 24 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class JobsController < ApplicationController
      include JobsViewer
      include CruncherUtility
      include PaginationUtility
    
    
    Severity: Minor
    Found in app/controllers/jobs_controller.rb - About 2 hrs to fix

      Method index has 39 lines of code (exceeds 25 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

        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

        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

          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

          Method create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def create
              save_params = job_params
          
              # if new_address_params is not nil then user wants to create a new
              # job location (company address) and associate that with this job.
          Severity: Minor
          Found in app/controllers/jobs_controller.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

          There are no issues that match your filters.

          Category
          Status