rosa-abf/rosa-build

View on GitHub

Showing 182 of 210 total issues

Method as_json has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def as_json(options = nil)
{
build_lists: {
build_started: prepare_collection(build_lists_started),
success: prepare_collection(build_lists_success),
Severity: Minor
Found in app/presenters/statistic_presenter.rb - About 1 hr to fix

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

    def get_owner
    if self.class.method_defined? :parent
    if parent and (parent.is_a? User or parent.is_a? Group)
    return parent
    else
    Severity: Minor
    Found in app/controllers/application_controller.rb - About 1 hr to fix

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

    def check(do_transaction = true)
    if do_transaction && !valid?
    issue.set_close nil
    issue.save(validate: false) # FIXME remove this hack
    return false
    Severity: Minor
    Found in app/models/pull_request.rb - About 1 hr to fix

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

    def projects_list
    render(text: @repository.projects.map(&:name).join("\n")) && return if params[:text] == 'true'
     
    owner_subquery = "
    INNER JOIN (
    Severity: Minor
    Found in app/controllers/platforms/repositories_controller.rb - About 1 hr to fix

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

    def clone
    return if from_project.nil?
    git = Grit::Git.new(path)
    if new_record? || !git.exist?
    #~ FileUtils.mkdir_p(path)
    Severity: Minor
    Found in app/models/pull_request.rb - About 1 hr to fix

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

    def issues
    @created_issues = current_user.issues
    @assigned_issues = Issue.where(assignee_id: current_user.id)
    @all_issues = ProjectPolicy::Scope.new(current_user, Issue).membered.uniq.joins(:project)
     
    Severity: Minor
    Found in app/controllers/home_controller.rb - About 1 hr to fix

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

    def has_new_packages?
    if last_bl = last_published.joins(:source_packages).where(build_list_packages: {actual: true}).last
    source_packages.each do |nsp|
    sp = last_bl.source_packages.find{ |sp| nsp.name == sp.name }
    return true unless sp
    Severity: Minor
    Found in app/models/build_list.rb - About 1 hr to fix

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

    def archive
    format, @treeish = params[:format], params[:treeish]
    raise Grit::NoSuchPathError unless @treeish =~ /^#{@project.name}-/ &&
    @treeish !~ /[\s]+/ &&
    format =~ /\A(zip|tar\.gz)\z/
    Severity: Minor
    Found in app/controllers/projects/git/trees_controller.rb - About 1 hr to fix

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

    def create
    notices, errors = [], []
     
    @repository = Repository.find build_list_params[:save_to_repository_id]
    @platform = @repository.platform
    Severity: Minor
    Found in app/controllers/projects/build_lists_controller.rb - About 1 hr to fix

    Method update_rpm_builds has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def update_rpm_builds
    build_lists = BuildList.where(id: options['build_list_ids'])
    build_lists.each do |build_list|
    update_results build_list
    case status
    Severity: Minor
    Found in app/jobs/abf_worker/publish_observer.rb - About 1 hr to fix

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

      def self.perform
      integrity_path = Rails.root.join('public', 'integrity')
      Dir.mkdir(integrity_path, 0755) rescue nil
       
      start_time = Time.now.utc
      Severity: Minor
      Found in app/jobs/integrity_check_job.rb - About 1 hr to fix

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

        def build_list_notifications
        if mass_build.blank? && ( # Do not show mass build activity in activity feeds
        status_changed? && [
        BuildList::BUILD_PENDING,
        BuildList::BUILD_PUBLISHED,
        Severity: Minor
        Found in app/models/concerns/feed/build_list.rb - About 1 hr to fix

          Method set_additional_data has 29 lines of code (exceeds 25 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 1 hr to fix

            Method build_for has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def build_for(mass_build, repository_id, arch = Arch.find_by(name: 'i586'), priority = 0, increase_rt = false)
            build_for_platform = mass_build.build_for_platform
            save_to_platform = mass_build.save_to_platform
            user = mass_build.user
            # Select main and project platform repository(contrib, non-free and etc)
            Severity: Minor
            Found in app/models/project.rb - About 1 hr to fix

              Method create! has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def create!
              cleanup_folder
               
              if filter_build_lists_without_packages(build_list).blank?
              build_list.fail_publish_container
              Severity: Minor
              Found in app/services/abf_worker_service/container.rb - About 1 hr to fix

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

                def create
                from_project = Project.find_by(id: pull_params[:from_project_id])
                from_project ||= @project
                authorize from_project, :show?
                 
                 
                Severity: Minor
                Found in app/controllers/api/v1/pull_requests_controller.rb - About 1 hr to fix

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

                def receive_issues(issue, action)
                pull = issue.pull_request
                return if action.to_sym == :create && pull
                default_url_options
                 
                 
                Severity: Minor
                Found in app/models/hook.rb - About 1 hr to fix

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

                def diff
                res = params[:diff].split(/\A(.*)\.\.\.(.*)\z/).select {|e| e.present?}
                if res[1].present?
                params1 = res[0]
                params2 = res[1] == 'HEAD' ? @project.resolve_default_branch : res.last
                Severity: Minor
                Found in app/controllers/projects/git/commits_controller.rb - About 1 hr to fix

                Function highlightShow has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                function highlightShow(id) {
                $('td.code span.highlight-line').removeClass('highlight-line');
                var from = to = id.substring(4);
                if (/[0-9]+\-lc-[0-9]+$/.test(from)) {
                var index = to.indexOf('-');
                Severity: Minor
                Found in app/assets/javascripts/extra/highlight.js - About 1 hr to fix

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

                def actor_name
                if @actor.present?
                @actor.instance_of?(User) ? "#{@actor.uname}#{ @actor.try(:name) and !@actor.name.empty? ? " (#{@actor.name})" : ''}" : @actor.uname
                else
                nil
                Severity: Minor
                Found in app/models/collaborator.rb - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language