Showing 34 of 96 total issues
File processing_queries.rb
has 569 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'active_support/core_ext/array/wrap'
module Sipity
module Queries
# Welcome intrepid developer. You have stumbled into some complex data
- Create a ticketCreate a ticket
Method scope_processing_entities_for_the_user_and_proxy_for_type
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scope_processing_entities_for_the_user_and_proxy_for_type(criteria:)
proxy_for_type = PowerConverter.convert(criteria.proxy_for_type, to: :polymorphic_type)
entities = Models::Processing::Entity.arel_table
strategy_state_actions = Models::Processing::StrategyStateAction.arel_table
- Create a ticketCreate a ticket
Class WorkEmailDecorator
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class WorkEmailDecorator
def initialize(work, repository: default_repository)
self.work = work
self.repository = repository
end
- Create a ticketCreate a ticket
Function add_to_section_list
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
add_to_section_list: function( event ) {
event.preventDefault();
var $activeField = $('.repeat:last', this.element), // Assume we are always working with the bottom-most row
$activeFieldControls = $activeField.children('.row-controls'),
- Create a ticketCreate a ticket
Method configure
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.configure(form_class:, base_class:, attribute_names:, **keywords)
processing_form_class = self
form_class.module_exec do
class_attribute(:attribute_names, instance_writer: :false) unless respond_to?(:attribute_names=)
self.attribute_names = Array.wrap(attribute_names)
- Read upRead up
- Create a ticketCreate a ticket
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 AttachmentsExtension
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class AttachmentsExtension
def initialize(form:, repository:, **args)
self.form = form
self.repository = repository
self.files = args[:files] || {}
- Create a ticketCreate a ticket
Class CoreConverter
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class CoreConverter
DEFAULT_ROF_TYPE = 'fobject'.freeze
def initialize(work:, repository: default_repository, attachment_converter: default_attachment_converter)
self.work = work
self.repository = repository
- Create a ticketCreate a ticket
Class ActionTakenOnEntity
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class ActionTakenOnEntity
def self.register(**keywords)
new(**keywords).register
end
- Create a ticketCreate a ticket
Method convert_to_year
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def convert_to_year(input)
return input if input.is_a?(Integer)
return input.to_year if input.respond_to?(:to_year)
return input.year if input.respond_to?(:year)
return convert_to_year(input.to_date) if input.respond_to?(:to_date)
- Read upRead up
- Create a ticketCreate a ticket
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 configure
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.configure(form_class:, base_class:, attribute_names:, **keywords)
processing_form_class = self
form_class.module_exec do
class_attribute(:attribute_names, instance_writer: :false) unless respond_to?(:attribute_names=)
self.attribute_names = Array.wrap(attribute_names)
- Create a ticketCreate a ticket
Method scope_users_for_entity_and_roles
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scope_users_for_entity_and_roles(entity:, roles:)
entity = Conversions::ConvertToProcessingEntity.call(entity)
role_ids = Array.wrap(roles).map { |role| Conversions::ConvertToRole.call(role).id }
group_polymorphic_type = PowerConverter.convert(Models::Group, to: :polymorphic_type)
user_polymorphic_type = PowerConverter.convert(User, to: :polymorphic_type)
- Create a ticketCreate a ticket
Method call
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def call
create_the_strategy_action!
if config.key?(:attributes)
action_attributes = config.fetch(:attributes).stringify_keys
- Read upRead up
- Create a ticketCreate a ticket
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 call
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call
create_the_strategy_action!
if config.key?(:attributes)
action_attributes = config.fetch(:attributes).stringify_keys
- Create a ticketCreate a ticket
Method scope_permitted_entity_strategy_actions_for_current_state
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scope_permitted_entity_strategy_actions_for_current_state(user:, entity:)
action_scope = scope_permitted_without_concern_for_repetition_entity_strategy_actions_for_current_state(user: user, entity: entity)
entity = Conversions::ConvertToProcessingEntity.call(entity)
actor = Conversions::ConvertToProcessingActor.call(user)
- Create a ticketCreate a ticket
Method scope_actors_associated_with_entity_and_role
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def scope_actors_associated_with_entity_and_role(entity:, role:)
entity = Conversions::ConvertToProcessingEntity.call(entity)
role = Conversions::ConvertToRole.call(role)
strategy_roles = Models::Processing::StrategyRole.arel_table
strategy_responsibilities = Models::Processing::StrategyResponsibility.arel_table
- Create a ticketCreate a ticket
Method build
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.build(mailer_suffix, &block)
builder = new
builder.instance_exec(&block) if block_given?
the_mailer_name = File.join('sipity/mailers', "#{mailer_suffix.to_s.underscore}_mailer")
- Create a ticketCreate a ticket
Function queryLdap
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function queryLdap(){
var $button = $('#people-search-button'),
$icon = $button.find('i'),
query = $('#submission_window_advisor_name').val(),
api = "//www3.nd.edu/~webdev/utilities/ldap/?callback=?",
- Create a ticketCreate a ticket
Function add_to_list
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
add_to_list: function( event ) {
event.preventDefault();
var $activeField = $(event.target).parents('.field-wrapper'),
$activeFieldControls = $activeField.children('.field-controls'),
- Create a ticketCreate a ticket
Method convert_to_processing_action
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def convert_to_processing_action(object, scope:)
strategy_id = ConvertToProcessingStrategyId.call(scope)
if object.is_a?(Models::Processing::StrategyAction)
return object if object.strategy_id == strategy_id
elsif object.respond_to?(:to_processing_action)
- Read upRead up
- Create a ticketCreate a ticket
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 collaborators_that_have_taken_the_action_on_the_entity
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def collaborators_that_have_taken_the_action_on_the_entity(entity:, actions:)
entity = Conversions::ConvertToProcessingEntity.call(entity)
collaborators = Models::Collaborator.arel_table
users = User.arel_table
users_scope = users_that_have_taken_the_action_on_the_entity(entity: entity, actions: actions)
- Create a ticketCreate a ticket