travis-ci/job-board

View on GitHub

Showing 16 of 92 total issues

Method build_candidate_tags has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private def build_candidate_tags
      full_tag_set = {}
      candidate_tags = []

      add_default_tag = proc do |tag|
Severity: Minor
Found in lib/job_board/job_queries_transformer.rb - About 2 hrs to fix

    Method reclaim_for_queue has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private def reclaim_for_queue(redis: nil, site: '', queue_name: '',
                                      cutoff_seconds: 120)
          reclaimed_for_queue = []
          claimed_by_id = redis.hgetall("queue:#{site}:#{queue_name}:claims")
          claimed_by_processor = {}
    Severity: Minor
    Found in lib/job_board/job_queue_reconciler.rb - About 1 hr to fix

      Method reconcile! has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def reconcile!(with_ids: JobBoard.config.reconcile_stats_with_ids,
                         purge_unknown: false,
                         cutoff_seconds: JobBoard.config.reconcile_cutoff_seconds)
            JobBoard.logger.info('starting reconciliation process')
            start_time = Time.now
      Severity: Minor
      Found in lib/job_board/job_queue_reconciler.rb - About 1 hr to fix

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

            def reconcile!(with_ids: JobBoard.config.reconcile_stats_with_ids,
                           purge_unknown: false,
                           cutoff_seconds: JobBoard.config.reconcile_cutoff_seconds)
              JobBoard.logger.info('starting reconciliation process')
              start_time = Time.now
        Severity: Minor
        Found in lib/job_board/job_queue_reconciler.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 build_candidate_tags has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            private def build_candidate_tags
              full_tag_set = {}
              candidate_tags = []
        
              add_default_tag = proc do |tag|
        Severity: Minor
        Found in lib/job_board/job_queries_transformer.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 run has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def run
                results = { :@site => site }
        
                if queue_name.empty?
                  results[:jobs] = JobBoard::JobQueue.for_site(
        Severity: Minor
        Found in lib/job_board/services/search_jobs.rb - About 1 hr to fix

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

                def run
                  return nil if job_id.empty? || site.empty?
          
                  job = {}
                  db_job = fetch_db_job
          Severity: Minor
          Found in lib/job_board/services/fetch_job.rb - About 1 hr to fix

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

                def call(env)
                  auth = Request.new(env)
            
                  if site_paths =~ auth.request.path_info &&
                     !env.key?('HTTP_TRAVIS_SITE')
            Severity: Minor
            Found in lib/job_board/auth.rb - About 1 hr to fix

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

                  def call(env)
                    auth = Request.new(env)
              
                    if site_paths =~ auth.request.path_info &&
                       !env.key?('HTTP_TRAVIS_SITE')
              Severity: Minor
              Found in lib/job_board/auth.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 claim has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                  def claim(processor: '')
                    raise Invalid, 'missing processor name' if processor.empty?
              
                    claimed = nil
              
              
              Severity: Minor
              Found in lib/job_board/job_queue.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 for_queue has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def self.for_queue(redis: nil, site: '', queue_name: '')
                    redis ||= JobBoard.redis
                    raise Invalid, 'unknown queue' unless redis.sismember("queues:#{site}", queue_name)
              
                    claims = nil
              Severity: Minor
              Found in lib/job_board/job_queue.rb - About 1 hr to fix

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

                    private def reclaim_for_queue(redis: nil, site: '', queue_name: '',
                                                  cutoff_seconds: 120)
                      reclaimed_for_queue = []
                      claimed_by_id = redis.hgetall("queue:#{site}:#{queue_name}:claims")
                      claimed_by_processor = {}
                Severity: Minor
                Found in lib/job_board/job_queue_reconciler.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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def update(request_body)
                      JobBoard.logger.debug(
                        'handling request', request_body: request_body.inspect
                      )
                
                
                Severity: Minor
                Found in lib/job_board/image_updater.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

                Avoid too many return statements within this method.
                Open

                        return unauthorized
                Severity: Major
                Found in lib/job_board/auth.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                          return @app.call(env)
                  Severity: Major
                  Found in lib/job_board/auth.rb - About 30 mins to fix

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

                          def run
                            if caching_enabled
                              cached_script = fetch_cached
                              return cached_script unless cached_script.nil?
                            end
                    Severity: Minor
                    Found in lib/job_board/services/fetch_job_script.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

                    Severity
                    Category
                    Status
                    Source
                    Language