rosa-abf/rosa-build

View on GitHub

Showing 181 of 209 total issues

File build_list.rb has 618 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class BuildList < ActiveRecord::Base
  include CommitAndVersion
  include FileStoreClean
  include AbfWorkerMethods
  include Feed::BuildList
Severity: Major
Found in app/models/build_list.rb - About 1 day to fix

    Function angularMoment has 199 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function angularMoment(angular, moment) {
    
        /**
         * @ngdoc overview
         * @name angularMoment
    Severity: Major
    Found in app/assets/javascripts/angularjs/angular-moment.js - About 7 hrs to fix

      Method run_mass_import has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

          def run_mass_import(url, srpms_list, visibility, owner, add_to_repository_id)
            doc = Nokogiri::HTML(open(url))
            links = doc.css("a[href$='.src.rpm']")
            return if links.count == 0
            filter = srpms_list.lines.map(&:chomp).map(&:strip).select(&:present?)
      Severity: Minor
      Found in app/models/concerns/git.rb - About 6 hrs 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

      Class BuildList has 45 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class BuildList < ActiveRecord::Base
        include CommitAndVersion
        include FileStoreClean
        include AbfWorkerMethods
        include Feed::BuildList
      Severity: Minor
      Found in app/models/build_list.rb - About 6 hrs to fix

        File bootstrap-typeahead.js has 402 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*!
         * bootstrap-typeahead.js v0.0.3 (http://www.upbootstrap.com)
         * Copyright 2012-2014 Twitter Inc.
         * Licensed under MIT (https://github.com/biggora/bootstrap-ajax-typeahead/blob/master/LICENSE)
         * See Demo: http://plugins.upbootstrap.com/bootstrap-ajax-typeahead
        Severity: Minor
        Found in app/assets/javascripts/lib/bootstrap-typeahead.js - About 5 hrs to fix

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

            def index
              params[:kind]      = params[:kind] == 'pull_requests' ? 'pull_requests' : 'issues'
              raise Pundit::NotAuthorizedError if !@project.has_issues? && params[:kind] == 'issues'
          
              params[:filter]    = params[:filter].in?(['created', 'assigned']) ? params[:filter] : 'all'
          Severity: Minor
          Found in app/controllers/projects/issues_controller.rb - About 5 hrs 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 shift has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
          Open

            def shift
              $redis.with do |r|
                job_shift_sem = Redis::Semaphore.new(:job_shift_lock, redis: r)
                job_shift_sem.lock do
                  shifted_build_lists = r.smembers('abf_worker:shifted_build_lists')
          Severity: Minor
          Found in app/controllers/api/v1/jobs_controller.rb - About 5 hrs 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 read_and_write has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
          Open

                def read_and_write(input, stdin, stdout, stderr, timeout=nil, max=nil)
                  max = nil if max && max <= 0
                  @out, @err = '', ''
                  offset = 0
          
          
          Severity: Minor
          Found in lib/ext/posix_spawn.rb - About 4 hrs 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_rpms has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.build_rpms(testing = false)
                available_repos = BuildList.
                  select('MIN(updated_at) as min_updated_at, save_to_repository_id, build_for_platform_id').
                  where(new_core: true, status: (testing ? BuildList::BUILD_PUBLISH_INTO_TESTING : BuildList::BUILD_PUBLISH)).
                  group(:save_to_repository_id, :build_for_platform_id).
          Severity: Minor
          Found in app/services/abf_worker_service/rpm.rb - About 4 hrs 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_notifications has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.create_notifications(record)
          
              case record.class.to_s
              when 'GitHook'
                return unless record.project
          Severity: Minor
          Found in app/models/concerns/feed/git.rb - About 4 hrs 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_link_on_issues_from_item has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.create_link_on_issues_from_item item, commits = nil
              linker = item.user
          
              case
              when item.is_a?(GitHook)
          Severity: Minor
          Found in app/models/comment.rb - About 4 hrs 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 blame_highlight has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

            def blame_highlight(blob, path, text)
              return if blob.nil? || text.blank?
              rugged = blob.repo.rugged
              lazy = Linguist::LazyBlob.new(rugged, blob.id, path, blob.mode)
              language = lazy.language
          Severity: Minor
          Found in app/helpers/git_helper.rb - About 4 hrs 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 perform has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              def perform
                return if subject.valid? && restart_task
                if options['feedback_from_user']
                  user = User.find options['feedback_from_user']
                  return if !user.system? && subject.builder != user
          Severity: Minor
          Found in app/jobs/abf_worker/rpm_worker_observer.rb - About 4 hrs 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 set_additional_data has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

            def set_additional_data params
              return true if params[:path].blank? && params[:line].blank? # not inline comment
              if params[:in_reply].present? && reply = Comment.where(id: params[:in_reply]).first
                self.data = reply.data
                return true
          Severity: Minor
          Found in app/models/comment.rb - About 3 hrs 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 blob_highlight has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

            def blob_highlight(blob, path)
              return if blob.nil? || blob.size == 0
              rugged = blob.repo.rugged
              lazy = Linguist::LazyBlob.new(rugged, blob.id, path, blob.mode)
              language = lazy.language
          Severity: Minor
          Found in app/helpers/git_helper.rb - About 3 hrs 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

          Class Platform has 29 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Platform < ActiveRecord::Base
            extend FriendlyId
            friendly_id :name, use: [:finders]
          
            include FileStoreClean
          Severity: Minor
          Found in app/models/platform.rb - About 3 hrs to fix

            Method new_comment_notifications has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

              def new_comment_notifications
                return if automatic?
            
                if issue_comment?
                  commentable.subscribes.each do |subscribe|
            Severity: Minor
            Found in app/models/concerns/feed/comment.rb - About 3 hrs 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 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def create
                  key = "#{save_to_repository_id}-#{build_for_platform_id}"
                  projects_for_cleanup = $redis.with { |r| r.lrange(PROJECTS_FOR_CLEANUP, 0, -1) }.select do |k|
                    (testing && k =~ /^testing-[\d]+-#{key}$/) || (!testing && k =~ /^[\d]+-#{key}$/)
                  end
            Severity: Minor
            Found in app/services/abf_worker_service/rpm.rb - About 3 hrs 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_all has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
            Open

              def build_all
                return unless start
                # later with resque
                arches_list     = arch_names ? Arch.where(name: arch_names.split(', ')) : Arch.all
                projects_list.lines.each do |name|
            Severity: Minor
            Found in app/models/mass_build.rb - About 3 hrs 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

            File build_lists_helper.rb has 292 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module BuildListsHelper
            
              # See: app/assets/javascripts/angularjs/models/build_list.js.erb
              def build_list_status_color(status)
                case status
            Severity: Minor
            Found in app/helpers/build_lists_helper.rb - About 3 hrs to fix
              Severity
              Category
              Status
              Source
              Language