Showing 235 of 235 total issues
Class has too many lines. [195/100] Open
class Base
include DoNothingActiveRecordMethods
include TemplateMethods
extend Queries
extend AliasAttribute
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class has too many lines. [123/100] Open
class MockCreator
using ActiveMocker::Inspectable
ENABLED_PARTIALS_DEFAULT = [
:mock_build_version,
:modules_constants,
- Read upRead up
- Exclude checks
This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Module has too many lines. [119/100] Open
module Queries
extend LateInclusion
class Find
def initialize(record)
- Read upRead up
- Exclude checks
This cop checks if the length a module exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Class Base
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
class Base
include DoNothingActiveRecordMethods
include TemplateMethods
extend Queries
extend AliasAttribute
Assignment Branch Condition size for process_attr is too high. [32.34/15] (http://c2.com/cgi/wiki?AbcMetric) Open
def process_attr(attr)
enums = enums(attr.name)
attr.default = Virtus::Attribute.build(attr.type).coerce(attr.default)
attr.attribute_writer = "write_attribute(:#{attr.name}, val)"
attr.attribute_reader = "read_attribute(:#{attr.name})"
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [26/10] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
def process_attr(attr)
enums = enums(attr.name)
attr.default = Virtus::Attribute.build(attr.type).coerce(attr.default)
attr.attribute_writer = "write_attribute(:#{attr.name}, val)"
attr.attribute_reader = "read_attribute(:#{attr.name})"
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for partials is too high. [25.2/15] (http://c2.com/cgi/wiki?AbcMetric) Open
def partials
OpenStruct.new(enabled_partials.each_with_object({}) do |p, hash|
begin
file = File.new(File.join(File.dirname(__FILE__), "mock_template/_#{p}.erb"))
extend(ActiveMocker::MockCreator.const_get(p.to_s.camelize))
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [20/10] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
def create_method(m, type)
plural_type = (type.to_s + "s").to_sym
if safe_method?(type, m)
def_type = type == :method ? :class_defs : :defs
def_method = class_introspector.parsed_source.public_send(def_type).detect { |meth| meth.name == m }
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [20/10] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
def __am_raise_not_mocked_error(method:, caller:, type:)
variable_name, klass, method_type = if is_a?(Relation)
klass = self.class.name.underscore.split("/").first
["#{klass}_relation", klass.camelize, :scopes]
elsif type == "#"
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for get_module_by_reference is too high. [24.54/15] (http://c2.com/cgi/wiki?AbcMetric) Open
def get_module_by_reference(type)
isolated_module_names = reject_local_const(class_introspector.public_send(type)).map(&:referenced_name)
real_module_names = get_real_module(type).map(&:name).compact
isolated_module_names.map do |isolated_name|
real_name = real_module_names.detect do |rmn|
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for create_method is too high. [23.69/15] (http://c2.com/cgi/wiki?AbcMetric) Open
def create_method(m, type)
plural_type = (type.to_s + "s").to_sym
if safe_method?(type, m)
def_type = type == :method ? :class_defs : :defs
def_method = class_introspector.parsed_source.public_send(def_type).detect { |meth| meth.name == m }
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [18/10] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
def partials
OpenStruct.new(enabled_partials.each_with_object({}) do |p, hash|
begin
file = File.new(File.join(File.dirname(__FILE__), "mock_template/_#{p}.erb"))
extend(ActiveMocker::MockCreator.const_get(p.to_s.camelize))
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [16/10] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
def build(db_value_type:, table_name:, attribute:, enums:, ignore_value: false)
klass = Class.new(ActiveMocker::AttributeTypes::Enum)
klass.table_name = table_name.to_sym
klass.attribute = attribute.to_sym
klass.ignore_value = ignore_value
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [14/10] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
def get_module_by_reference(type)
isolated_module_names = reject_local_const(class_introspector.public_send(type)).map(&:referenced_name)
real_module_names = get_real_module(type).map(&:name).compact
isolated_module_names.map do |isolated_name|
real_name = real_module_names.detect do |rmn|
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Assignment Branch Condition size for associations_by_class is too high. [19.1/15] (http://c2.com/cgi/wiki?AbcMetric) Open
def associations_by_class
schema_scrapper.associations.to_a.each_with_object({}) do |r, hash|
hash[r.class_name.to_s] ||= {}
hash[r.class_name.to_s][r.type] ||= []
hash[r.class_name.to_s][r.type] << r.name
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for __am_raise_not_mocked_error is too high. [19.42/15] (http://c2.com/cgi/wiki?AbcMetric) Open
def __am_raise_not_mocked_error(method:, caller:, type:)
variable_name, klass, method_type = if is_a?(Relation)
klass = self.class.name.underscore.split("/").first
["#{klass}_relation", klass.camelize, :scopes]
elsif type == "#"
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [14/10] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
def self.build_from(object: nil, exception: nil, class_name: nil, type: nil)
if object
args = [:message, :original_error, :level, :type, :class_name].each_with_object({}) do |meth, hash|
hash[meth] = object.public_send(meth) if object.respond_to? meth
end
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [13/10] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
def enums(attribute)
@enums ||= begin
raw_enums = class_introspector
.class_macros
.select { |hash| hash.key?(:enum) }
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method build_from
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.build_from(object: nil, exception: nil, class_name: nil, type: nil)
if object
args = [:message, :original_error, :level, :type, :class_name].each_with_object({}) do |meth, hash|
hash[meth] = object.public_send(meth) if object.respond_to? meth
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 has too many lines. [12/10] (https://github.com/bbatsov/ruby-style-guide#short-methods) Open
def initialize(file:,
file_out:,
schema_scrapper:,
template_creator: nil,
class_introspector: nil,
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.