wearefine/fae

View on GitHub

Showing 75 of 1,556 total issues

File _validator.js has 392 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* global Fae, judge, FCH */

/**
 * Fae form validator
 * @namespace form.validator
Severity: Minor
Found in app/assets/javascripts/fae/form/_validator.js - About 5 hrs to fix

    Method get_deploys_env_response has 122 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def get_deploys_env_response(path)
          return get "#{@endpoint_base}#{path}" unless Rails.env.test?
          [
            {
              "state"=>"building",
    Severity: Major
    Found in app/services/fae/netlify_api.rb - About 4 hrs to fix

      Method filter has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

            def filter(params)
              # build conditions if specific params are present
              conditions = {}
              conditions[:user_id] = params['user'] if params['user'].present?
              conditions[:changeable_type] = params['model'] if params['model'].present?
      Severity: Minor
      Found in app/models/fae/change.rb - 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

      Method validate_each has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

        def validate_each(record, attribute, value)
          raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base
      
          value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
      
      
      Severity: Minor
      Found in lib/file_size_validator.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 set_globals has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def set_globals
            if attributes.present?
              attributes.each do |arg|
                # prevent these from being in attributes_flat or attribute_names as they are not real model generator field options
                if is_attachment(arg)
      Severity: Minor
      Found in lib/generators/fae/base_generator.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

      Function multiselectChosenActions has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        multiselectChosenActions: function() {
          var query_input_select = '.input.select';
          // Ignore select elements with .multiselect classes, because these are used for a different widget
          var query_eligible_multiselects = query_input_select + ' select[multiple]:not(.multiselect)';
          var select_all_value = 'multiselect_action-select_all';
      Severity: Major
      Found in app/assets/javascripts/fae/form/inputs/_select.js - About 2 hrs to fix

        Function _setupField has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

          _setupField: function($container, overriddenLabel, overriddenHelper) {
            var _this = this;
            if ($container.length) {
              var $label                 = $container.find('label:first');
              var $helperTextContainerEl = $container.find('h6');
        Severity: Minor
        Found in app/assets/javascripts/fae/form/_form_manager.js - 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 clone_has_one_relationship has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def clone_has_one_relationship(association,type)
              old_record = @item.send(association)
        
              if old_record.present?
                new_record = old_record.dup
        Severity: Minor
        Found in app/controllers/concerns/fae/cloneable.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

        deploy has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        Fae.deploy = {
        
          ready: function() {
            if (!$('body').hasClass('deploy')) return false;
            this.$deployButtons  = $('.js-run-deploy');
        Severity: Minor
        Found in app/assets/javascripts/fae/_deploy.js - About 2 hrs to fix

          Class BaseGenerator has 21 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class BaseGenerator < Rails::Generators::NamedBase
              source_root ::File.expand_path('../templates', __FILE__)
              argument :attributes, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
              class_option :namespace, type: :string, default: 'admin', desc: 'Sets the namespace of the generator'
              class_option :template, type: :string, default: 'slim', desc: 'Sets the template engine of the generator'
          Severity: Minor
          Found in lib/generators/fae/base_generator.rb - About 2 hrs to fix

            Function applyCookies has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

              applyCookies: function() {
                var cookie_key = $('.js-filter-form').attr('data-cookie-key');
            
                if (cookie_key) {
                  var cookie = Cookies.getJSON(cookie_key);
            Severity: Minor
            Found in app/assets/javascripts/fae/form/_filtering.js - 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

            Function htmlListeners has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              htmlListeners: function() {
                $('#js-main-content, .login-form > form, #simplemodal-data')
            
                  /**
                   * For the delete button on file input
            Severity: Major
            Found in app/assets/javascripts/fae/form/_ajax.js - About 2 hrs to fix

              File _tables.js has 251 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /* global Fae, FCH, Cookies */
              
              /**
               * Fae tables
               * @namespace tables
              Severity: Minor
              Found in app/assets/javascripts/fae/_tables.js - About 2 hrs to fix

                Method setup_dynamic_singleton has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    def self.setup_dynamic_singleton
                      return if @singleton_is_setup
                
                      fae_fields.each do |name, value|
                        type = value.is_a?(Hash) ? value[:type] : value
                Severity: Minor
                Found in app/models/fae/static_page.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_item_link has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def change_item_link(change)
                      text = "#{change.changeable_type.gsub('Fae::','')}: "
                      test_source_method = :data_source_exists?
                
                      if change.changeable_type.exclude?('Fae') && change.changeable_type.exclude?('Page') && !ActiveRecord::Base.connection.send(test_source_method, change.changeable_type.tableize)
                Severity: Minor
                Found in app/helpers/fae/application_helper.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 initDateRangePicker has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  initDateRangePicker: function() {
                    $.dateRangePickerLanguages['custom'] = {
                      'selected': 'Choosed:',
                      'days': 'Days',
                      'apply': 'Close',
                Severity: Minor
                Found in app/assets/javascripts/fae/form/inputs/_dates.js - About 1 hr to fix

                  Function _gatherAndInjectManagerEls has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    _gatherAndInjectManagerEls: function() {
                      $(_this.$theForm.find('['+_this.containerManagerDataId+']')).each(function(i) {
                        var $container    = $(this);
                  
                        if ($container.hasClass('hidden') || !_this._shouldDisplayInManager($container)) { return; }
                  Severity: Minor
                  Found in app/assets/javascripts/fae/form/_form_manager.js - About 1 hr to fix

                    Function openAjaxModal has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      openAjaxModal: function (remoteUrl, relatedTarget) {
                        var _this = this;
                    
                        $.get(remoteUrl, function (data) {
                          //Open remote url content in modal window
                    Severity: Minor
                    Found in app/assets/javascripts/fae/_modals.js - About 1 hr to fix

                      Function addEditSubmission has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        addEditSubmission: function() {
                          var _this = this;
                      
                          this.$addedit_form.on('ajax:success', function(evt, data, status, xhr){
                      
                      
                      Severity: Minor
                      Found in app/assets/javascripts/fae/form/_ajax.js - About 1 hr to fix

                        Method label_and_hint has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def label_and_hint(attribute, options)
                              hint = options[:hint]
                        
                              options[:helper_text] = attempt_common_helper_text(attribute) if options[:helper_text].blank?
                        
                        
                        Severity: Minor
                        Found in app/helpers/fae/form_helper.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

                        Severity
                        Category
                        Status
                        Source
                        Language