Showing 308 of 5,717 total issues
Class Account
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
class Account < Drops::Model
info %{
A developer account. See `User` drop if you are looking for the email addresses or similar information.
}
File account.rb
has 403 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Account < ApplicationRecord
attribute :credit_card_expires_on, :date
self.ignored_columns = %i[proxy_configs_file_name proxy_configs_content_type proxy_configs_file_size
proxy_configs_updated_at proxy_configs_conf_file_name proxy_configs_conf_content_type
proxy_configs_conf_file_size proxy_configs_conf_updated_at]
Method error_messages_for
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def error_messages_for(*params)
ignore_me = ['Account is invalid', 'Bought cinstances is invalid']
options = params.extract_options!.symbolize_keys
objects = if object = options.delete(:object)
- 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
File 20100125103539_browser_cms_tables.rb
has 398 lines of code (exceeds 250 allowed). Consider refactoring. Open
class BrowserCmsTables < ActiveRecord::Migration
def self.up
create_table "attachment_versions", :force => true do |t|
t.integer "attachment_id"
t.integer "version"
File user.rb
has 389 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'digest/sha1'
class User < ApplicationRecord
include Symbolize
Class Application
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Application < Drops::Contract
drop_example "Using application drop in liquid.", %{
<h1>Application {{ application.name }} (<span title="Application ID">{{ application.application_id }}</span>)</h1>
<p>{{ application.description }}</p>
}
Method up
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.up
create_table :blogs do |t|
t.string :name
t.string :format
t.text :template
Class BillingStrategy
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Finance::BillingStrategy < ApplicationRecord
module NonAuditedColumns
def non_audited_columns
super - [inheritance_column]
end
Method charge!
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def charge!(automatic = true)
ensure_payable_state!
unless chargeable?
logger.info "Not charging invoice #{id} (buyer #{buyer_account_id}), reason: #{reason_cannot_charge}"
- 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 clause
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def clause(*args)
model = (args.length >= 2 ? args[0] : nil)
is_delta = (args.length >= 2 ? args[1] : args[0]) || false
table_name = (model.nil? ? adapter.quoted_table_name : model.quoted_table_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
Class NotificationMailer
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class NotificationMailer < ActionMailer::Base
default from: Rails.configuration.three_scale.notification_email
layout 'notification_email'
Method down
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.down
create_table "credit_transactions", :force => true do |t|
t.integer "account_id"
t.string "kind", :default => "incoming"
t.string "currency", :default => "EUR", :null => false
Method to_xml
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def to_xml(options = {})
xml = options[:builder] || ThreeScale::XML::Builder.new
xml.status do |xml|
xml.plan(plan_name) if plan_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
Class Urls
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class Urls < Drops::Base
allowed_name :urls
attr_reader :provider
protected :provider
File cinstance.rb
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Cinstance < Contract
include SaveDestroyForServiceAssociation
# Maximum number of cinstances permitted between provider and buyer
MAX = 10
Method to_xml
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def to_xml(options = {})
result = options[:builder] || ThreeScale::XML::Builder.new
result.application do |xml|
unless new_record?
- 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 Metric
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Metric < ApplicationRecord
include Backend::ModelExtensions::Metric
include SystemName
include BackendApiLogic::MetricExtension
include Searchable
File notification_mailer.rb
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
class NotificationMailer < ActionMailer::Base
default from: Rails.configuration.three_scale.notification_email
layout 'notification_email'
File plan.rb
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Plan < ApplicationRecord
include Searchable
class PeriodRangeCalculationError < StandardError; end
include Symbolize
Class EmailTemplate
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class CMS::EmailTemplate < CMS::Template
validates :system_name, presence: true
validates :current, presence: true
validates :system_name, uniqueness: { scope: %i[provider_id], allow_blank: true, case_sensitive: true }