PikachuEXE/rspec-json_matchers

View on GitHub
lib/rspec/json_matchers/expectations/mixins/built_in.rb

Summary

Maintainability
A
0 mins
Test Coverage

Align the operands of a condition in an unless statement spanning multiple lines.
Open

                    actual_value.key?(exp_key.to_s)

This cop checks the indentation of the right hand side operand in binary operations that span more than one line.

Example:

# bad
if a +
b
  something
end

# good
if a +
   b
  something
end

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

require_relative "../core"

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Use Integer instead of Bignum.
Open

                  Bignum => ->(v) { Expectations::Private::Eq[v] },

This cop checks for using Fixnum or Bignum constant.

Example:

# bad

1.is_a?(Fixnum)
1.is_a?(Bignum)

Example:

# good

1.is_a?(Integer)

Line is too long. [84/80]
Open

          class HashWithContent < Expectations::Core::SingleValueCallableExpectation

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

require "set"

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

require_relative "../abstract"

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Use alias instead of alias_method in a class body.
Open

            alias_method(

This cop enforces the use of either #alias or #alias_method depending on configuration. It also flags uses of alias :symbol rather than alias bareword.

Example: EnforcedStyle: prefer_alias (default)

# bad
alias_method :bar, :foo
alias :bar :foo

# good
alias bar foo

Example: EnforcedStyle: preferaliasmethod

# bad
alias :bar :foo
alias bar foo

# good
alias_method :bar, :foo

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

require "abstract_class"

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Use Integer instead of Fixnum.
Open

                  Fixnum => ->(v) { Expectations::Private::Eq[v] },

This cop checks for using Fixnum or Bignum constant.

Example:

# bad

1.is_a?(Fixnum)
1.is_a?(Bignum)

Example:

# good

1.is_a?(Integer)

Reverse the order of the operands false == value.
Open

              true == value || false == value

This cop checks for Yoda conditions, i.e. comparison operations where readability is reduced because the operands are not ordered the same way as they would be ordered in spoken English.

Example: EnforcedStyle: allcomparisonoperators (default)

# bad
99 == foo
"bar" != foo
42 >= foo
10 < bar

# good
foo == 99
foo == "bar"
foo <= 42
bar > 10

Example: EnforcedStyle: equalityoperatorsonly

# bad
99 == foo
"bar" != foo

# good
99 >= foo
3 < a && a < 5

Avoid comma after the last item of a hash.
Open

                Integer => ->(v) { Expectations::Private::Eq[v] },

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
]

Reverse the order of the operands true == value.
Open

              true == value || false == value

This cop checks for Yoda conditions, i.e. comparison operations where readability is reduced because the operands are not ordered the same way as they would be ordered in spoken English.

Example: EnforcedStyle: allcomparisonoperators (default)

# bad
99 == foo
"bar" != foo
42 >= foo
10 < bar

# good
foo == 99
foo == "bar"
foo <= 42
bar > 10

Example: EnforcedStyle: equalityoperatorsonly

# bad
99 == foo
"bar" != foo

# good
99 >= foo
3 < a && a < 5

Avoid comma after the last parameter of a method call.
Open

                  Bignum => ->(v) { Expectations::Private::Eq[v] },

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
)

Avoid comma after the last parameter of a method call.
Open

              :require_exact_key_matches,

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
)

There are no issues that match your filters.

Category
Status