Showing 181 of 209 total issues
File project.rb
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Project < ActiveRecord::Base
has_ancestry orphan_strategy: :adopt # we replace a 'path' method in the Git module
include Autostart
include Owner
Class Project
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Project < ActiveRecord::Base
has_ancestry orphan_strategy: :adopt # we replace a 'path' method in the Git module
include Autostart
include Owner
Class ApplicationPolicy
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationPolicy
attr_reader :user, :record
def initialize(user, record)
# raise Pundit::NotAuthorizedError, 'must be logged in' unless user
Method update
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def update
respond_to do |format|
format.html { render nothing: true, status: 200 }
format.json {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method update
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def update
@pull = @project.pull_requests.includes(:issue).where(issues: {serial_id: params[:id]}).first
authorize @pull
if pull_params.present?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method actual_inline_comment?
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def actual_inline_comment?(diff = nil, force = false)
unless force
raise "This is not inline comment!" if data.blank? # for debug
return data[:actual] unless data[:actual].nil?
return false if diff.nil?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parse_projects_platforms
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def self.parse_projects_platforms(advisory, pr)
pr ||= {}
if !pr.is_a?(Hash)
advisory.errors.add(:base, "Projects is not a hash")
return {}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method find
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def find
build_lists = @project ? @project.build_lists : BuildList.all
if @options[:id]
build_lists = build_lists.where(id: @options[:id])
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method autostart_build_lists
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.autostart_build_lists(autostart_status)
Project.where(autostart_status: autostart_status).find_each do |p|
p.project_to_repositories.autostart_enabled.includes(repository: :platform).each do |p_to_r|
repository = p_to_r.repository
user = User.find(p_to_r.user_id)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method create
has 59 lines of code (exceeds 25 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
Class Collaborator
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Collaborator
include ActiveModel::Conversion
include ActiveModel::Validations
include ActiveModel::Serializers::JSON
extend ActiveModel::Naming
Method create_notifications
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_notifications(record)
case record.class.to_s
when 'GitHook'
return unless record.project
Method run_mass_import
has 58 lines of code (exceeds 25 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?)
Method abf_worker_args
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def abf_worker_args
repos = include_repos
include_repos_hash = {}.tap do |h|
Repository.where(id: (repos | (extra_repositories || [])) ).each do |repo|
path, prefix = repo.platform.public_downloads_url(
Method perform
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.perform(build_list_id, user_id, project_ids, arch_ids, options)
build_list = BuildList.find(build_list_id)
return if build_list.save_to_platform.personal?
user = User.find(user_id)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method publish
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def publish
@build_list.update_type = params[:build_list][:update_type] if params[:build_list][:update_type].present?
if params[:attach_advisory].present? and params[:attach_advisory] != 'no' and !@build_list.advisory
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Class Repository
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Repository < ActiveRecord::Base
extend FriendlyId
friendly_id :name, use: [:finders]
include EventLoggable
Class PullRequest
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class PullRequest < ActiveRecord::Base
STATUSES = [
STATUS_OPEN = 'open',
STATUS_READY = 'ready',
STATUS_ALREADY = 'already',
Method perform
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def perform
return if status == STARTED # do nothing when publication started
extra = options['extra']
repository_status = RepositoryStatus.where(id: extra['repository_status_id']).first
begin
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method allowed?
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def self.allowed?(path, token)
platform_name = path.gsub(/^[\/]+/, '')
.match(/^(#{NAME_PATTERN}\/|#{NAME_PATTERN}$)/)
return true unless platform_name
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"