Showing 55 of 93 total issues
Method create_activity
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_activity(object, symbol, old_value, new_value, activity_params)
Method ldap_add_members!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ldap_add_members!
Rails.logger.tagged(:ldap) { Rails.logger.info "Looking up an LDAP group matching '#{name}'" }
portus_user = User.portus
usernames = users.map(&:username)
- 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 get_namespace_from_event
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_namespace_from_event(event, fetch_tag = true)
repo = event["target"]["repository"]
if repo.include?("/")
namespace_name, repo = repo.split("/", 2)
namespace = namespaces.find_by(name: namespace_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 ready
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.ready
return ["no registry configured", false] unless ::Registry.any?
res = ::Registry.get.client.reachable?
["registry is#{res ? "" : " not"} reachable", res]
- 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 authorize_scopes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def authorize_scopes(registry)
scopes = Array(Rack::Utils.parse_query(request.query_string)["scope"])
return if scopes.empty?
auth_scopes = {}
- 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 execute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def execute(repository)
raise ActiveRecord::RecordNotFound if repository.nil?
mark_for_deletion!(repository)
tags_destroyed = destroy_tags(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 session_flash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def session_flash(user, method)
# First of all we've got a greeting.
if method.nil?
flash[:notice] = "Welcome!"
else
- 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 make_valid
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.make_valid(name)
# One common case is LDAP and case sensitivity. With this in mind, try to
# downcase everything and see if now it's fine.
name = name.downcase
- 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 handle_push_event
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.handle_push_event(event)
registry = Registry.find_from_event(event)
return if registry.nil?
namespace, = Namespace.get_from_repository_name(event["target"]["repository"], registry)
- 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 can_disable?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def can_disable?(user)
# The "portus" user can never be disabled.
return false if user.portus?
if self == 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 owner
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def owner
raise Pundit::NotAuthorizedError, "must be an admin" if cannot_set_owner?
if params[:owner_id]
user = User.find_by(id: params[:owner_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 update_registry!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_registry!(catalog)
dangling_repos = Repository.all.pluck(:id)
# In this loop we will create/update all the repos from the catalog.
# Created/updated repos will be removed from the "repos" array.
- 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_tags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.update_tags(client, repository, portus, tags)
tags.each do |tag|
# Try to fetch the manifest digest of the tag.
begin
manifest = client.manifest(repository.full_name, tag)
- 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 check!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check!
return unless @valid
check_hostname!
return unless @valid
- 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 attempt_destroy!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def attempt_destroy!(namespace)
return false if personal_namespace?(namespace)
return false unless destroy_repositories!(namespace)
destroyed = namespace.delete_by!(current_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 should_handle?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.should_handle?(event)
unless relevant?(event)
Rails.logger.debug "Event discarded because it's not relevant"
return false
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 render_namespace
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def render_namespace(activity)
tr = activity.trackable
if tr.nil? || tr.is_a?(Namespace) || tr.is_a?(Registry)
if activity.parameters[:namespace_name].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 check_user
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_user
data = omniauth_data
unless data
redirect_to new_user_session_url
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 check
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.check
success = true
results = CHECKS.map do |c|
ready, s = c.ready
next if ready.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 enabled?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def enabled?
if APP_CONFIG.enabled?("background.sync")
strategy = APP_CONFIG["background"]["sync"]["strategy"]
if strategy == "initial" && Repository.any?
Rails.logger.info "`#{self}` was disabled because strategy is set to " \
- 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"