activescaffold/active_scaffold

View on GitHub

Showing 362 of 362 total issues

Method call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def call(mapper, options = {})
        actions = get_actions(ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING, options)

        mapper.collection do
          ActiveScaffold::Routing::ACTIVE_SCAFFOLD_ASSOCIATION_ROUTING[:collection].each do |name, type|
Severity: Minor
Found in lib/active_scaffold/extensions/routing_mapper.rb - About 25 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 override_helper has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def override_helper(column, suffix)
        ActiveScaffold::Registry.cache suffix, column.cache_key do
          method_with_class = override_helper_name(column, suffix, true)
          if respond_to?(method_with_class)
            method_with_class
Severity: Minor
Found in lib/active_scaffold/helpers/view_helpers.rb - About 25 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 should_respond_to_parent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.should_respond_to_parent(description = nil, &block)
    should "respond to parent #{description}" do
      script = block ? instance_eval(&block) : /.*/
      script = script.is_a?(Regexp) ? script.source : Regexp.quote(script)
      script = script.gsub('\n', '\\\\\\n')
Severity: Minor
Found in shoulda_macros/macros.rb - About 25 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 init_field_search_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def init_field_search_params(default_params)
        return unless (params[:search].is_a?(String) || search_params.nil?) && params[:search].blank?
        params[:search] = default_params.is_a?(Proc) ? instance_eval(&default_params) : default_params
      end
Severity: Minor
Found in lib/active_scaffold/actions/field_search.rb - About 25 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 render_form_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  render_form_field: function(source, content, options) {
    var source = $(source);
    var element = source.up('.association-record'), selector = '';
    if (typeof(element) === 'undefined') {
      element = source.up('ol.form');
Severity: Minor
Found in app/assets/javascripts/prototype/active_scaffold.js - About 25 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 value_for_update_column has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def value_for_update_column(param_value, column, record)
      unless param_value
        param_value = ActiveScaffold::Core.column_type_cast column.default_for_empty_value, column.column
        param_value = false if param_value == true
      end
Severity: Minor
Found in lib/active_scaffold/actions/update.rb - About 25 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 create_respond_to_js has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create_respond_to_js
      if successful? && !render_parent?
        do_refresh_list if active_scaffold_config.create.refresh_list
        if params[:dont_close]
          @saved_record = @record
Severity: Minor
Found in lib/active_scaffold/actions/create.rb - About 25 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 active_record_column_type_cast has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.active_record_column_type_cast(value, column_or_type)
      return Time.zone.at(value.to_i) if value =~ /\A\d+\z/ && %i[time datetime].include?(column_or_type.type)
      cast_type = column_or_type.is_a?(ActiveRecord::ConnectionAdapters::Column) ? ActiveRecord::Type.lookup(column_or_type.type) : column_or_type
      cast_type ? cast_type.cast(value) : value
    end
Severity: Minor
Found in lib/active_scaffold/core.rb - About 25 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_column_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def get_column_method(record, column)
        # check for an override helper
        ActiveScaffold::Registry.cache :column_methods, column.cache_key do
          if (method = column_override(column))
            # we only pass the record as the argument. we previously also passed the formatted_value,
Severity: Minor
Found in lib/active_scaffold/helpers/list_column_helpers.rb - About 25 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 active_scaffold_column_boolean has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_column_boolean(record, column, ui_options: column.options)
        value = record.send(column.name)
        if value.nil? && ui_options[:include_blank]
          value = ui_options[:include_blank]
          value.is_a?(Symbol) ? as_(value) : value
Severity: Minor
Found in lib/active_scaffold/helpers/list_column_helpers.rb - About 25 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 inplace_edit_control has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def inplace_edit_control(column)
        return unless inplace_edit?(active_scaffold_config.model, column) && inplace_edit_cloning?(column)
        unless ActiveScaffold.threadsafe
          column = column.dup
          column.options = column.options.dup
Severity: Minor
Found in lib/active_scaffold/helpers/list_column_helpers.rb - About 25 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 display_message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def display_message(message)
        message = safe_join message, tag(:br) if message.is_a?(Array)
        if (highlights = active_scaffold_config.user.highlight_messages)
          message = highlights.inject(message) do |msg, (phrases, highlighter)|
            highlight(msg, phrases, highlighter || {})
Severity: Minor
Found in lib/active_scaffold/helpers/view_helpers.rb - About 25 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 custom_finder_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def custom_finder_options
        if grouped_search?
          group_sql = calculation_for_group_by(search_group_column&.field || search_group_name)
          select_query = grouped_search_select
          select_query << group_sql.as(search_group_column.name.to_s) if search_group_column && group_sql.respond_to?(:to_sql)
Severity: Minor
Found in lib/active_scaffold/actions/field_search.rb - About 25 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 removeHash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

       removeHash: function(hashValue) {
               var r;
               if (hashValue === null || hashValue === undefined) {
                       r = null;
               }
Severity: Minor
Found in app/assets/javascripts/prototype/dhtml_history.js - About 25 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 format_to_datetime_picker has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.format_to_datetime_picker(rails_time_format)
        date_format, time_format = split_datetime_format(to_datepicker_format(rails_time_format))
        datetime_picker_options = {}
        datetime_picker_options[:dateFormat] = date_format unless date_format.nil?
        unless time_format.nil?
Severity: Minor
Found in lib/active_scaffold/bridges/date_picker/helper.rb - About 25 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 active_scaffold_search_multi_select has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def active_scaffold_search_multi_select(column, options, ui_options: column.options)
        record = options.delete(:object)
        associated = options.delete :value
        associated = [associated].compact unless associated.is_a? Array

Severity: Minor
Found in lib/active_scaffold/helpers/search_column_helpers.rb - About 25 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 field_search_record_select_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def field_search_record_select_value(column, value, ui_options: column.options)
        return if value.blank?
        if ui_options[:multiple]
          column.association.klass.find value.select(&:present?).collect!(&:to_i)
        else
Severity: Minor
Found in lib/active_scaffold/bridges/record_select/helpers.rb - About 25 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 mark_respond_to_js has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def mark_respond_to_js
      if params.delete(:id) # so find_page doesn't filter by :id
        do_search if respond_to? :do_search, true
        set_includes_for_columns if active_scaffold_config.actions.include? :list
        @page = find_page(:pagination => active_scaffold_config.mark.mark_all_mode != :page)
Severity: Minor
Found in lib/active_scaffold/actions/mark.rb - About 25 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 clonePatternField has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  clonePatternField: function() {
    var patternNodes = this.getPatternNodes(this.options.inplacePatternSelector);
    if (patternNodes.editNode == null) {
      alert('did not find any matching node for ' + this.options.editFieldSelector);
      return;
Severity: Minor
Found in app/assets/javascripts/prototype/active_scaffold.js - About 25 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 setup_jquery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def setup_jquery(file, original_js = nil, where: 'ujs')
        original_js ||= File.binread(file)
        if ActiveScaffold.js_framework == :jquery
          unless original_js.include?('require jquery')
            insert_into_file file, before: %r{//= require +.*#{where}['"]?\n} do
Severity: Minor
Found in lib/generators/active_scaffold/install_generator.rb - About 25 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