rapidftr/RapidFTR

View on GitHub

Showing 85 of 110 total issues

File children_form_section_setup.rb has 683 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module RapidFTR
  module ChildrenFormSectionSetup
    def self.build_form_sections
      form_sections = []
      form_sections << build_basic_identity_section
Severity: Major
Found in lib/rapid_ftr/children_form_section_setup.rb - About 1 day to fix

    Method reset_definitions has 207 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def self.reset_definitions
          form = Form.find_by_name(Child::FORM_NAME)
          outcome_of_follow_up_visit_fields = [
            Field.new('name' => 'was_child_seen',
                      'type' => 'select_box',
    Severity: Major
    Found in lib/rapid_ftr/follow_up_form_section_setup.rb - About 1 day to fix

      Method build_family_details_section has 153 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.build_family_details_section
            family_details_fields = [
              Field.new('name' => 'fathers_name',
                        'type' => 'text_field',
                        'display_name_all' => "Father's Name",
      Severity: Major
      Found in lib/rapid_ftr/children_form_section_setup.rb - About 6 hrs to fix

        Function advancedSearch has 153 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            $.fn.advancedSearch = function (options) {
                var element = $(this);
                var self = this;
        
                var menu = element.find(".criteria_menu");
        Severity: Major
        Found in app/assets/javascripts/advanced_search.js - About 6 hrs to fix

          Class FormSection has 37 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class FormSection < CouchRest::Model::Base
            include RapidFTR::Model
            include PropertiesLocalization
            use_database :form_section
            localize_properties [:name, :help_text, :description]
          Severity: Minor
          Found in app/models/form_section.rb - About 4 hrs to fix

            Function init has 115 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            ManagePhotos.init = function() {
              _.templateSettings = {
                interpolate : /\{\{(.+?)\}\}/g
              };
            
            
            Severity: Major
            Found in app/assets/javascripts/manage_photos.js - About 4 hrs to fix

              File enquiries_form_section_setup.rb has 348 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module RapidFTR
                module EnquiriesFormSectionSetup
                  def self.build_form_sections
                    form_sections = []
                    form_sections << build_details_of_adult_seeking_child_section
              Severity: Minor
              Found in lib/rapid_ftr/enquiries_form_section_setup.rb - About 4 hrs to fix

                Method build_basic_identity_section has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def self.build_basic_identity_section
                      basic_identity_fields = [
                        Field.new('name' => 'name',
                                  'type' => 'text_field',
                                  'highlight_information' => HighlightInformation.new('highlighted' => true, 'order' => 1),
                Severity: Major
                Found in lib/rapid_ftr/children_form_section_setup.rb - About 4 hrs to fix

                  Function init has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  ManageUsers.init = function () {
                    window.User = Backbone.Model.extend ({
                      changeDisabledStatus: function(disabledStatus) {
                        var userAttributes = {"user[disabled]": disabledStatus, "authenticity_token": this.token()};
                        $.ajax({
                  Severity: Major
                  Found in app/assets/javascripts/manage_users.js - About 3 hrs to fix

                    Class Replication has 28 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Replication < CouchRest::Model::Base
                      MODELS_TO_SYNC = [Role, Child, User, MobileDbKey, Device, Form, FormSection]
                      STABLE_WAIT_TIME = 2.minutes
                    
                      include RapidFTR::Model
                    Severity: Minor
                    Found in app/models/replication.rb - About 3 hrs to fix

                      Class Enquiry has 28 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Enquiry < BaseModel
                        use_database :enquiry
                      
                        require 'uuidtools'
                        include Searchable
                      Severity: Minor
                      Found in app/models/enquiry.rb - About 3 hrs to fix

                        Class Child has 28 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Child < BaseModel
                          use_database :child
                        
                          require 'uuidtools'
                          include Extensions::CustomValidator::CustomFieldsValidator
                        Severity: Minor
                        Found in app/models/child.rb - About 3 hrs to fix

                          Method build_interview_details_section has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              def self.build_interview_details_section
                                interview_details_fields = [
                                  Field.new('name' => 'disclosure_public_name',
                                            'type' => 'select_box',
                                            'display_name_all' => 'Does Child/Caregiver agree to share name on posters/radio/Internet?',
                          Severity: Major
                          Found in lib/rapid_ftr/children_form_section_setup.rb - About 3 hrs to fix

                            Method build_child_wishes_section has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                def self.build_child_wishes_section
                                  child_wishes_fields = [
                                    Field.new('name' => 'wishes_name_1',
                                              'type' => 'text_field',
                                              'display_name_all' => 'Person child wishes to locate - Preferred',
                            Severity: Major
                            Found in lib/rapid_ftr/children_form_section_setup.rb - About 2 hrs to fix

                              Method build_details_of_adult_seeking_child_section has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  def self.build_details_of_adult_seeking_child_section
                                    details_of_adult_seeking_child_fields = [
                                      Field.new('name' => 'enq_first_name',
                                                'type' => 'text_field',
                                                'highlight_information' => HighlightInformation.new('highlighted' => true, 'order' => 1),
                              Severity: Major
                              Found in lib/rapid_ftr/enquiries_form_section_setup.rb - About 2 hrs to fix

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

                                  def formatted_hash
                                    properties_hash = {}
                                    properties.map(&:name).each do |property|
                                      locale = property[-2..-1]
                                      property_name = property[0..property.length - 4]
                                Severity: Minor
                                Found in app/models/properties_localization.rb - About 2 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

                                Method build_details_of_child_sought_fields_section has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def self.build_details_of_child_sought_fields_section
                                      details_of_child_sought_fields = [
                                        Field.new('name' => '2_first_name',
                                                  'type' => 'text_field',
                                                  'display_name_all' => 'First Name',
                                Severity: Major
                                Found in lib/rapid_ftr/enquiries_form_section_setup.rb - About 2 hrs to fix

                                  Method build_protection_concerns_section has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def self.build_protection_concerns_section
                                        protection_concerns_fields = [
                                          Field.new('name' => 'concerns_chh',
                                                    'type' => 'select_box',
                                                    'display_name_all' => 'Child Headed Household',
                                  Severity: Major
                                  Found in lib/rapid_ftr/children_form_section_setup.rb - About 2 hrs to fix

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

                                    class User < CouchRest::Model::Base
                                      use_database :user
                                    
                                      include RapidFTR::Model
                                      include RapidFTR::CouchRestRailsBackward
                                    Severity: Minor
                                    Found in app/models/user.rb - About 2 hrs to fix

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

                                      class Field
                                        include CouchRest::Model::CastedModel
                                        include RapidFTR::Model
                                        include PropertiesLocalization
                                      
                                      
                                      Severity: Minor
                                      Found in app/models/field.rb - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language