wearefine/fae

View on GitHub

Showing 75 of 1,556 total issues

Function dateColumnSorting has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  dateColumnSorting: function() {
    $.tablesorter.addParser({
      id: 'mmddyy',
      is: function(s) {
        // testing for ##-##-#### or ####-##-##, so it's not perfect; time can be included
Severity: Minor
Found in app/assets/javascripts/fae/_tables.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 _addEditActions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _addEditActions: function(remote_url, $wrapper) {

    $.get(remote_url, function(data){
      // check to see if the content is hidden and slide it down if it is.
      if ($wrapper.is(':hidden')) {
Severity: Minor
Found in app/assets/javascripts/fae/form/_ajax.js - About 1 hr to fix

    Function applyOffset has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function applyOffset() {
          var $this = $(this);
    
          // If this is a collapsible item and the table is hidden, forget it
          if($this.parent().hasClass('collapsible') && !$this.parent().hasClass('active')) {
    Severity: Minor
    Found in app/assets/javascripts/fae/_tables.js - About 1 hr to fix

      Function moveSelection has 26 lines of code (exceeds 25 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

        Method update_cloneable_associations has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_cloneable_associations
              associations_for_cloning.each do |association|
                type = @klass.reflect_on_association(association)
                through_record = type.through_reflection
        
        
        Severity: Minor
        Found in app/controllers/concerns/fae/cloneable.rb - About 55 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 col_name_or_image has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def col_name_or_image(item, attribute)
              value = item.send(attribute)
              return if value.blank?
              # if item is an image
              if value.class.name == 'Fae::Image'
        Severity: Minor
        Found in app/helpers/fae/application_helper.rb - About 55 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 td_columns has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def td_columns(params)
              attribute = params[:col]
              attributes = params[:cols]
              item = params[:item]
        
        
        Severity: Minor
        Found in app/helpers/fae/nested_form_helper.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 update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def update
              authorize_role
        
              params[:user].delete(:password) if params[:user][:password].blank?
              params[:user].delete(:password_confirmation) if params[:user][:password].blank? and params[:user][:password_confirmation].blank?
        Severity: Minor
        Found in app/controllers/fae/users_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

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

            def nav_active_class(klass, level, idx, parent_idx = nil)
              return klass unless @fae_navigation.coordinates[level] == idx
              return klass unless parent_idx.blank? || @fae_navigation.coordinates[level-1] == parent_idx
              new_klass = parent_idx.blank? ? '-parent-current -open' : '-current'
              new_klass += " #{klass}" if klass.present?
        Severity: Minor
        Found in app/helpers/fae/application_helper.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 find_current_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def find_current_hash(array_of_items)
              @coordinates.push(0)
        
              array_of_items.each do |item|
                return item if item[:path] == current_section
        Severity: Minor
        Found in app/models/fae/navigation.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 language_support has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def language_support(f, attribute, options)
              return if Fae.languages.blank?
        
              attribute_array = attribute.to_s.split('_')
              language_suffix = attribute_array.pop
        Severity: Minor
        Found in app/helpers/fae/form_helper.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 sizeFixedHeader has a Cognitive Complexity of 8 (exceeds 5 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 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 clone_has_many_relationships has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def clone_has_many_relationships(association)
              if @item.send(association).present?
                @item.send(association).reverse.each do |record|
                  new_record = association.to_s.classify.constantize.find_by_id(record.id).dup
                  new_record.send("#{@klass_singular}_id" + '=', @cloned_item.id) if new_record.send("#{@klass_singular}_id").present?
        Severity: Minor
        Found in app/controllers/concerns/fae/cloneable.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 setFilterDropDowns has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          setFilterDropDowns: function() {
            // Exit early if this.fry.params is blank
            if ($.isEmptyObject(this.fry.params)) {
              return;
            }
        Severity: Minor
        Found in app/assets/javascripts/fae/form/_filtering.js - 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

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

            def can_toggle(klass, attribute)
              # check if class exists and convert
              return false unless Object.const_defined?(klass)
              klass = klass.constantize
        
        
        Severity: Minor
        Found in app/controllers/fae/utilities_controller.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

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

            def post(endpoint, params = nil)
              begin
                uri = URI.parse(endpoint)
                request = Net::HTTP::Post.new(uri)
                set_headers(request)
        Severity: Minor
        Found in app/services/fae/netlify_api.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

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

            def fae_pulldown(f, attribute, options={})
              raise "Fae::MissingRequiredOption: fae_pulldown requires a 'collection' when using it on an ActiveRecord attribute." if !options.has_key?(:collection) && f.object.attribute_names.include?(attribute.to_s)
              raise "Fae::ImproperOptionValue: The value #{options[:size]} is not a valid option for 'size'. Please use 'short' or 'long'." if options[:size].present? && ['short','long'].include?(options[:size]) == false
              raise "Fae::ImproperOptionValue: The value #{options[:search]} is not a valid option for 'search'. Please use a Boolean." if options[:search].present? && !!options[:search] != options[:search]
        
        
        Severity: Minor
        Found in app/helpers/fae/form_helper.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

        Function _removeIgnoredErrors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          _removeIgnoredErrors: function (messages) {
            // Ignored error messages from Judge:
            // 'Judge validation for Release#name not allowed'
            // 'Slug Request error: 0'
            var ignored_error_substrings = ['Judge validation', 'Request error'];
        Severity: Minor
        Found in app/assets/javascripts/fae/form/_validator.js - 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

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

            def path_from_subitems(hash)
              return '#' unless hash[:subitems] && hash[:subitems].is_a?(Array)
        
              first_subitem = hash[:subitems].first
        
        
        Severity: Minor
        Found in app/models/fae/navigation.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

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

            def get(endpoint)
              begin
                uri = URI.parse(endpoint)
                request = Net::HTTP::Get.new(uri)
                set_headers(request)
        Severity: Minor
        Found in app/services/fae/netlify_api.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

        Severity
        Category
        Status
        Source
        Language