Showing 5,377 of 5,713 total issues
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 }
Class Report
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Report
include Printer
attr_accessor :account, :period, :pdf, :service, :report
File billing_strategy.rb
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Finance::BillingStrategy < ApplicationRecord
module NonAuditedColumns
def non_audited_columns
super - [inheritance_column]
end
Method create_builtin_pages_and_partials!
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_builtin_pages_and_partials!
p = provider.builtin_pages
# Shared
create_builtin_partial!('field')
Class MailPreview
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class MailPreview < MailView
FakeContract = Struct.new(:id, :old_plan, :plan, :provider_account, :service, :account, :name)
def application_created
event = Applications::ApplicationCreatedEvent.create(Cinstance.last, User.last)
Method headers_formats
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def headers_formats
headers.to_hash.dup.each do |name, value|
field = "headers.#{name}"
next if value.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 search
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def search
puts 'Searching for invalid data'
Account.providers.find_each do |p|
- 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 22 (exceeds 5 allowed). Consider refactoring. Open
def to_xml(options = {})
#TODO: use Nokogiri builder
xml = options[:builder] || ThreeScale::XML::Builder.new
xml.account do |xml|
- 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 selector_for
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def selector_for(scope) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength
case scope
#
# Page sections
Method provider_request
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
def provider_request
return unless provider?
hourly(&:group)
Method assign_drops
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def assign_drops drops
assigns = (@_assigned_drops ||= {})
drops.stringify_keys.each do |name, drop|
next if drop.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 up
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.up
create_table "forums", :force => true do |t|
t.integer "site_id"
t.string "name"
t.string "description"