rosa-abf/rosa-build

View on GitHub

Showing 210 of 210 total issues

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

def render_line_comments
unless @no_commit_comment || @in_discussion
comments = @line_comments.select do |c|
c.data.try('[]', :line).to_s == @num_line.to_s && c.actual_inline_comment?
end
Severity: Minor
Found in app/helpers/diff_helper.rb - About 25 mins to fix

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

def self.perform
log_file = Rails.root.join("log", "remove_outdated.log").to_s
counter_bl = 0
BuildList.outdated.find_each(batch_size: 100) do |bl|
bl.destroy && (counter_bl += 1) if bl.id != bl.last_published.first.try(:id)
Severity: Minor
Found in app/jobs/remove_outdated_items_job.rb - About 25 mins to fix

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

def log_before_update
case self.class.to_s
when 'BuildList'
if status_changed? and [BuildList::BUILD_CANCELED, BuildList::BUILD_PUBLISHED].include?(status)
ActiveSupport::Notifications.instrument("event_log.observer", eventable: self)
Severity: Minor
Found in app/models/concerns/event_loggable.rb - About 25 mins to fix

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

def public_downloads_url(subplatform_name = nil, arch = nil, repo = nil)
"#{APP_CONFIG['downloads_url']}/#{name}/repository/".tap do |url|
url << "#{subplatform_name}/" if subplatform_name.present?
url << "#{arch}/" if arch.present?
url << "#{repo}/" if repo.present?
Severity: Minor
Found in app/models/platform.rb - About 25 mins to fix

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

def build_list_version_name(bl)
hash_size=5
if bl.commit_hash.present?
if bl.last_published_commit_hash.present? && bl.last_published_commit_hash != bl.commit_hash
"#{shortest_hash_id bl.last_published_commit_hash, hash_size}...#{shortest_hash_id bl.commit_hash, hash_size}"
Severity: Minor
Found in app/helpers/build_lists_helper.rb - About 25 mins to fix

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

def build_list_version_link(bl)
hash_size=5
if bl.commit_hash.present?
if bl.last_published_commit_hash.present? && bl.last_published_commit_hash != bl.commit_hash
link_to "#{shortest_hash_id bl.last_published_commit_hash, hash_size}...#{shortest_hash_id bl.commit_hash, hash_size}",
Severity: Minor
Found in app/helpers/build_lists_helper.rb - About 25 mins to fix

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

def get_build_list_version_path(bl)
if bl.commit_hash.present?
if bl.last_published_commit_hash.present? && bl.last_published_commit_hash != bl.commit_hash
diff_path(bl.project, bl.last_published_commit_hash) + "...#{bl.commit_hash}"
else
Severity: Minor
Found in app/helpers/build_lists_helper.rb - About 25 mins to fix

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

def commit_type
if refname =~ /refs\/tags\/*/ && rev_type == 'commit'
# un-annotated tag
@refname_type= 'tag'
#~ short_refname=refname + '##refs/tags/'
Severity: Minor
Found in app/models/git_hook.rb - About 25 mins to fix

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

def fork(is_alias = false)
owner = (Group.find params[:group_id] if params[:group_id].present?) || current_user
authorize @project, :show?
authorize owner, :write? if owner.is_a?(Group)
 
 
Severity: Minor
Found in app/controllers/api/v1/projects_controller.rb - About 25 mins to fix

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

def to_vre_epoch_zero
res = []
if epoch.present?
res << epoch.to_s
else
Severity: Minor
Found in app/models/build_list/package.rb - About 25 mins to fix

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

def create
invite_key = params[:user][:invite_key]
invite = Invite.find_by_invite_key(invite_key)
if !invite || invite.used?
flash[:error] = I18n.t('errors.messages.bad_invite_key')
Severity: Minor
Found in app/controllers/users/registrations_controller.rb - About 25 mins to fix

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

def clean
to_project.repo.branches.each {|branch| system 'git', 'checkout', branch.name}
system 'git', '-C', path, 'checkout', to_ref
 
to_project.repo.branches.each do |branch|
Severity: Minor
Found in app/models/pull_request.rb - About 25 mins to fix

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

def merge!(who)
return false unless can_merging?
old_commit = to_project.repo.commits(to_ref).first
commit = repo.commits(to_ref).first
system "git -C #{path} config user.name \"#{who.uname}\" && git -C #{path} config user.email \"#{who.email}\""
Severity: Minor
Found in app/models/pull_request.rb - About 25 mins to fix

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

def layout_class
case
when controller_name == 'issues' && action_name == 'new'
'right nopadding'
when controller_name == 'build_lists' && ['new', 'create'].include?(action_name)
Severity: Minor
Found in app/helpers/application_helper.rb - About 25 mins to fix

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

def build_list_item_version_link(item, str_version = false)
hash_size=5
if item.version =~ /^[\da-z]+$/ && item.name == item.build_list.project.name
bl = item.build_list
{
Severity: Minor
Found in app/helpers/build_lists_helper.rb - About 25 mins to fix

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

def save_to_repositories(project, params)
project.repositories.map do |r|
# Show only main platforms which user used as default.
next if r.platform.main? && current_user_platforms.present? && current_user_platforms.exclude?(r.platform.id)
{
Severity: Minor
Found in app/helpers/build_lists_helper.rb - About 25 mins to fix

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

def gather_old_packages(project_id, repository_id, platform_id, testing = false)
build_lists_for_cleanup = []
status = testing ? BuildList::BUILD_PUBLISHED_INTO_TESTING : BuildList::BUILD_PUBLISHED
Arch.pluck(:id).each do |arch_id|
bl = BuildList.where(project_id: project_id).
Severity: Minor
Found in app/services/abf_worker_service/repository.rb - About 25 mins to fix

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

def prepare_message
(@caption, @content) = @commit_message.split("\n\n", 2)
@caption = 'empty message' unless @caption.present?
if @caption.length > 72
tmp = '...' + @caption[69..-1]
Severity: Minor
Found in app/presenters/git_presenters/commit_as_message_presenter.rb - About 25 mins to fix

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

def rtruncate(length, options = {})
chars = self.dup.mb_chars
return self if chars.length <= length
options[:omission] ||= "..."
options[:separator] ||= '/'
Severity: Minor
Found in lib/ext/core/string.rb - About 25 mins to fix

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

def publish_into_testing?
return false unless record.new_core?
return false unless record.can_publish_into_testing?
create? || ( record.save_to_platform.main? && publish? )
end
Severity: Minor
Found in app/policies/build_list_policy.rb - About 25 mins to fix
Severity
Category
Status
Source
Language