Showing 8 of 8 total issues
Method run
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def run
app, config = @app, @app.config
return unless app.tenants_assets
app.tenants_assets.each do |tenant, tenant_assets|
- 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 model_names
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.model_names
[ Spree::Activator,
Spree::Address,
Spree::Adjustment,
Spree::Asset,
Method initialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user)
if user.super_admin? && user.has_spree_role?(:admin)
can :manage, Spree::Tenant
can :grant_super_admin, Spree::User
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 find_target_tenant
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def find_target_tenant(request)
domain_tenant = Spree::Tenant.find_by_domain(request.domain)
subdomain_tenant = nil
shortname = request.subdomains.first
- 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 preference_cache_key
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def preference_cache_key(name)
return unless id
if self.class.column_names.include?('tenant_id')
[tenant_id, self.class.name, name, id].join('::').underscore
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 asset_digests
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def asset_digests
if Spree::Tenant.current_tenant_id && Rails.application.tenants_assets && Rails.application.tenants_assets[Spree::Tenant.current_tenant.shortname]
Rails.application.tenants_digests[Spree::Tenant.current_tenant.shortname]
elsif Rails.application.config.current_tenant_name
Rails.application.tenants_digests[Rails.application.config.current_tenant_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 asset_prefix
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def asset_prefix
if Spree::Tenant.current_tenant_id && Rails.application.tenants_assets && Rails.application.tenants_assets[Spree::Tenant.current_tenant.shortname]
"/tenants/#{Spree::Tenant.current_tenant.shortname}#{Rails.application.config.assets.prefix}"
elsif Rails.application.config.current_tenant_name
"/tenants/#{Rails.application.config.current_tenant_name}#{Rails.application.config.assets.prefix}"
- 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 asset_environment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def asset_environment
if Spree::Tenant.current_tenant_id && Rails.application.tenants_assets && Rails.application.tenants_assets[Spree::Tenant.current_tenant.shortname]
Rails.application.tenants_assets[Spree::Tenant.current_tenant.shortname]
elsif Rails.application.config.current_tenant_name
Rails.application.tenants_assets[Rails.application.config.current_tenant_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"