zeisler/active_mocker

View on GitHub
lib/active_mocker/mock/queries.rb

Summary

Maintainability
A
0 mins
Test Coverage

Module has too many lines. [119/100]
Open

  module Queries
    extend LateInclusion

    class Find
      def initialize(record)
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

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

Use only ascii symbols in comments. (https://github.com/bbatsov/ruby-style-guide#english-comments)
Open

    #   # Find the first user named "Penélope" or create a new one.
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

Rename is_of to of?. (https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark)
Open

      def is_of(conditions = {})
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

This cop makes sure that predicates are named properly.

Example:

# bad
def is_even?(value)
end

# good
def even?(value)
end

# bad
def has_value?
end

# good
def value?
end

Use only ascii symbols in comments. (https://github.com/bbatsov/ruby-style-guide#english-comments)
Open

    #   # => #<User id: 1, first_name: "Penélope", last_name: nil>
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

Use only ascii symbols in comments. (https://github.com/bbatsov/ruby-style-guide#english-comments)
Open

    #   UserMock.find_or_create_by(first_name: 'Penélope')
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

Use only ascii symbols in comments. (https://github.com/bbatsov/ruby-style-guide#english-comments)
Open

    #   # => #<User id: 1, first_name: "Penélope", last_name: nil>
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

Provide an exception class and message as arguments to raise. (https://github.com/bbatsov/ruby-style-guide#exception-class-messages)
Open

      raise ActiveMocker::Error.new("delete_all doesn't support limit scope") if from_limit?
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

This cop checks the args passed to fail and raise. For exploded style (default), it recommends passing the exception class and message to raise, rather than construct an instance of the error. It will still allow passing just a message, or the construction of an error with more than one argument.

The exploded style works identically, but with the addition that it will also suggest constructing error objects when the exception is passed multiple arguments.

Example: EnforcedStyle: exploded (default)

# bad
raise StandardError.new("message")

# good
raise StandardError, "message"
fail "message"
raise MyCustomError.new(arg1, arg2, arg3)
raise MyKwArgError.new(key1: val1, key2: val2)

Example: EnforcedStyle: compact

# bad
raise StandardError, "message"
raise RuntimeError, arg1, arg2, arg3

# good
raise StandardError.new("message")
raise MyCustomError.new(arg1, arg2, arg3)
fail "message"

Provide an exception class and message as arguments to raise. (https://github.com/bbatsov/ruby-style-guide#exception-class-messages)
Open

        raise RecordNotFound.new("Couldn't find #{name} with '#{conditions.keys.first}'=#{conditions.values.first}")
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

This cop checks the args passed to fail and raise. For exploded style (default), it recommends passing the exception class and message to raise, rather than construct an instance of the error. It will still allow passing just a message, or the construction of an error with more than one argument.

The exploded style works identically, but with the addition that it will also suggest constructing error objects when the exception is passed multiple arguments.

Example: EnforcedStyle: exploded (default)

# bad
raise StandardError.new("message")

# good
raise StandardError, "message"
fail "message"
raise MyCustomError.new(arg1, arg2, arg3)
raise MyKwArgError.new(key1: val1, key2: val2)

Example: EnforcedStyle: compact

# bad
raise StandardError, "message"
raise RuntimeError, arg1, arg2, arg3

# good
raise StandardError.new("message")
raise MyCustomError.new(arg1, arg2, arg3)
fail "message"

Use only ascii symbols in comments. (https://github.com/bbatsov/ruby-style-guide#english-comments)
Open

    #   # Find the first user named "Penélope" or create a new one.
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

Use only ascii symbols in comments. (https://github.com/bbatsov/ruby-style-guide#english-comments)
Open

    #   UserMock.find_or_create_by(first_name: 'Penélope')
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

This cop checks for non-ascii (non-English) characters in comments. You could set an array of allowed non-ascii chars in AllowedChars attribute (empty by default).

Example:

# bad
# Translates from English to 日本語。

# good
# Translates from English to Japanese

Provide an exception class and message as arguments to raise. (https://github.com/bbatsov/ruby-style-guide#exception-class-messages)
Open

      raise RecordNotFound.new("Couldn't find #{name} without an ID") if ids.nil?
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

This cop checks the args passed to fail and raise. For exploded style (default), it recommends passing the exception class and message to raise, rather than construct an instance of the error. It will still allow passing just a message, or the construction of an error with more than one argument.

The exploded style works identically, but with the addition that it will also suggest constructing error objects when the exception is passed multiple arguments.

Example: EnforcedStyle: exploded (default)

# bad
raise StandardError.new("message")

# good
raise StandardError, "message"
fail "message"
raise MyCustomError.new(arg1, arg2, arg3)
raise MyKwArgError.new(key1: val1, key2: val2)

Example: EnforcedStyle: compact

# bad
raise StandardError, "message"
raise RuntimeError, arg1, arg2, arg3

# good
raise StandardError.new("message")
raise MyCustomError.new(arg1, arg2, arg3)
fail "message"

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

module ActiveMocker
Severity: Minor
Found in lib/active_mocker/mock/queries.rb by rubocop

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