wearefine/fae

View on GitHub

Showing 75 of 1,556 total issues

Function collapsibleTable has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  collapsibleTable: function() {
    var $collapsible = $('.collapsible');
    var $toggle = $('.collapsible-toggle');

    // If there's only one table, don't bother with collapsing everything
Severity: Minor
Found in app/assets/javascripts/fae/_tables.js - About 1 hr to fix

    Function _setupField has 36 lines of code (exceeds 25 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 1 hr to fix

      Function initMarkdown has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        initMarkdown: function () {
          var inlineAttachmentConfig = {
            uploadUrl: '/admin/html_embedded_image',
            uploadFieldName: 'image',
            jsonFieldName: 'file',
      Severity: Minor
      Found in app/assets/javascripts/fae/form/inputs/_text.js - About 1 hr to fix

        Function anchorClickListener has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          anchorClickListener: function() {
            var scroll_offset = parseInt( $('.content-header').css('height'), 10 );
        
            /**
             * Smoothly scroll to destination if it's a link to the current page
        Severity: Minor
        Found in app/assets/javascripts/fae/navigation/_subnav_highlighter.js - 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 sizeFixedHeader has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          sizeFixedHeader: function() {
            var $tables = $('.content table');
        
            var header_height = $('.js-content-header').outerHeight();
            if(FCH.large_down) {
        Severity: Minor
        Found in app/assets/javascripts/fae/_tables.js - About 1 hr to fix

          Function filterFormListeners has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            filterFormListeners: function() {
              var _this = this;
          
              this.$filter_form
                // update search param when form submits
          Severity: Minor
          Found in app/assets/javascripts/fae/form/_filtering.js - About 1 hr to fix

            Function searchListener has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              searchListener: function() {
                var _this = this;
                // shift, ctrl, alt, caps
                var ignored_keycodes = [16, 17, 18, 20];
                // left, up, right, down
            Severity: Minor
            Found in app/assets/javascripts/fae/navigation/_global_search.js - About 1 hr to fix

              Function _submitManager has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _submitManager: function() {
                  var _this = this;
                  var payload = {
                    form_manager: {
                      form_manager_model_name: _this.$theForm.data('form-manager-model'),
              Severity: Minor
              Found in app/assets/javascripts/fae/form/_form_manager.js - About 1 hr to fix

                Function stickyTableHeader has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  stickyTableHeader: function() {
                    var $sticky_tables = $('.content table:not(.stuck-table)');
                
                    // Add sticky psuedo tables after our main table to hold the fixed header
                    $sticky_tables.each(function() {
                Severity: Minor
                Found in app/assets/javascripts/fae/_tables.js - About 1 hr to fix

                  Function initHTML has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    initHTML: function () {
                      var $html_editors = $('.js-html-editor');
                      if(!$html_editors.length) {
                        return;
                      }
                  Severity: Minor
                  Found in app/assets/javascripts/fae/form/inputs/_text.js - About 1 hr to fix

                    Function moveSelection has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                      moveSelection: function(keyCode) {
                        var $results = $('.js-search-results');
                        var $result_links = $('.js-search-results a');
                        var $current_link = $('.js-search-results a.-current');
                        var current_index = $.inArray($current_link[0], $result_links);
                    Severity: Minor
                    Found in app/assets/javascripts/fae/navigation/_global_search.js - 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 filterSubmission has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      filterSubmission: function() {
                        var _this = this;
                    
                        _this.$filter_form
                          .on('submit', function() {
                    Severity: Minor
                    Found in app/assets/javascripts/fae/form/_ajax.js - About 1 hr to fix

                      Function rowSorting has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        rowSorting: function() {
                          $('.js-sort-row').sortable({
                            items: 'tbody tr',
                            opacity: 0.8,
                            handle: ('.sortable-handle'),
                      Severity: Minor
                      Found in app/assets/javascripts/fae/_tables.js - About 1 hr to fix

                        Function _drawElements has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          FileInputer.prototype._drawElements = function() {
                            this.$input = this.$el.find('input[type="file"]');
                        
                            // position the input off screen
                            this.$input.css({
                        Severity: Minor
                        Found in app/assets/javascripts/fae/form/fileinputer.js - About 1 hr to fix

                          Function formValidate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            formValidate: function ($scope) {
                              var _this = this;
                          
                              if (typeof $scope === 'undefined') {
                                $scope = FCH.$document;
                          Severity: Minor
                          Found in app/assets/javascripts/fae/form/_validator.js - About 1 hr to fix

                            Function _buildErrorLinks has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _buildErrorLinks: function ($scope) {
                                const $header = $('.js-content-header');
                                const headerHeight = $header[0].getBoundingClientRect().height;
                            
                                if (typeof $scope === 'undefined') {
                            Severity: Minor
                            Found in app/assets/javascripts/fae/form/_validator.js - About 1 hr to fix

                              Method change has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def change
                                  create_table(:fae_users) do |t|
                                    ## Database authenticatable
                                    t.string :email,              :null => false, :default => ""
                                    t.string :encrypted_password, :null => false, :default => ""
                              Severity: Minor
                              Found in db/migrate/20140809222030_add_user_table.rb - About 1 hr to fix

                                Method filter has 29 lines of code (exceeds 25 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 1 hr to fix

                                  Function multiselectOrChosen has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    multiselectOrChosen: function() {
                                      var _this = this;
                                      var availableItemsStr = ' Available Items';
                                      var addedItemsStr = ' Added Items';
                                  
                                  
                                  Severity: Minor
                                  Found in app/assets/javascripts/fae/form/inputs/_select.js - About 1 hr to fix

                                    Function utilitySearch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      utilitySearch: function() {
                                        var _this = this;
                                        var $header = $('#js-main-header');
                                        var timer;
                                    
                                    
                                    Severity: Minor
                                    Found in app/assets/javascripts/fae/navigation/_global_search.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language