Showing 326 of 426 total issues
Method parse_predicate
has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring. Open
def parse_predicate(root, stack)
# logger.debug "------------------ predicate ---------------"
# logger.debug "-- pred_array: #{stack.inspect} --"
raise IllegalXpathError, 'invalid predicate' if stack.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
Class Request
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Request < Base
self.description = 'Request updated'
self.abstract_class = true
payload_keys :author, :comment, :description, :id, :number, :actions, :state, :when, :who, :namespace
shortenable_key :description
Method revoke_requests
has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring. Open
def revoke_requests
# Find open requests involving self and:
# - revoke them if self is source
# - decline if self is target
# Note: As requests are a backend matter, it's pointless to include them into the transaction below
- 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_ldap
has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring. Open
def find_with_ldap(login, password)
Rails.logger.debug { "UserLdapStrategy: Searching for user '#{login}'" }
# When the server closes the connection, @@ldap_search_con.nil? doesn't catch it
# @@ldap_search_con.bound? doesn't catch it as well. So when an error occurs, we
- 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 package_command
has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring. Open
def package_command
params[:user] = User.session.login
raise MissingParameterError, 'POST request without given cmd parameter' unless params[:cmd]
- 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 call
has a Cognitive Complexity of 23 (exceeds 8 allowed). Consider refactoring. Open
def call(env)
logger = Rails.logger
GC.start
before = `ps -orss= -p#{$PROCESS_ID}`.to_i
file = File.new("/tmp/memprof-#{$PROCESS_ID}.log", 'w')
- 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_ldap
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_with_ldap(login, password)
Rails.logger.debug { "UserLdapStrategy: Searching for user '#{login}'" }
# When the server closes the connection, @@ldap_search_con.nil? doesn't catch it
# @@ldap_search_con.bound? doesn't catch it as well. So when an error occurs, we
Method create_branch_packages
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_branch_packages(tprj)
# collect also the needed repositories here
response = nil
@packages.each do |p|
raise CanNotBranchPackage, "project is developed at #{p[:link_target_project].scmsync}. Fork it instead." if p[:link_target_project].try(:scmsync).present?
Class StagedRequests
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Staging::StagedRequests
include ActiveModel::Model
attr_accessor :request_numbers, :staging_project, :staging_workflow, :user_login
def create
Method project_command_copy
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def project_command_copy
project_name = params[:project]
@project = Project.find_by_name(project_name)
raise CmdExecutionNoPermission, "no permission to execute command 'copy'" unless (@project && User.session.can_modify?(@project)) ||
Method search
has a Cognitive Complexity of 22 (exceeds 8 allowed). Consider refactoring. Open
def search(what, render_all)
if render_all && params[:match].blank?
render_error status: 400, errorcode: 'empty_match',
message: 'No predicate found in match argument'
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 owner_packages_or_projects
has a Cognitive Complexity of 22 (exceeds 8 allowed). Consider refactoring. Open
def owner_packages_or_projects
return if params[:project].blank? && params[:package].blank?
if params[:package].present?
if params[:project].blank?
- 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_binary_releases_for_repository
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_binary_releases_for_repository(repository, new_binary_releases, time = Time.now)
# building a hash to avoid single SQL select calls slowing us down too much
old_binary_releases = {}
BinaryRelease.transaction do
repository.binary_releases.current.unchanged.find_each do |binary|
Method find_packages_to_branch
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_packages_to_branch
@packages = []
if params[:request]
# find packages from request
req = BsRequest.find_by_number(params[:request])
Method call
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
logger = Rails.logger
GC.start
before = `ps -orss= -p#{$PROCESS_ID}`.to_i
file = File.new("/tmp/memprof-#{$PROCESS_ID}.log", 'w')
Class ApplicationController
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
include Pundit::Authorization
protect_from_forgery
include ActionController::ImplicitRender
Method execute_accept
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute_accept(opts)
# create package unless it exists already
target_project = Project.get_by_name(self.target_project)
# FIXME: when this code is moved to conditional assigment, it causes ambiguity between target_package and self.target_package.
Method set_permissions_for_action
has a Cognitive Complexity of 21 (exceeds 8 allowed). Consider refactoring. Open
def set_permissions_for_action(action, new_state = nil)
# general write permission check on the target on accept
@write_permission_in_this_action = false
# all action types need a target project in any case for accept
- 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 to_xml
has a Cognitive Complexity of 21 (exceeds 8 allowed). Consider refactoring. Open
def to_xml(project, package)
self.issues = []
issueid.to_a.each_with_index do |new_issue, index|
issues << [
new_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 instantiate_container
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
def instantiate_container(project, opackage, opts = {})
opkg = opackage.origin_container
pkg_name = opkg_name = opkg.name
if opkg.is_a?(Package) && opkg.project.is_maintenance_release?
# strip incident suffix