rosa-abf/rosa-build

View on GitHub

Showing 210 of 210 total issues

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

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

def git_delete_branch_notification(user, options)
set_locale user
mail(
to: user.email,
subject: I18n.t('notifications.subjects.update_code', project_name: "#{options[:project_owner]}/#{options[:project_name]}")
Severity: Minor
Found in app/mailers/user_mailer.rb and 1 other location - About 35 mins to fix
app/mailers/user_mailer.rb on lines 97..103

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

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

def git_new_push_notification(user, options)
set_locale user
mail(
to: user.email,
subject: I18n.t('notifications.subjects.update_code', project_name: "#{options[:project_owner]}/#{options[:project_name]}")
Severity: Minor
Found in app/mailers/user_mailer.rb and 1 other location - About 35 mins to fix
app/mailers/user_mailer.rb on lines 87..93

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

if language
lexer = Rouge::Lexer.find(language.name)
if !lexer
language.aliases.each do |al|
lexer = Rouge::Lexer.find(al)
Severity: Minor
Found in app/helpers/git_helper.rb and 1 other location - About 30 mins to fix
app/helpers/git_helper.rb on lines 141..149

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

if language
lexer = Rouge::Lexer.find(language.name)
if !lexer
language.aliases.each do |al|
lexer = Rouge::Lexer.find(al)
Severity: Minor
Found in app/helpers/git_helper.rb and 1 other location - About 30 mins to fix
app/helpers/git_helper.rb on lines 115..123

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

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

                def update(options={}, &block)
                user_params = params[:user]
                resource.role = user_params.delete(:role)
                user_params.delete(:password) if user_params[:password].blank?
                user_params.delete(:password_confirmation) if user_params[:password_confirmation].blank?
                Severity: Minor
                Found in app/admin/users.rb - About 25 mins to fix

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

                def worker_queue_with_priority(prefix = true)
                queue = ''
                 
                if prefix && is_a?(BuildList)
                if mass_build_id
                Severity: Minor
                Found in app/models/concerns/abf_worker_methods.rb - About 25 mins to fix
                Severity
                Category
                Status
                Source
                Language