Showing 307 of 5,713 total issues
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 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 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 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 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"
Class Configuration
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Configuration
include Enumerable
HARDWIRED_DEFAULTS = {
Class UserTracking
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class UserTracking
error_handler = ->(status, error) do
System::ErrorReporting.report_error(error_message: error, parameters: { status: status })
end
Class Invoice
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Invoice < Drops::Model
allowed_name :invoice, :invoices
example %{
Class User
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class User < Drops::Model
allowed_name :user, :users
drop_example %{
<h1>User {{ user.display_name }}</h1>
Function disableInterface
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
function disableInterface(){
function enable_checkboxes(){
checkboxes_disabled(false);
}
Method extract_range_and_granularity
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def extract_range_and_granularity(options)
if options[:period]
period = sanitize_period(options[:period])
granularity = options[:granularity] || GRANULARITIES[period]
length = 1.send(period)
- 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 Provider
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Provider < Drops::Base
example %(
<div>Domain {{ provider.domain }}</div>
File provider_steps.rb
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
def import_simple_layout(provider)
simple_layout = SimpleLayout.new(provider)
simple_layout.import_pages!
simple_layout.import_js_and_css! if @javascript
end
Class InvoiceReportData
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Pdf::Finance::InvoiceReportData
LINE_ITEMS_HEADING = %w[Name Quantity Cost Charged].freeze
DATE_FORMAT = "%e %B, %Y"
LOGO_ATTACHMENT_STYLE = :invoice