ReadyResponder/ReadyResponder

View on GitHub

Showing 42 of 7,746 total issues

Function prototype has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
Open

Searcher.prototype = new function() {
  // search is performed in chunks of 1000 for non-blocking user input
  var CHUNK_SIZE = 1000;
  // do not try to find more than 100 results
  var MAX_RESULTS = 100;
Severity: Minor
Found in spec/support/doc/js/searcher.js - About 1 day 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

File schema.rb has 566 lines of code (exceeds 250 allowed). Consider refactoring.
Open

ActiveRecord::Schema.define(version: 2019_10_31_013911) do

  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"

Severity: Major
Found in db/schema.rb - About 1 day to fix

    Function prototype has 160 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Searcher.prototype = new function() {
      // search is performed in chunks of 1000 for non-blocking user input
      var CHUNK_SIZE = 1000;
      // do not try to find more than 100 results
      var MAX_RESULTS = 100;
    Severity: Major
    Found in spec/support/doc/js/searcher.js - About 6 hrs to fix

      Class Person has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Person < ApplicationRecord
        has_paper_trail
        include Commentable
        include Loggable
      
      
      Severity: Minor
      Found in app/models/person.rb - About 3 hrs to fix

        Function prototype has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

        Search.prototype = $.extend({}, Navigation, new function() {
          var suid = 1;
        
          this.init = function() {
            var _this = this;
        Severity: Minor
        Found in spec/support/doc/js/search.js - About 3 hrs 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

        File person_spec.rb has 292 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'rails_helper'
        
        RSpec.describe Person do
          describe 'validations' do
            subject { build :person }
        Severity: Minor
        Found in spec/models/person_spec.rb - About 3 hrs to fix

          Method change has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

            def change
              add_index :taggings, :tag_id unless index_exists? :taggings, :tag_id
              add_index :taggings, :taggable_id unless index_exists? :taggings, :taggable_id
              add_index :taggings, :taggable_type unless index_exists? :taggings, :taggable_type
              add_index :taggings, :tagger_id unless index_exists? :taggings, :tagger_id

          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 Event has 25 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Event < ApplicationRecord
            has_paper_trail
            include Loggable
          
            before_save :calc_duration, :trim_id_code
          Severity: Minor
          Found in app/models/event.rb - About 2 hrs to fix

            Function prototype has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Search.prototype = $.extend({}, Navigation, new function() {
              var suid = 1;
            
              this.init = function() {
                var _this = this;
            Severity: Major
            Found in spec/support/doc/js/search.js - About 2 hrs to fix

              File availability_spec.rb has 254 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'rails_helper'
              
              RSpec.describe Availability, type: :model do
                let(:a_person) { build(:person) }
              
              
              Severity: Minor
              Found in spec/models/availability_spec.rb - About 2 hrs to fix

                Method initialize has 51 lines of code (exceeds 25 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: Major
                Found in app/models/ability.rb - About 2 hrs to fix

                  Method respond has a Cognitive Complexity of 14 (exceeds 5 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

                  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 respond has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def respond    
                      response = ""
                      @person.upcoming_events.each do |event|
                        if event.people.include?(@person)
                          response += "🔷 "
                  Severity: Minor
                  Found in app/services/msg/upcoming.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 performSearch has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function performSearch(data, regexps, queries, highlighters, state) {
                      var searchIndex = data.searchIndex;
                      var longSearchIndex = data.longSearchIndex;
                      var info = data.info;
                      var result = [];
                  Severity: Minor
                  Found in spec/support/doc/js/searcher.js - About 1 hr to fix

                    Method service_duration has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def service_duration
                        if self.start_date.present?
                          if self.end_date.present?
                            self.end_date.year - self.start_date.year + ( self.start_date.yday < self.end_date.yday ? 1 : 0 )
                          else
                    Severity: Minor
                    Found in app/models/person.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 change has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def change
                        create_table :people do |t|
                        t.string   "firstname"
                        t.string   "lastname"
                        t.string   "status"
                    Severity: Minor
                    Found in db/migrate/20120801051235_create_people.rb - About 1 hr to fix

                      Method respond has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def respond
                          case event_codename
                          when "custom"
                            # unavailable 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/unavailable.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 get_nested_editor_views has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def get_nested_editor_views(outer_model_name, nested_model_name, things_to_look_for)
                          outer_model = outer_model_name.to_sym
                          nested_model = nested_model_name.to_sym
                          nested_model_controller = nested_model_name.pluralize.to_sym
                      
                      
                      Severity: Minor
                      Found in spec/support/authorization_view_helper.rb - About 1 hr to fix

                        Function onkeydown has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          this.onkeydown = function(e) {
                            if (!this.navigationActive) return;
                            switch(e.keyCode) {
                              case 37: //Event.KEY_LEFT:
                                if (this.moveLeft()) e.preventDefault();
                        Severity: Minor
                        Found in spec/support/doc/js/navigation.js - About 1 hr to fix

                          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
                            Severity
                            Category
                            Status
                            Source
                            Language