zeisler/active_mocker

View on GitHub

Showing 235 of 235 total issues

Operator = should be surrounded by a single space. (https://github.com/bbatsov/ruby-style-guide#spaces-operators)
Open

      DEFAULTS                      = {

Checks that operators have space around them, except for ** which should not have surrounding space.

Example:

# bad
total = 3*4
"apple"+"juice"
my_number = 38/4
a ** b

# good
total = 3 * 4
"apple" + "juice"
my_number = 38 / 4
a**b

Put a comma after the last parameter of a multiline method call. (https://github.com/bbatsov/ruby-style-guide#no-trailing-params-comma)
Open

            def_method.body

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
)

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

      def has_and_belongs_to_many

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

Unnecessary utf-8 encoding comment. (https://github.com/bbatsov/ruby-style-guide#utf-8)
Open

# coding: utf-8
Severity: Minor
Found in active_mocker.gemspec by rubocop

Please use Rails.root.join('path', 'to') instead.
Open

        @mock_dir  = File.join(Rails.root, "spec/mocks") unless @mock_dir
Severity: Minor
Found in lib/active_mocker/config.rb by rubocop

This cop is used to identify usages of file path joining process to use Rails.root.join clause.

Example:

# bad Rails.root.join('app/models/goober') File.join(Rails.root, 'app/models/goober') "#{Rails.root}/app/models/goober"

# good Rails.root.join('app', 'models', 'goober')

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

require "active_mocker/loaded_mocks"
Severity: Minor
Found in lib/active_mocker/rspec_helper.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

Surrounding space missing in default value assignment. (https://github.com/bbatsov/ruby-style-guide#spaces-around-equals)
Open

    def plural(string, count, plural="s")
Severity: Minor
Found in lib/active_mocker/display_errors.rb by rubocop

Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

Example:

# bad
def some_method(arg1=:default, arg2=nil, arg3=[])
  # do something...
end

# good
def some_method(arg1 = :default, arg2 = nil, arg3 = [])
  # do something...
end

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

              all_methods_safe: all_methods_safe,

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
]

Line is too long. [167/120] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

            attr.attribute_reader = "@#{attr.name}_enum_type ||= Virtus::Attribute.build(#{enum_type})\n@#{attr.name}_enum_type.get_key(read_attribute(:#{attr.name}))"

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

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

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

require "rubygems"
Severity: Minor
Found in Rakefile 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

Please use Rails.root.join('path', 'to') instead.
Open

        @model_dir = File.join(Rails.root, "app/models") unless @model_dir
Severity: Minor
Found in lib/active_mocker/config.rb by rubocop

This cop is used to identify usages of file path joining process to use Rails.root.join clause.

Example:

# bad Rails.root.join('app/models/goober') File.join(Rails.root, 'app/models/goober') "#{Rails.root}/app/models/goober"

# good Rails.root.join('app', 'models', 'goober')

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

require "active_mocker/inspectable"
Severity: Minor
Found in lib/active_mocker/mock_creator.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

Use a guard clause instead of wrapping the code inside a conditional expression. (https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals)
Open

      if value.nil? || value.empty?
Severity: Minor
Found in lib/active_mocker/generate.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

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/public_methods.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

Use snake_case for method names. (https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars)
Open

      def File

This cop makes sure that all methods use the configured style, snake_case or camelCase, for their names.

Example: EnforcedStyle: snake_case (default)

# bad
def fooBar; end

# good
def foo_bar; end

Example: EnforcedStyle: camelCase

# bad
def foo_bar; end

# good
def fooBar; end

Prefer annotated tokens (like %<foo>s</foo>) over unannotated tokens (like %s).
Open

        "BigDecimal(\"%s\")" % to_s('F')

Use a consistent style for named format string tokens.

Note: unannotated style cop only works for strings which are passed as arguments to those methods: sprintf, format, %. The reason is that unannotated format is very similar to encoded URLs or Date/Time formatting strings.

Example: EnforcedStyle: annotated (default)

# bad
format('%{greeting}', greeting: 'Hello')
format('%s', 'Hello')

# good
format('%<greeting>s', greeting: 'Hello')</greeting>

Example: EnforcedStyle: template

# bad
format('%<greeting>s', greeting: 'Hello')
format('%s', 'Hello')

# good
format('%{greeting}', greeting: 'Hello')</greeting>

Example: EnforcedStyle: unannotated

# bad
format('%<greeting>s', greeting: 'Hello')
format('%{greeting}', 'Hello')

# good
format('%s', 'Hello')</greeting>

Dependencies should be sorted in an alphabetical order within their section of the gemspec. Dependency colorize should appear before ruby-progressbar.
Open

  spec.add_runtime_dependency "colorize", "~> 0.7", ">= 0.7"
Severity: Minor
Found in active_mocker.gemspec by rubocop

Dependencies in the gemspec should be alphabetically sorted.

Example:

# bad
spec.add_dependency 'rubocop'
spec.add_dependency 'rspec'

# good
spec.add_dependency 'rspec'
spec.add_dependency 'rubocop'

# good
spec.add_dependency 'rubocop'

spec.add_dependency 'rspec'

# bad
spec.add_development_dependency 'rubocop'
spec.add_development_dependency 'rspec'

# good
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rubocop'

# good
spec.add_development_dependency 'rubocop'

spec.add_development_dependency 'rspec'

# bad
spec.add_runtime_dependency 'rubocop'
spec.add_runtime_dependency 'rspec'

# good
spec.add_runtime_dependency 'rspec'
spec.add_runtime_dependency 'rubocop'

# good
spec.add_runtime_dependency 'rubocop'

spec.add_runtime_dependency 'rspec'

# good only if TreatCommentsAsGroupSeparators is true
# For code quality
spec.add_dependency 'rubocop'
# For tests
spec.add_dependency 'rspec'

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

desc "setup"
Severity: Minor
Found in tasks/setup.rake 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
Severity
Category
Status
Source
Language