ekylibre/active_list

View on GitHub

Showing 48 of 54 total issues

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

      def currency_for(record)
        currency = options[:currency]
        if currency
          currency = currency[:body] if currency.is_a?(Hash)
          currency = :currency if currency.is_a?(TrueClass)
Severity: Minor
Found in lib/active_list/definition/data_column.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 default_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def default_url(use_mode = :many)
        url = @options[:url] ||= {}
        url[:controller] ||= (@options[:controller] || table.model.name.tableize)
        url[:action] ||= @name.to_s
        url[:format] = @options[:format] if @options.key? :format
Severity: Minor
Found in lib/active_list/definition/action_column.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_sort_column has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def get_sort_column
        selects = @table.options[:select] || {}
        selects_label = selects.find { |sql_name, name| name.to_s == @label_method.to_s }&.last
        selects_name = selects.find { |sql_name, name| name.to_s == @name.to_s }&.last
        if (selects_label || selects_name) && options[:sort].blank?
Severity: Minor
Found in lib/active_list/definition/attribute_column.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 datum_code has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def datum_code(record = 'record_of_the_death', child = false)
        code = ''
        code = if child
                 if @options[:children].is_a?(FalseClass)
                   'nil'
Severity: Minor
Found in lib/active_list/definition/attribute_column.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(*args, &_block)
      options = args.extract_options!
      @controller = options[:controller]
      name = args.shift || @controller.controller_name.to_sym
      model = (options[:model] || name).to_s.classify.constantize
Severity: Minor
Found in lib/active_list/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

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

    def conditions_code
      conditions = @table.options[:conditions]
      code = ''
      case conditions
      when Array
Severity: Minor
Found in lib/active_list/generator/finder.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 column has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def column(name, options = {})
        if @model.reflect_on_association(name)
          options[:through] ||= name
          add :association, name, options
        elsif options[:through] && @model.reflect_on_association(options[:through])
Severity: Minor
Found in lib/active_list/definition/table.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 datum_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def datum_value(record = 'record of the death', child = false)
        code = ''
        code = if child
                 if @options[:childer].is_a?(FalseClass)
                   'nil'
Severity: Minor
Found in lib/active_list/definition/attribute_column.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