ManageIQ/more_core_extensions

View on GitHub

Showing 70 of 70 total issues

Use include MoreCoreExtensions::ArrayStretch instead of send(:include, MoreCoreExtensions::ArrayStretch).
Open

Array.send(:include, MoreCoreExtensions::ArrayStretch)

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)

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)

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)

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)

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)

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)

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!)

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

Use include MoreCoreExtensions::RangeStepValue instead of send(:include, MoreCoreExtensions::RangeStepValue).
Open

Range.send(:include, MoreCoreExtensions::RangeStepValue)

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)

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}"

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)

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)

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)

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)

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)

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)

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)

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)

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
Severity
Category
Status
Source
Language