diff --git a/lib/rubocop/cop/performance/ancestors_include.rb b/lib/rubocop/cop/performance/ancestors_include.rb index 5d3b577428..a65db86b0c 100644 --- a/lib/rubocop/cop/performance/ancestors_include.rb +++ b/lib/rubocop/cop/performance/ancestors_include.rb @@ -3,8 +3,7 @@ module RuboCop module Cop module Performance - # This cop is used to identify usages of `ancestors.include?` and - # change them to use `<=` instead. + # Identifies usages of `ancestors.include?` and change them to use `<=` instead. # # @safety # This cop is unsafe because it can't tell whether the receiver is a class or an object. diff --git a/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb b/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb index 04f417fd2a..a81b40f132 100644 --- a/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb +++ b/lib/rubocop/cop/performance/array_semi_infinite_range_slice.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where slicing arrays with semi-infinite ranges + # Identifies places where slicing arrays with semi-infinite ranges # can be replaced by `Array#take` and `Array#drop`. # This cop was created due to a mistake in microbenchmark and hence is disabled by default. # Refer https://github.com/rubocop/rubocop-performance/pull/175#issuecomment-731892717 diff --git a/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb b/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb index dfddc2e59f..d41d38c397 100644 --- a/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb +++ b/lib/rubocop/cop/performance/big_decimal_with_numeric_argument.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where numeric argument to BigDecimal should be + # Identifies places where numeric argument to BigDecimal should be # converted to string. Initializing from String is faster # than from Numeric for BigDecimal. # diff --git a/lib/rubocop/cop/performance/block_given_with_explicit_block.rb b/lib/rubocop/cop/performance/block_given_with_explicit_block.rb index e8c32d0194..4c717d2774 100644 --- a/lib/rubocop/cop/performance/block_given_with_explicit_block.rb +++ b/lib/rubocop/cop/performance/block_given_with_explicit_block.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies unnecessary use of a `block_given?` where explicit check + # Identifies unnecessary use of a `block_given?` where explicit check # of block argument would suffice. # # @example diff --git a/lib/rubocop/cop/performance/caller.rb b/lib/rubocop/cop/performance/caller.rb index a071c04b8c..bba8758a6b 100644 --- a/lib/rubocop/cop/performance/caller.rb +++ b/lib/rubocop/cop/performance/caller.rb @@ -3,8 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where `caller[n]` - # can be replaced by `caller(n..n).first`. + # Identifies places where `caller[n]` can be replaced by `caller(n..n).first`. # # @example # # bad diff --git a/lib/rubocop/cop/performance/casecmp.rb b/lib/rubocop/cop/performance/casecmp.rb index 96cb8d4745..29471c7d59 100644 --- a/lib/rubocop/cop/performance/casecmp.rb +++ b/lib/rubocop/cop/performance/casecmp.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where a case-insensitive string comparison + # Identifies places where a case-insensitive string comparison # can better be implemented using `casecmp`. # # @safety diff --git a/lib/rubocop/cop/performance/chain_array_allocation.rb b/lib/rubocop/cop/performance/chain_array_allocation.rb index 3d589261c9..84a33f53f7 100644 --- a/lib/rubocop/cop/performance/chain_array_allocation.rb +++ b/lib/rubocop/cop/performance/chain_array_allocation.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop is used to identify usages of `array.compact.flatten.map { |x| x.downcase }`. + # Identifies usages of `array.compact.flatten.map { |x| x.downcase }`. # Each of these methods (`compact`, `flatten`, `map`) will generate a new intermediate array # that is promptly thrown away. Instead it is faster to mutate when we know it's safe. # diff --git a/lib/rubocop/cop/performance/collection_literal_in_loop.rb b/lib/rubocop/cop/performance/collection_literal_in_loop.rb index a9c5130ff3..5803594fa7 100644 --- a/lib/rubocop/cop/performance/collection_literal_in_loop.rb +++ b/lib/rubocop/cop/performance/collection_literal_in_loop.rb @@ -5,8 +5,8 @@ module RuboCop module Cop module Performance - # This cop identifies places where Array and Hash literals are used - # within loops. It is better to extract them into a local variable or constant + # Identifies places where Array and Hash literals are used within loops. + # It is better to extract them into a local variable or constant # to avoid unnecessary allocations on each iteration. # # You can set the minimum number of elements to consider diff --git a/lib/rubocop/cop/performance/compare_with_block.rb b/lib/rubocop/cop/performance/compare_with_block.rb index de782cbf70..cfbbb1de9b 100644 --- a/lib/rubocop/cop/performance/compare_with_block.rb +++ b/lib/rubocop/cop/performance/compare_with_block.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where `sort { |a, b| a.foo <=> b.foo }` + # Identifies places where `sort { |a, b| a.foo <=> b.foo }` # can be replaced by `sort_by(&:foo)`. # This cop also checks `max` and `min` methods. # diff --git a/lib/rubocop/cop/performance/concurrent_monotonic_time.rb b/lib/rubocop/cop/performance/concurrent_monotonic_time.rb index a636b00cfb..9756070b91 100644 --- a/lib/rubocop/cop/performance/concurrent_monotonic_time.rb +++ b/lib/rubocop/cop/performance/concurrent_monotonic_time.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where `Concurrent.monotonic_time` + # Identifies places where `Concurrent.monotonic_time` # can be replaced by `Process.clock_gettime(Process::CLOCK_MONOTONIC)`. # # @example diff --git a/lib/rubocop/cop/performance/constant_regexp.rb b/lib/rubocop/cop/performance/constant_regexp.rb index dcb55dd0fd..af70c73966 100644 --- a/lib/rubocop/cop/performance/constant_regexp.rb +++ b/lib/rubocop/cop/performance/constant_regexp.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop finds regular expressions with dynamic components that are all constants. + # Finds regular expressions with dynamic components that are all constants. # # Ruby allocates a new Regexp object every time it executes a code containing such # a regular expression. It is more efficient to extract it into a constant, diff --git a/lib/rubocop/cop/performance/count.rb b/lib/rubocop/cop/performance/count.rb index 935ba4cd12..d3d3233570 100644 --- a/lib/rubocop/cop/performance/count.rb +++ b/lib/rubocop/cop/performance/count.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop is used to identify usages of `count` on an `Enumerable` that + # Identifies usages of `count` on an `Enumerable` that # follow calls to `select`, `find_all`, `filter` or `reject`. Querying logic can instead be # passed to the `count` call. # diff --git a/lib/rubocop/cop/performance/detect.rb b/lib/rubocop/cop/performance/detect.rb index 7ad329cddd..1cee1e8d93 100644 --- a/lib/rubocop/cop/performance/detect.rb +++ b/lib/rubocop/cop/performance/detect.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop is used to identify usages of `first`, `last`, `[0]` or `[-1]` + # Identifies usages of `first`, `last`, `[0]` or `[-1]` # chained to `select`, `find_all` or `filter` and change them to use # `detect` instead. # diff --git a/lib/rubocop/cop/performance/double_start_end_with.rb b/lib/rubocop/cop/performance/double_start_end_with.rb index d9af50cfd4..3f922ba502 100644 --- a/lib/rubocop/cop/performance/double_start_end_with.rb +++ b/lib/rubocop/cop/performance/double_start_end_with.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop checks for double `#start_with?` or `#end_with?` calls + # Checks for double `#start_with?` or `#end_with?` calls # separated by `||`. In some cases such calls can be replaced # with an single `#start_with?`/`#end_with?` call. # diff --git a/lib/rubocop/cop/performance/end_with.rb b/lib/rubocop/cop/performance/end_with.rb index b9b19fff12..460367be6c 100644 --- a/lib/rubocop/cop/performance/end_with.rb +++ b/lib/rubocop/cop/performance/end_with.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies unnecessary use of a regex where `String#end_with?` would suffice. + # Identifies unnecessary use of a regex where `String#end_with?` would suffice. # # This cop has `SafeMultiline` configuration option that `true` by default because # `end$` is unsafe as it will behave incompatible with `end_with?` diff --git a/lib/rubocop/cop/performance/flat_map.rb b/lib/rubocop/cop/performance/flat_map.rb index 3276a9beb4..29cd0fe62e 100644 --- a/lib/rubocop/cop/performance/flat_map.rb +++ b/lib/rubocop/cop/performance/flat_map.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop is used to identify usages of `map { ... }.flatten` and + # Identifies usages of `map { ... }.flatten` and # change them to use `flat_map { ... }` instead. # # @example diff --git a/lib/rubocop/cop/performance/inefficient_hash_search.rb b/lib/rubocop/cop/performance/inefficient_hash_search.rb index cf6cf6e432..3c354e3b99 100644 --- a/lib/rubocop/cop/performance/inefficient_hash_search.rb +++ b/lib/rubocop/cop/performance/inefficient_hash_search.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop checks for inefficient searching of keys and values within + # Checks for inefficient searching of keys and values within # hashes. # # `Hash#keys.include?` is less efficient than `Hash#key?` because diff --git a/lib/rubocop/cop/performance/io_readlines.rb b/lib/rubocop/cop/performance/io_readlines.rb index fb9d04b034..354bc7eca6 100644 --- a/lib/rubocop/cop/performance/io_readlines.rb +++ b/lib/rubocop/cop/performance/io_readlines.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where inefficient `readlines` method + # Identifies places where inefficient `readlines` method # can be replaced by `each_line` to avoid fully loading file content into memory. # # @example diff --git a/lib/rubocop/cop/performance/method_object_as_block.rb b/lib/rubocop/cop/performance/method_object_as_block.rb index 796ea10a10..8e342165a7 100644 --- a/lib/rubocop/cop/performance/method_object_as_block.rb +++ b/lib/rubocop/cop/performance/method_object_as_block.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where methods are converted to blocks, with the + # Identifies places where methods are converted to blocks, with the # use of `&method`, and passed as arguments to method calls. # It is faster to replace those with explicit blocks, calling those methods inside. # diff --git a/lib/rubocop/cop/performance/open_struct.rb b/lib/rubocop/cop/performance/open_struct.rb index 1395bd899c..9e4351eb70 100644 --- a/lib/rubocop/cop/performance/open_struct.rb +++ b/lib/rubocop/cop/performance/open_struct.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop checks for `OpenStruct.new` calls. + # Checks for `OpenStruct.new` calls. # Instantiation of an `OpenStruct` invalidates # Ruby global method cache as it causes dynamic method # definition during program runtime. diff --git a/lib/rubocop/cop/performance/range_include.rb b/lib/rubocop/cop/performance/range_include.rb index 8658c81312..1187bb3b4f 100644 --- a/lib/rubocop/cop/performance/range_include.rb +++ b/lib/rubocop/cop/performance/range_include.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies uses of `Range#include?` and `Range#member?`, which iterates over each + # Identifies uses of `Range#include?` and `Range#member?`, which iterates over each # item in a `Range` to see if a specified item is there. In contrast, # `Range#cover?` simply compares the target item with the beginning and # end points of the `Range`. In a great majority of cases, this is what diff --git a/lib/rubocop/cop/performance/redundant_block_call.rb b/lib/rubocop/cop/performance/redundant_block_call.rb index bf5a23dcc8..d3b6a3d992 100644 --- a/lib/rubocop/cop/performance/redundant_block_call.rb +++ b/lib/rubocop/cop/performance/redundant_block_call.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies the use of a `&block` parameter and `block.call` + # Identifies the use of a `&block` parameter and `block.call` # where `yield` would do just as well. # # @example diff --git a/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb b/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb index eb233388d3..0623a2fad7 100644 --- a/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb +++ b/lib/rubocop/cop/performance/redundant_equality_comparison_block.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`, + # Checks for uses `Enumerable#all?`, `Enumerable#any?`, `Enumerable#one?`, # and `Enumerable#none?` are compared with `===` or similar methods in block. # # By default, `Object#===` behaves the same as `Object#==`, but this diff --git a/lib/rubocop/cop/performance/redundant_match.rb b/lib/rubocop/cop/performance/redundant_match.rb index b75a8f856c..c2fa42c0c4 100644 --- a/lib/rubocop/cop/performance/redundant_match.rb +++ b/lib/rubocop/cop/performance/redundant_match.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies the use of `Regexp#match` or `String#match`, which + # Identifies the use of `Regexp#match` or `String#match`, which # returns `#`/`nil`. The return value of `=~` is an integral # index/`nil` and is more performant. # diff --git a/lib/rubocop/cop/performance/redundant_merge.rb b/lib/rubocop/cop/performance/redundant_merge.rb index 6bc5458e51..7dfb53a267 100644 --- a/lib/rubocop/cop/performance/redundant_merge.rb +++ b/lib/rubocop/cop/performance/redundant_merge.rb @@ -3,8 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where `Hash#merge!` can be replaced by - # `Hash#[]=`. + # Identifies places where `Hash#merge!` can be replaced by `Hash#[]=`. # You can set the maximum number of key-value pairs to consider # an offense with `MaxKeyValuePairs`. # diff --git a/lib/rubocop/cop/performance/redundant_sort_block.rb b/lib/rubocop/cop/performance/redundant_sort_block.rb index 698e5b3721..55c3af49cb 100644 --- a/lib/rubocop/cop/performance/redundant_sort_block.rb +++ b/lib/rubocop/cop/performance/redundant_sort_block.rb @@ -3,8 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where `sort { |a, b| a <=> b }` - # can be replaced with `sort`. + # Identifies places where `sort { |a, b| a <=> b }` can be replaced with `sort`. # # @example # # bad diff --git a/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb b/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb index 57ef30e556..77a0b95c64 100644 --- a/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb +++ b/lib/rubocop/cop/performance/redundant_split_regexp_argument.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where `split` argument can be replaced from + # Identifies places where `split` argument can be replaced from # a deterministic regexp to a string. # # @example diff --git a/lib/rubocop/cop/performance/redundant_string_chars.rb b/lib/rubocop/cop/performance/redundant_string_chars.rb index d0d4972881..000d887ced 100644 --- a/lib/rubocop/cop/performance/redundant_string_chars.rb +++ b/lib/rubocop/cop/performance/redundant_string_chars.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop checks for redundant `String#chars`. + # Checks for redundant `String#chars`. # # @example # # bad diff --git a/lib/rubocop/cop/performance/reverse_each.rb b/lib/rubocop/cop/performance/reverse_each.rb index 268c4e98cf..4be4fb7b03 100644 --- a/lib/rubocop/cop/performance/reverse_each.rb +++ b/lib/rubocop/cop/performance/reverse_each.rb @@ -3,8 +3,7 @@ module RuboCop module Cop module Performance - # This cop is used to identify usages of `reverse.each` and - # change them to use `reverse_each` instead. + # Identifies usages of `reverse.each` and change them to use `reverse_each` instead. # # If the return value is used, it will not be detected because the result will be different. # diff --git a/lib/rubocop/cop/performance/reverse_first.rb b/lib/rubocop/cop/performance/reverse_first.rb index 7db7f53e09..dde61bd38a 100644 --- a/lib/rubocop/cop/performance/reverse_first.rb +++ b/lib/rubocop/cop/performance/reverse_first.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where `reverse.first(n)` and `reverse.first` + # Identifies places where `reverse.first(n)` and `reverse.first` # can be replaced by `last(n).reverse` and `last`. # # @example diff --git a/lib/rubocop/cop/performance/size.rb b/lib/rubocop/cop/performance/size.rb index 4356c5d6e5..b107949a78 100644 --- a/lib/rubocop/cop/performance/size.rb +++ b/lib/rubocop/cop/performance/size.rb @@ -3,8 +3,7 @@ module RuboCop module Cop module Performance - # This cop is used to identify usages of `count` on an - # `Array` and `Hash` and change them to `size`. + # Identifies usages of `count` on an `Array` and `Hash` and change them to `size`. # # @example # # bad diff --git a/lib/rubocop/cop/performance/sort_reverse.rb b/lib/rubocop/cop/performance/sort_reverse.rb index 1b213b183d..301906804e 100644 --- a/lib/rubocop/cop/performance/sort_reverse.rb +++ b/lib/rubocop/cop/performance/sort_reverse.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where `sort { |a, b| b <=> a }` + # Identifies places where `sort { |a, b| b <=> a }` # can be replaced by a faster `sort.reverse`. # # @example diff --git a/lib/rubocop/cop/performance/squeeze.rb b/lib/rubocop/cop/performance/squeeze.rb index 315e5e3a23..3b7c0bfb58 100644 --- a/lib/rubocop/cop/performance/squeeze.rb +++ b/lib/rubocop/cop/performance/squeeze.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where `gsub(/a+/, 'a')` and `gsub!(/a+/, 'a')` + # Identifies places where `gsub(/a+/, 'a')` and `gsub!(/a+/, 'a')` # can be replaced by `squeeze('a')` and `squeeze!('a')`. # # The `squeeze('a')` method is faster than `gsub(/a+/, 'a')`. diff --git a/lib/rubocop/cop/performance/start_with.rb b/lib/rubocop/cop/performance/start_with.rb index d813ca5100..bf35a10af2 100644 --- a/lib/rubocop/cop/performance/start_with.rb +++ b/lib/rubocop/cop/performance/start_with.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies unnecessary use of a regex where `String#start_with?` would suffice. + # Identifies unnecessary use of a regex where `String#start_with?` would suffice. # # This cop has `SafeMultiline` configuration option that `true` by default because # `^start` is unsafe as it will behave incompatible with `start_with?` diff --git a/lib/rubocop/cop/performance/string_identifier_argument.rb b/lib/rubocop/cop/performance/string_identifier_argument.rb index a760633091..e2554d2194 100644 --- a/lib/rubocop/cop/performance/string_identifier_argument.rb +++ b/lib/rubocop/cop/performance/string_identifier_argument.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where string identifier argument can be replaced + # Identifies places where string identifier argument can be replaced # by symbol identifier argument. # It prevents the redundancy of the internal string-to-symbol conversion. # diff --git a/lib/rubocop/cop/performance/string_include.rb b/lib/rubocop/cop/performance/string_include.rb index 415e02c929..bacb645f8f 100644 --- a/lib/rubocop/cop/performance/string_include.rb +++ b/lib/rubocop/cop/performance/string_include.rb @@ -3,8 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies unnecessary use of a regex where - # `String#include?` would suffice. + # Identifies unnecessary use of a regex where `String#include?` would suffice. # # @safety # This cop's offenses are not safe to auto-correct if a receiver is nil. diff --git a/lib/rubocop/cop/performance/string_replacement.rb b/lib/rubocop/cop/performance/string_replacement.rb index 68f85eab4f..cc9358a528 100644 --- a/lib/rubocop/cop/performance/string_replacement.rb +++ b/lib/rubocop/cop/performance/string_replacement.rb @@ -3,8 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where `gsub` can be replaced by - # `tr` or `delete`. + # Identifies places where `gsub` can be replaced by `tr` or `delete`. # # @example # # bad diff --git a/lib/rubocop/cop/performance/sum.rb b/lib/rubocop/cop/performance/sum.rb index ebd9c08227..ea590a375d 100644 --- a/lib/rubocop/cop/performance/sum.rb +++ b/lib/rubocop/cop/performance/sum.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where custom code finding the sum of elements + # Identifies places where custom code finding the sum of elements # in some Enumerable object can be replaced by `Enumerable#sum` method. # # @safety diff --git a/lib/rubocop/cop/performance/times_map.rb b/lib/rubocop/cop/performance/times_map.rb index 6e297893cd..977b2c54a8 100644 --- a/lib/rubocop/cop/performance/times_map.rb +++ b/lib/rubocop/cop/performance/times_map.rb @@ -3,7 +3,7 @@ module RuboCop module Cop module Performance - # This cop checks for .times.map calls. + # Checks for .times.map calls. # In most cases such calls can be replaced # with an explicit array creation. # diff --git a/lib/rubocop/cop/performance/uri_default_parser.rb b/lib/rubocop/cop/performance/uri_default_parser.rb index 0dc0d43b5c..0f8de7d86a 100644 --- a/lib/rubocop/cop/performance/uri_default_parser.rb +++ b/lib/rubocop/cop/performance/uri_default_parser.rb @@ -3,8 +3,7 @@ module RuboCop module Cop module Performance - # This cop identifies places where `URI::Parser.new` - # can be replaced by `URI::DEFAULT_PARSER`. + # Identifies places where `URI::Parser.new` can be replaced by `URI::DEFAULT_PARSER`. # # @example # # bad