codeclimate/minidoc

View on GitHub
lib/minidoc/validations.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
94%

Method has too many lines. [16/10]
Open

    def validate_each(record, attribute, value)
      conditions = scope_conditions(record)

      if options[:case_sensitive]
        conditions[attribute] = value
Severity: Minor
Found in lib/minidoc/validations.rb by rubocop

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.

Use nested module/class definitions instead of compact style.
Open

module Minidoc::Validations
Severity: Minor
Found in lib/minidoc/validations.rb by rubocop

This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

Example: EnforcedStyle: nested (default)

# good
# have each child on its own line
class Foo
  class Bar
  end
end

Example: EnforcedStyle: compact

# good
# combine definitions as much as possible
class Foo::Bar
end

The compact style is only forced for classes/modules with one child.

Put a comma after the last parameter of a multiline method call.
Open

          options.except(:case_sensitive, :scope).merge(value: value)
Severity: Minor
Found in lib/minidoc/validations.rb by rubocop

This cop checks for trailing comma in argument lists.

Example: EnforcedStyleForMultiline: consistent_comma

# bad
method(1, 2,)

# good
method(
  1, 2,
  3,
)

# good
method(
  1,
  2,
)

Example: EnforcedStyleForMultiline: comma

# bad
method(1, 2,)

# good
method(
  1,
  2,
)

Example: EnforcedStyleForMultiline: no_comma (default)

# bad
method(1, 2,)

# good
method(
  1,
  2
)

Missing magic comment # frozen_string_literal: true.
Open

module Minidoc::Validations
Severity: Minor
Found in lib/minidoc/validations.rb by rubocop

This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

Example: EnforcedStyle: when_needed (default)

# The `when_needed` style will add the frozen string literal comment
# to files only when the `TargetRubyVersion` is set to 2.3+.
# bad
module Foo
  # ...
end

# good
# frozen_string_literal: true

module Foo
  # ...
end

Example: EnforcedStyle: always

# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
  # ...
end

# good
# frozen_string_literal: true

module Bar
  # ...
end

Example: EnforcedStyle: never

# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true

module Baz
  # ...
end

# good
module Baz
  # ...
end

Use the return of the conditional for variable assignment and comparison.
Open

      if options[:case_sensitive]
        conditions[attribute] = value
      else
        conditions[attribute] = /^#{Regexp.escape(value.to_s)}$/i
      end
Severity: Minor
Found in lib/minidoc/validations.rb by rubocop

There are no issues that match your filters.

Category
Status