zeisler/active_mocker

View on GitHub
lib/active_mocker/mock_creator/modules_constants.rb

Summary

Maintainability
A
25 mins
Test Coverage

Assignment Branch Condition size for get_module_by_reference is too high. [24.54/15] (http://c2.com/cgi/wiki?AbcMetric)
Open

      def get_module_by_reference(type)
        isolated_module_names = reject_local_const(class_introspector.public_send(type)).map(&:referenced_name)
        real_module_names     = get_real_module(type).map(&:name).compact
        isolated_module_names.map do |isolated_name|
          real_name = real_module_names.detect do |rmn|

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

Method has too many lines. [14/10] (https://github.com/bbatsov/ruby-style-guide#short-methods)
Open

      def get_module_by_reference(type)
        isolated_module_names = reject_local_const(class_introspector.public_send(type)).map(&:referenced_name)
        real_module_names     = get_real_module(type).map(&:name).compact
        isolated_module_names.map do |isolated_name|
          real_name = real_module_names.detect do |rmn|

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

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

      def constants
        class_introspector.get_class.constants.map do |v|
          c = class_introspector.get_class.const_get(v)
          next if [Module, Class].include?(c.class)
          const = if /\A#</ =~ c.inspect
Severity: Minor
Found in lib/active_mocker/mock_creator/modules_constants.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

Keep a blank line before and after private. (https://github.com/bbatsov/ruby-style-guide#empty-lines-around-access-modifier)
Open

      private

Access modifiers should be surrounded by blank lines.

Example:

# bad
class Foo
  def bar; end
  private
  def baz; end
end

# good
class Foo
  def bar; end

  private

  def baz; end
end

Avoid comma after the last item of a hash. (https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas)
Open

            extended: get_module_by_reference(:extended_modules),

This cop checks for trailing comma in array and hash literals.

Example: EnforcedStyleForMultiline: consistent_comma

# bad
a = [1, 2,]

# good
a = [
  1, 2,
  3,
]

# good
a = [
  1,
  2,
]

Example: EnforcedStyleForMultiline: comma

# bad
a = [1, 2,]

# good
a = [
  1,
  2,
]

Example: EnforcedStyleForMultiline: no_comma (default)

# bad
a = [1, 2,]

# good
a = [
  1,
  2
]

Add an empty line after magic comments. (https://github.com/bbatsov/ruby-style-guide#separate-magic-comments-from-code)
Open

module ActiveMocker

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

There are no issues that match your filters.

Category
Status