Showing 55 of 93 total issues
File entities.rb
has 464 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "api/helpers"
module API
# Entities is a module that groups all the classes to be used as Grape
# entities.
Class User
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ApplicationRecord
include PublicActivity::Common
enum ldap_status: { unchecked: 0, checked: 1, disabled: 2 }
File teams.rb
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
module API
module V1
class Teams < Grape::API
include PaginationParams
include OrderingParams
Method get_repo_link_tag
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_repo_link_tag(activity)
tr = activity.trackable
if tr.nil? || tr.is_a?(Registry)
if repo_name(activity).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 execute!
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def execute!
digests = []
Tag.where(scanned: Tag.statuses[:scan_none]).find_each do |tag|
# This may happen when pushing multiple images with the same digest at
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def self.ready
server = APP_CONFIG["security"]["clair"]["server"]
return [nil, false] if server.blank?
uri = URI.join(health_endpoint(server), "/health")
- 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_group
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_group(name)
return [] if APP_CONFIG.disabled?("ldap")
connection = initialized_adapter
options = search_options_for(filter: "(cn=#{name})", attributes: %w[member uniqueMember])
- 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 layer_vulnerabilities
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def layer_vulnerabilities(digest)
layer = fetch_layer(digest)
return [] if layer.nil?
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 check_account
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_account(account)
if account == "portus"
@reason = "Portus user does not go through LDAP"
false
elsif @username.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 ldap_add_as_member!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def ldap_add_as_member!
Rails.logger.tagged(:ldap) do
Rails.logger.info "Looking up an LDAP group membership for '#{username}'"
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 create
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create
@user = User.create(user_create_params)
respond_to do |format|
if @user.persisted?
- 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 guess_email
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def guess_email(connection, configuration)
cfg = APP_CONFIG["ldap"]["guess_email"]
return if cfg.nil? || !cfg["enabled"]
record = search_admin_or_user(connection, configuration)
- 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 github_member?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def github_member?(conf)
if conf["team"].present?
# Get user's teams.
is_member = member_of("https://api.github.com/user/teams") do |t|
t["name"] == conf["team"] &&
- 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_users!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_users!
logins = Set.new
while logins.size < NUSERS
first_name = FFaker::Name.first_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 check_membership
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_membership
conf = APP_CONFIG["oauth"][action_name]
case action_name
when "github"
- 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 authenticate!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def authenticate!
fill_user_params!
cfg = ::Portus::LDAP::Configuration.new(params)
if cfg.enabled?
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def self.ready
if APP_CONFIG.enabled?("ldap")
ldap = initialized_adapter
ldap.bind ? ["LDAP server is reachable", true] : [error_message(ldap), false]
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 render_repository_information
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def render_repository_information(repository)
user = current_user
content_tag(:ul) do
concat content_tag(:li, "You can push images") if can_push?(repository.namespace, 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 change_description
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def change_description(object, symbol, old_description, new_description, activity_params)
Method create_activity
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_activity(object, symbol, old_value, new_value, activity_params)