ReadyResponder/ReadyResponder

View on GitHub

Showing 42 of 7,746 total issues

Method respond has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def respond
    case event_codename
    when "custom"
      # available custom 1/15/2017 0800 01/15/2021 Work
      unless start_time.is_a? Time and end_time.is_a? Time
Severity: Minor
Found in app/services/msg/available.rb - About 1 hr to fix

    Method valid_people_numbers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def valid_people_numbers
          if (minimum_people.present? and maximum_people.present? and desired_people.present?)
            if maximum_people < minimum_people
              errors.add :maximum_people, "must be greater than or equal to 'minimum_people'"
            end
    Severity: Minor
    Found in app/models/requirement.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 create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        @notification = Notification.new(notification_params)
        if @notification.save
          if @notification.status == "Active"
            begin
    Severity: Minor
    Found in app/controllers/notifications_controller.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

    Function performSearch has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      function performSearch(data, regexps, queries, highlighters, state) {
    Severity: Minor
    Found in spec/support/doc/js/searcher.js - About 35 mins to fix

      Method staffing_level has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def staffing_level
          return STATUS_CHOICES_ARRAY[5] if status == 'Cancelled'
      
          statuses = requirements.map { |r| Requirement::STATUS_CHOICES[r.status] }
          sorted = statuses.uniq.sort
      Severity: Minor
      Found in app/models/task.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

      Avoid too many return statements within this method.
      Open

              return 'label label-default'
      Severity: Major
      Found in app/helpers/inspections_helper.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

            return STATUS_CHOICES_ARRAY[3] if sorted[0] == 3  # Satisfied
        Severity: Major
        Found in app/models/task.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                return nil
          Severity: Major
          Found in app/helpers/availabilities_helper.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                  return 'label label-danger'
            Severity: Major
            Found in app/helpers/items_helper.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                  return STATUS_CHOICES_ARRAY[2] if sorted[0] == 2  # Adequate
              Severity: Major
              Found in app/models/task.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                      return 'Empty'
                Severity: Major
                Found in app/models/requirement.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                      return STATUS_CHOICES_ARRAY[4] if sorted == [4]  # Full
                  Severity: Major
                  Found in app/models/task.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                          return 'label label-default'
                    Severity: Major
                    Found in app/helpers/items_helper.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                            return 'label label-default'
                      Severity: Major
                      Found in app/helpers/items_helper.rb - About 30 mins to fix

                        Method verify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def verify
                            if @timecard.status == 'Unverified'
                              @timecard.status = 'Verified'
                              if @timecard.save
                                respond_to do |format|
                        Severity: Minor
                        Found in app/controllers/timecards_controller.rb - About 25 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 change has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def change
                            unless column_exists? :notifications, :subject
                              add_column :notifications, :subject, :string
                            end
                            unless column_exists? :notifications, :body
                        Severity: Minor
                        Found in db/migrate/20161105063525_add_attributes_to_notification.rb - About 25 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def initialize(current_user)
                            current_user ||= User.new
                            roles = current_user.roles.map {|x| x.to_s}
                            if roles.blank?
                              cannot :manage, :all
                        Severity: Minor
                        Found in app/models/ability.rb - About 25 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 add_class_and_confirmation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def add_class_and_confirmation(default_class, default_delete_class, default_confirm_delete_msg, html_options)
                            if html_options[:method] == :delete
                              html_options[:class] ||= default_delete_class
                              html_options[:data] ||= { confirm: default_confirm_delete_msg }
                              html_options[:data][:confirm] ||= default_confirm_delete_msg
                        Severity: Minor
                        Found in app/helpers/application_helper.rb - About 25 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

                        Function hookSearch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function hookSearch() {
                          var input  = $('#search-field').eq(0);
                          var result = $('#search-results').eq(0);
                          $(result).show();
                        
                        
                        Severity: Minor
                        Found in spec/support/doc/js/darkfish.js - About 25 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 availability_status_label has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def availability_status_label(a, event = nil)
                            if a.class.to_s=='Assignment'
                              content_tag(:span, 'Assigned', class: 'label label-info')
                            elsif a.partially_available?(event)
                              content_tag(:span, a.status == "Available" ? "Partially Available" : a.status,
                        Severity: Minor
                        Found in app/helpers/availabilities_helper.rb - About 25 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