Showing 342 of 433 total issues
Method set_parameters
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def set_parameters
@search_attrib_type_id = nil
@search_attrib_type_id = params[:attrib_type_id] if params[:attrib_type_id].present?
search_issue
- 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_with_credentials_via_ldap
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def self.find_with_credentials_via_ldap(login, password)
user = find_by_login(login)
ldap_info = nil
return user.authenticate_via_password(password) if user.try(:ignore_auth_services?)
- 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 delete_project_pubkey
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def delete_project_pubkey
params[:user] = User.session!.login
path = pubkey_path
# check for permissions
- 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 sources_changed
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def sources_changed(opts = {})
dir_xml = opts[:dir_xml]
# to call update_activity before filter
# NOTE: We need `Time.now`, otherwise the old tests suite doesn't work,
- 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 has_local_role?
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def has_local_role?(role, object)
if object.is_a?(Package) || object.is_a?(Project)
logger.debug "running local role package check: user #{login}, package #{object.name}, role '#{role.title}'"
rels = object.relationships.where(role_id: role.id, user_id: id)
return true if rels.exists?
- 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 lookup_package_owner
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def lookup_package_owner(package)
return nil if @already_checked[package.id]
@already_checked[package.id] = 1
@lookup_limit -= 1
- 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 kerberos_auth
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def kerberos_auth
return true unless CONFIG['kerberos_mode'] && !User.session
authorization = authenticator.authorization_infos || []
if authorization[0].to_s == 'Negotiate'
- 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 user_with_realname_and_icon
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def user_with_realname_and_icon(user, opts = {})
defaults = { short: false, no_icon: false }
opts = defaults.merge(opts)
user = User.find_by_login(user) unless user.is_a?(User)
- 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 extract_krb_user
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def extract_krb_user(authorization)
unless authorization[1]
Rails.logger.debug "Didn't receive any negotiation data."
raise_and_invalidate(authorization, 'GSSAPI negotiation failed.')
end
- 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_build_log
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def update_build_log
# Make sure objects don't contain invalid chars (eg. '../')
@repo = @project.repositories.find_by(name: params[:repository]).try(:name)
unless @repo
@errors = "Couldn't find repository '#{params[:repository]}'. We don't have build log for this repository"
- 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 issues_hash
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def issues_hash(sourcediff)
ret = {}
sourcediff.get('issues').elements('issue') do |issue|
next unless issue['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"
Further reading
Method put_or_post
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def self.put_or_post(method, path, data, in_headers)
start_time = Time.now
Rails.logger.debug { "[backend] #{method}: #{path}" }
timeout = in_headers.delete('Timeout')
backend_request = if method == 'PUT'
- 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 a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def create
authorize @package, :update?
files = params[:files] || []
filename = params[:filename]
- 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 notifiable_link_text
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def notifiable_link_text
case @notification.event_type
when 'Event::RequestStatechange', 'Event::RequestCreate', 'Event::ReviewWanted'
"#{helpers.request_type_of_action(@notification.notifiable)} Request ##{@notification.notifiable.number}"
when 'Event::CommentForRequest'
- 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
Avoid too many return
statements within this method. Open
return has_local_permission?(perm_string, parent)
Avoid too many return
statements within this method. Open
return true if lookup_strategy.local_permission_check(roles, object)
Method init
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def init
abort('Not possible to locate options.yml or database.yml. Please execute this script in your open-build-service directory.') unless File.exist?(@options_path) || File.exist?(@database_path)
# There is only the filename given
abort('No parameters, use --help') if @params.count == 1
- 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 load_from_xml
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def load_from_xml(patchinfo_xml)
self.binaries = []
patchinfo_xml.elements('binary').each do |binaries|
self.binaries << binaries
end
- 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 extend_relation
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def extend_relation(source_or_target, requests, roles, package, subprojects, project, inner_or)
if roles.empty? || roles.include?(source_or_target)
inner_or << if package.blank?
if subprojects.blank?
"bs_request_actions.#{source_or_target}_project=#{quote(project)}"
- 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 branch
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def branch
#
# 1) BaseProject <-- 2) UpdateProject <-- 3) DevelProject/Package
# X) BranchProject
#
- 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"