Showing 70 of 70 total issues
Use include MoreCoreExtensions::ArrayStretch
instead of send(:include, MoreCoreExtensions::ArrayStretch)
. Open
Array.send(:include, MoreCoreExtensions::ArrayStretch)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use include MoreCoreExtensions::HashDeletes
instead of send(:include, MoreCoreExtensions::HashDeletes)
. Open
Hash.send(:include, MoreCoreExtensions::HashDeletes)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use extend MoreCoreExtensions::MathSlope::ClassMethods
instead of send(:extend, MoreCoreExtensions::MathSlope::ClassMethods)
. Open
Math.send(:extend, MoreCoreExtensions::MathSlope::ClassMethods)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use extend MoreCoreExtensions::ProcessPauseResume
instead of send(:extend, MoreCoreExtensions::ProcessPauseResume)
. Open
Process.send(:extend, MoreCoreExtensions::ProcessPauseResume)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use include MoreCoreExtensions::ArrayDuplicates
instead of send(:include, MoreCoreExtensions::ArrayDuplicates)
. Open
Array.send(:include, MoreCoreExtensions::ArrayDuplicates)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use include MoreCoreExtensions::ArrayNested
instead of send(:include, MoreCoreExtensions::ArrayNested)
. Open
Array.send(:include, MoreCoreExtensions::ArrayNested)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use include MoreCoreExtensions::ClassHierarchy
instead of send(:include, MoreCoreExtensions::ClassHierarchy)
. Open
Class.send(:include, MoreCoreExtensions::ClassHierarchy)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use include MoreCoreExtensions::HashSortBang
instead of send(:include, MoreCoreExtensions::HashSortBang)
. Open
Hash.send(:include, MoreCoreExtensions::HashSortBang) unless Hash.method_defined?(:sort!)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use sum { ... }
instead of map { ... }.sum
. Open
sum_y2 = y_array.map(&:square).sum
- Exclude checks
Use include MoreCoreExtensions::RangeStepValue
instead of send(:include, MoreCoreExtensions::RangeStepValue)
. Open
Range.send(:include, MoreCoreExtensions::RangeStepValue)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use include MoreCoreExtensions::StringFormats
instead of send(:include, MoreCoreExtensions::StringFormats)
. Open
String.send(:include, MoreCoreExtensions::StringFormats)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Wrap expressions with varying precedence with parentheses to avoid ambiguity. Open
"0x%08x #{"%02x " * bytes.size}#{padding} " % [pos, *bytes] << "#{byte_chars}#{newline}"
- Read upRead up
- Exclude checks
Looks for expressions containing multiple binary operators
where precedence is ambiguous due to lack of parentheses. For example,
in 1 + 2 * 3
, the multiplication will happen before the addition, but
lexically it appears that the addition will happen first.
The cop does not consider unary operators (ie. !a
or -b
) or comparison
operators (ie. a =~ b
) because those are not ambiguous.
NOTE: Ranges are handled by Lint/AmbiguousRange
.
Example:
# bad
a + b * c
a || b && c
a ** b + c
# good (different precedence)
a + (b * c)
a || (b && c)
(a ** b) + c
# good (same precedence)
a + b + c
a * b / c % d
Use prepend MoreCoreExtensions::NumericAndNilToIWithMethod
instead of send(:prepend, MoreCoreExtensions::NumericAndNilToIWithMethod)
. Open
NilClass.send(:prepend, MoreCoreExtensions::NumericAndNilToIWithMethod)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use include MoreCoreExtensions::ArrayInclusions
instead of send(:include, MoreCoreExtensions::ArrayInclusions)
. Open
Array.send(:include, MoreCoreExtensions::ArrayInclusions)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use include MoreCoreExtensions::StringHexDump
instead of send(:include, MoreCoreExtensions::StringHexDump)
. Open
String.send(:include, MoreCoreExtensions::StringHexDump)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use include MoreCoreExtensions::ArrayMath
instead of send(:include, MoreCoreExtensions::ArrayMath)
. Open
Array.send(:include, MoreCoreExtensions::ArrayMath)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use include MoreCoreExtensions::ObjectNamespace
instead of send(:include, MoreCoreExtensions::ObjectNamespace)
. Open
Object.send(:include, MoreCoreExtensions::ObjectNamespace)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use prepend MoreCoreExtensions::NumericAndNilToIWithMethod
instead of send(:prepend, MoreCoreExtensions::NumericAndNilToIWithMethod)
. Open
Numeric.send(:prepend, MoreCoreExtensions::NumericAndNilToIWithMethod)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use include MoreCoreExtensions::ArrayElementCounts
instead of send(:include, MoreCoreExtensions::ArrayElementCounts)
. Open
Array.send(:include, MoreCoreExtensions::ArrayElementCounts)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar
Use extend MoreCoreExtensions::BenchmarkRealtimeStore
instead of send(:extend, MoreCoreExtensions::BenchmarkRealtimeStore)
. Open
Benchmark.send(:extend, MoreCoreExtensions::BenchmarkRealtimeStore)
- Read upRead up
- Exclude checks
Checks for send
, public_send
, and __send__
methods
when using mix-in.
include
and prepend
methods were private methods until Ruby 2.0,
they were mixed-in via send
method. This cop uses Ruby 2.1 or
higher style that can be called by public methods.
And extend
method that was originally a public method is also targeted
for style unification.
Example:
# bad
Foo.send(:include, Bar)
Foo.send(:prepend, Bar)
Foo.send(:extend, Bar)
# bad
Foo.public_send(:include, Bar)
Foo.public_send(:prepend, Bar)
Foo.public_send(:extend, Bar)
# bad
Foo.__send__(:include, Bar)
Foo.__send__(:prepend, Bar)
Foo.__send__(:extend, Bar)
# good
Foo.include Bar
Foo.prepend Bar
Foo.extend Bar