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 },
Severity: Minor
Found in app/models/user.rb - About 4 hrs to fix

    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
    Severity: Minor
    Found in app/models/ncr/work_order.rb - About 4 hrs to fix

      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]
      Severity: Minor
      Found in app/controllers/proposals_controller.rb - About 3 hrs to fix

        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",
        Severity: Minor
        Found in app/models/gsa18f/procurement.rb - About 3 hrs to fix

          Class ApplicationController has 26 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class ApplicationController < ActionController::Base
            include Pundit
            include ReturnToHelper
            include MarkdownHelper
          
          
          Severity: Minor
          Found in app/controllers/application_controller.rb - About 3 hrs to fix

            Function ListConfig has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function ListConfig() {
                var config = [
                  {
                    targets: "th-value-id"
                  },
            Severity: Major
            Found in app/assets/javascripts/details/views/list/list_config.js - About 2 hrs to fix

              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]
              Severity: Minor
              Found in app/controllers/client_data_controller.rb - About 2 hrs to fix

                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"
                Severity: Minor
                Found in app/models/gsa18f/event.rb - About 2 hrs to fix

                  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
                  
                  
                  Severity: Minor
                  Found in app/queries/proposal_search_dsl.rb - About 2 hrs to fix

                    Class Dispatcher has 24 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Dispatcher
                      def initialize(proposal)
                        @proposal = proposal
                      end
                    
                    
                    Severity: Minor
                    Found in app/models/dispatcher.rb - About 2 hrs to fix

                      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
                      Severity: Minor
                      Found in app/queries/proposal_listing_query.rb - About 2 hrs to fix

                        Class ProposalPolicy has 23 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class ProposalPolicy
                          include ExceptionPolicy
                        
                          def initialize(user, record)
                            super(user, record)
                        Severity: Minor
                        Found in app/policies/proposal_policy.rb - About 2 hrs to fix

                          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?
                          Severity: Minor
                          Found in app/queries/proposal_fielded_search_query.rb - About 1 hr to fix

                          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?
                          Severity: Minor
                          Found in app/queries/proposal_fielded_search_query.rb - About 1 hr to fix

                          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 ){
                          Severity: Minor
                          Found in app/assets/javascripts/details/views/list/list_view.js - About 1 hr to fix

                            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();
                            Severity: Minor
                            Found in app/assets/javascripts/details/views/list/list_view.js - About 1 hr to fix

                              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?
                              Severity: Minor
                              Found in app/admin/step.rb - About 1 hr to fix

                              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
                              Severity: Minor
                              Found in app/admin/user.rb - About 45 mins to fix

                              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)
                              Severity: Minor
                              Found in app/helpers/value_helper.rb - About 35 mins to fix

                                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-/, "")
                                
                                
                                Severity: Minor
                                Found in app/presenters/tabular_data/container.rb - About 35 mins to fix

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language