rosa-abf/rosa-build

View on GitHub

Showing 210 of 210 total issues

File build_list.rb has 621 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

      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

          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

          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

          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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          $scope.change_group_filter = function(group_id) {
          var position = $.inArray(group_id, $scope.filter_groups);
          var filter = 'group_filter_'+group_id+'_class';
          if( ~position ) {
          $scope.filter_groups.splice(position, 1);
          app/assets/javascripts/angularjs/controllers/projects_controller.js on lines 44..56

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          $scope.change_user_filter = function(user_id) {
          var position = $.inArray(user_id, $scope.filter_users);
          var filter = 'user_filter_'+user_id+'_class';
          if( ~position ) {
          $scope.filter_users.splice(position, 1);
          app/assets/javascripts/angularjs/controllers/projects_controller.js on lines 58..70

          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

          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

          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

          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

          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

          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

          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

          Class Platform has 28 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 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
            Severity
            Category
            Status
            Source
            Language