netzke/netzke-basepack

View on GitHub
lib/netzke/grid/services.rb

Summary

Maintainability
A
1 hr
Test Coverage

Method normalize_filters has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

      def normalize_filters(filters)
        filters.map do |f|
          { attr: f["property"], value: f["value"], operator: f["operator"] }.tap do |norm|

            # Ext JS filters send us date in the American format
Severity: Minor
Found in lib/netzke/grid/services.rb - 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

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

      def update_record(record, attrs)
        attrs.each_pair do |k,v|
          attr = final_columns_hash[k.to_sym]
          next if attr.nil?
          model_adapter.set_record_value_for_attribute(record, attr, v)
Severity: Minor
Found in lib/netzke/grid/services.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 destroy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def destroy(ids)
        out = {}

        ids.each {|id|
          record = model_adapter.find_record(id, scope: config[:scope])
Severity: Minor
Found in lib/netzke/grid/services.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

There are no issues that match your filters.

Category
Status