Showing 23 of 591 total issues
Class User
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
has_paper_trail class_name: "C2Version"
validates :client_slug, inclusion: {
in: ->(_) { Proposal.client_slugs },
Class WorkOrder
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class WorkOrder < ActiveRecord::Base
# must define before include PurchaseCardMixin
def self.purchase_amount_column_name
:amount
end
Class ProposalsController
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class ProposalsController < ApplicationController
include TokenAuth
skip_before_action :authenticate_user!, only: [:approve, :complete]
skip_before_action :check_disabled_client, only: [:approve, :complete]
Class Procurement
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Procurement < ActiveRecord::Base
URGENCY = {
10 => "I need it yesterday",
20 => "I'm patient but would like w/in a week",
30 => "Whenever",
Class ApplicationController
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
include Pundit
include ReturnToHelper
include MarkdownHelper
Function ListConfig
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ListConfig() {
var config = [
{
targets: "th-value-id"
},
Class ClientDataController
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ClientDataController < ApplicationController
include TokenAuth
before_action -> { authorize model_class }, only: [:new, :create]
before_action -> { authorize proposal }, only: [:edit, :update]
before_action :build_client_data_instance, only: [:new, :create]
Class Event
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Event < ActiveRecord::Base
URGENCY = {
10 => "I need it yesterday",
20 => "I'm patient but would like w/in a week",
30 => "Whenever"
Class ProposalSearchDsl
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class ProposalSearchDsl
include Elasticsearch::DSL
attr_reader :params, :current_user, :query_str, :client_data_type
Class Dispatcher
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Dispatcher
def initialize(proposal)
@proposal = proposal
end
Class ProposalListingQuery
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ProposalListingQuery
attr_reader :params, :relation, :user
def initialize(user, params, proposals = Proposal.all)
@params = params
Class ProposalPolicy
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ProposalPolicy
include ExceptionPolicy
def initialize(user, record)
super(user, record)
Method to_h
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def to_h
hash = {}
if field_pairs
field_pairs.each do |k, v|
next if v.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 to_s
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def to_s
clauses = []
if field_pairs
field_pairs.each do |k, v|
next if v.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
Function _setup
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
ListViewDataTable.prototype._setup = function(){
var self = this;
this.addThClass();
this.setListViewConfig();
if( this.el.length > 0 ){
Function _events
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
ListViewDataTable.prototype._events = function(){
var self = this;
this.el.on('dataTableView:canceled', function(){
self.viewCanceled();
Method update_step_via_status
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def update_step_via_status
step_params = params.require(:step)
step = resource
if step_params[:status] == "completed"
if step_params[:completer_id].empty?
- 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 role_ids_to_roles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def role_ids_to_roles
roles = []
role_id_params.each do |id|
next unless id.present?
role = Role.find(id) or next
- 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 get_content_tag
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_content_tag(element, adjusted_time, adjusted_time_str, ago, opts)
Method sort=
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def sort=(field)
sort_field = field || ""
direction = sort_field.start_with?("-") ? :desc : :asc
field_name = sort_field.gsub(/\A-/, "")
- 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"