activescaffold/active_scaffold

View on GitHub

Showing 296 of 296 total issues

Method assign_tabbed_by has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def assign_tabbed_by(record, parent_column, tabbed_by, value, value_type)
Severity: Minor
Found in lib/active_scaffold/actions/subform.rb - About 35 mins to fix

    Method pagination_ajax_links has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def pagination_ajax_links(current_page, url_options, options, inner_window, outer_window)
    Severity: Minor
    Found in lib/active_scaffold/helpers/pagination_helpers.rb - About 35 mins to fix

      Method active_scaffold_file_with_content has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def active_scaffold_file_with_content(column, content, options, remove_file_prefix, controls_class)
      Severity: Minor
      Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 35 mins to fix

        Method form_attribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def form_attribute(column, record, scope = nil, only_value = false, col_class = nil)
        Severity: Minor
        Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 35 mins to fix

          Method active_scaffold_record_select has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def active_scaffold_record_select(record, column, options, value, multiple, ui_options: column.options)
          Severity: Minor
          Found in lib/active_scaffold/bridges/record_select/helpers.rb - About 35 mins to fix

            Method usa_state_select has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def usa_state_select(object, method, priority_states = nil, options = {}, html_options = {})
            Severity: Minor
            Found in lib/active_scaffold/bridges/usa_state_select/usa_state_select_helper.rb - About 35 mins to fix

              Method active_scaffold_input_for_tabbed has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                    def active_scaffold_input_for_tabbed(column, record, subsection_id, tab_options, used_tabs)
              Severity: Minor
              Found in lib/active_scaffold/helpers/tabs_helpers.rb - About 35 mins to fix

                Method active_scaffold_checkbox_option has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                      def active_scaffold_checkbox_option(option, label_method, associated_ids, checkbox_options, li_options = {})
                Severity: Minor
                Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 35 mins to fix

                  Method render_column has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                        def render_column(column, record, renders_as, scope = nil, only_value: false, col_class: nil, **subform_locals)
                  Severity: Minor
                  Found in lib/active_scaffold/helpers/form_column_helpers.rb - About 35 mins to fix

                    Method update_column_association has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def update_column_association(parent_record, column, attribute, value, avoid_changes = false)
                    Severity: Minor
                    Found in lib/active_scaffold/attribute_params.rb - About 35 mins to fix

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                        module Helpers
                          module FormColumnHelpers
                            def active_scaffold_input_paperclip(column, options, ui_options: column.options)
                              record = options[:object]
                              paperclip = record.send(column.name.to_s)
                      Severity: Minor
                      Found in lib/active_scaffold/bridges/paperclip/form_ui.rb and 1 other location - About 35 mins to fix
                      lib/active_scaffold/bridges/dragonfly/form_ui.rb on lines 2..8

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 36.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                        module Helpers
                          module FormColumnHelpers
                            def active_scaffold_input_dragonfly(column, options, ui_options: column.options)
                              record = options[:object]
                              dragonfly = record.send(column.name.to_s)
                      Severity: Minor
                      Found in lib/active_scaffold/bridges/dragonfly/form_ui.rb and 1 other location - About 35 mins to fix
                      lib/active_scaffold/bridges/paperclip/form_ui.rb on lines 2..8

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 36.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                            def build_active_scaffold_search_range_ui(operators, from, to = nil, name:, id:, opt_value: nil)
                              opt_value ||= operators[0][1]
                              html = select_tag("#{name}[opt]", options_for_select(operators, opt_value),
                                                id: "#{id}_opt", class: 'as_search_range_option')
                              if to
                      Severity: Minor
                      Found in lib/active_scaffold/helpers/search_column_helpers.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 links_for_associations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def links_for_associations
                              return unless active_scaffold_config.actions.include?(:list) && active_scaffold_config.actions.include?(:nested)
                      
                              active_scaffold_config.columns.each do |column|
                                next unless column.link.nil? && column.autolink?
                      Severity: Minor
                      Found in lib/active_scaffold/core.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def render(options = {}, locals = {}, &block)
                              case options
                              when Hash
                                in_rendering_context(options) do |_|
                                  # previously set view paths and lookup context are lost here
                      Severity: Minor
                      Found in lib/active_scaffold/extensions/action_view_rendering.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 parent_sti_controller has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def parent_sti_controller
                            return unless params[:parent_sti]
                      
                            unless defined? @parent_sti_controller
                              controller = look_for_parent_sti_controller
                      Severity: Minor
                      Found in lib/active_scaffold/actions/core.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 render has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def render(*args, &block)
                            if self.class.uses_active_scaffold? && params[:adapter] && @rendering_adapter.nil? && request.xhr?
                              @rendering_adapter = true # recursion control
                              # if we need an adapter, then we render the actual stuff to a string and insert it into the adapter template
                              opts = args.any? ? args.first : {}
                      Severity: Minor
                      Found in lib/active_scaffold/extensions/action_controller_rendering.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 set_outer_joins_for_search has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def set_outer_joins_for_search(columns) # rubocop:disable Naming/AccessorMethodName
                              references = []
                              outer_joins = []
                              columns.each do |column|
                                next if column.search_joins.blank?
                      Severity: Minor
                      Found in lib/active_scaffold/actions/common_search.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 cache_association has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def cache_association(association, column, size)
                              associated_limit = column.associated_limit
                              # we are not using eager loading, cache firsts records in order not to query the database for whole association in a future
                              if associated_limit.nil?
                                logger.warn "ActiveScaffold: Enable eager loading for #{column.name} association to reduce SQL queries"
                      Severity: Minor
                      Found in lib/active_scaffold/helpers/list_column_helpers.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 active_scaffold_human_condition_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                            def active_scaffold_human_condition_for(column)
                              return if (value = field_search_params[column.name.to_s]).nil?
                      
                              search_ui = column.search_ui
                              search_ui ||= column.column_type if column.column
                      Severity: Minor
                      Found in lib/active_scaffold/helpers/human_condition_helpers.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