decko-commons/decko

View on GitHub
card/lib/card/content/chunk.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
95%

Assignment Branch Condition size for register_class is too high. [16.61/15]
Open

        def register_class klass, hash
          klass.config = hash.merge class: klass
          prefix_index = hash[:idx_char] || :default
          # ^ this is gross and needs to be moved out.

Severity: Minor
Found in card/lib/card/content/chunk.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Replace class var @@prefix_map_by_chunkname with a class instance var.
Open

      @@prefix_map_by_chunkname = {}
Severity: Minor
Found in card/lib/card/content/chunk.rb by rubocop

This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

Replace class var @@raw_list with a class instance var.
Open

      @@raw_list = {}
Severity: Minor
Found in card/lib/card/content/chunk.rb by rubocop

This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

Replace class var @@prefix_regexp_by_list with a class instance var.
Open

      @@prefix_regexp_by_list = {}
Severity: Minor
Found in card/lib/card/content/chunk.rb by rubocop

This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

Replace class var @@prefix_map_by_list with a class instance var.
Open

      @@prefix_map_by_list = Hash.new { |h, k| h[k] = {} }
Severity: Minor
Found in card/lib/card/content/chunk.rb by rubocop

This cop checks for uses of class variables. Offenses are signaled only on assignment to class variables to reduce the number of offenses that would be reported.

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

          unless raw_list.key? chunk_list_key
Severity: Minor
Found in card/lib/card/content/chunk.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

There are no issues that match your filters.

Category
Status