rosa-abf/rosa-build

View on GitHub

Showing 182 of 210 total issues

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

def set_data
if save_to_platform
self.name = "#{Time.now.utc.to_date.strftime("%d.%b")}-#{save_to_platform.name}"
self.build_for_platform = save_to_platform if save_to_platform.main?
end
Severity: Minor
Found in app/models/mass_build.rb - About 35 mins to fix

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

def will_paginate(collection_or_options = nil, options = {})
if collection_or_options.is_a? Hash
options, collection_or_options = collection_or_options, nil
end
options.merge!(renderer: BootstrapLinkRenderer) unless options[:renderer]
Severity: Minor
Found in app/helpers/paginate_helper.rb - About 35 mins to fix

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

def update
authorize @pull
status = 422
if (action = params[:pull_request_action]) && %w(close reopen).include?(params[:pull_request_action])
if @pull.send("can_#{action}?")
Severity: Minor
Found in app/controllers/projects/pull_requests_controller.rb - About 35 mins to fix

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

def self.find_by_hash_tag(hash_tag, current_user, project)
hash_tag =~ HASH_TAG_REGEXP
owner_uname = Regexp.last_match[1].presence || Regexp.last_match[2].presence || project.owner.uname
project_name = Regexp.last_match[1] ? Regexp.last_match[2] : project.name
serial_id = Regexp.last_match[3]
Severity: Minor
Found in app/models/issue.rb - About 35 mins to fix

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

def prepare_extra_build_lists
if mass_build && mass_build.extra_mass_builds.present?
extra_build_lists << BuildList.where(mass_build_id: mass_build.extra_mass_builds).pluck(:id)
extra_build_lists.flatten!
end
Severity: Minor
Found in app/models/build_list.rb - About 35 mins to fix

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

def lock_file_actions(action, lock_file)
result = false
(['SRPMS'] << Arch.pluck(:name)).each do |arch|
path = "#{platform.path}/repository/#{arch}/#{name}/#{LOCK_FILE_NAMES[lock_file]}"
case action
Severity: Minor
Found in app/models/repository.rb - About 35 mins to fix

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

def subscribe_issue_assigned_user
if self.assignee_id && self.assignee_id_changed?
self.subscribes.where(user_id: self.assignee_id_was).first.try(:destroy) unless self.assignee_id_was.blank?
if self.assignee.notifier.issue_assign && !self.subscribes.exists?(user_id: self.assignee_id)
self.subscribes.create(user_id: self.assignee_id)
Severity: Minor
Found in app/models/issue.rb - About 35 mins to fix

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

def profile
if request.patch?
send_confirmation = params[:user][:email] != @user.email
if @user.update_without_password(user_params)
update_avatar(@user, params)
Severity: Minor
Found in app/controllers/users/settings_controller.rb - About 35 mins to fix

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

def get_info_of_key(file_path)
results = {}
str = %x[ cat #{file_path} | gpg --quiet --import-options import-show --dry-run --keyid-format LONG --import | sed -n 1,2p ]
info = str.strip.split("\n")
if info.size == 2
Severity: Minor
Found in app/models/key_pair.rb - About 35 mins to fix

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

def show
@commit = @commentable = @project.repo.commit(params[:id]) || raise(ActiveRecord::RecordNotFound)
@comments = Comment.for_commit(@commit)
 
respond_to do |format|
Severity: Minor
Found in app/controllers/projects/git/commits_controller.rb - About 35 mins to fix

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

def self.matches?(request)
if (params = request.path_parameters) && params[:treeish] # parse existing branch (tag) and path
branch_or_tag = begin
(p = Project.find_by_owner_and_name params[:name_with_owner]) &&
p.repo.branches_and_tags.map(&:name).sort{|a,b| b.length <=> a.length}.detect{|b| params[:treeish].start_with?(b)} ||
Severity: Minor
Found in lib/ext/rosa/constraints.rb - About 35 mins to fix

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

def save
sha1 = Digest::SHA1.hexdigest(::File.read(data[:path]))
return sha1 if exist?
 
resource = RestClient::Resource.new("#{URL}/api/v1/upload", user: token)
Severity: Minor
Found in app/services/file_store_service.rb - About 35 mins to fix

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

def get_sha1_of_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 35 mins to fix

Avoid too many return statements within this method.
Open

return data[:actual] = false
Severity: Major
Found in app/models/comment.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

    return true
    Severity: Major
    Found in app/models/comment.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

      return data[:actual] = res
      Severity: Major
      Found in app/models/comment.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

        return false # no new packages
        Severity: Major
        Found in app/models/build_list.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

          return nil unless build_for_platform
          Severity: Major
          Found in app/models/platform_content.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

            return @build_list
            Severity: Major
            Found in app/models/platform_content.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

              return nil unless bfp_name
              Severity: Major
              Found in app/models/platform_content.rb - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language