brew vendor-gems: commit updates.

This commit is contained in:
BrewTestBot 2022-03-16 21:33:44 +00:00
parent 6e2927104c
commit 1b39da404f
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
125 changed files with 15 additions and 5 deletions

View File

@ -86,7 +86,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-progressbar-1.11
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/unicode-display_width-2.1.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-1.26.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-performance-1.13.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.14.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rails-2.14.1/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-rspec-2.9.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/rubocop-sorbet-0.6.7/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ruby-macho-3.0.0/lib"

View File

@ -20,15 +20,19 @@ module RuboCop
#
class MigrationClassName < Base
extend AutoCorrector
include MigrationsHelper
MSG = 'Replace with `%<corrected_class_name>s` that matches the file name.'
def on_class(node)
return if in_migration?(node)
snake_class_name = to_snakecase(node.identifier.source)
return if snake_class_name == basename_without_timestamp
basename = basename_without_timestamp_and_suffix
return if snake_class_name == basename
corrected_class_name = to_camelcase(basename_without_timestamp)
corrected_class_name = to_camelcase(basename)
message = format(MSG, corrected_class_name: corrected_class_name)
add_offense(node.identifier, message: message) do |corrector|
@ -38,12 +42,18 @@ module RuboCop
private
def basename_without_timestamp
def basename_without_timestamp_and_suffix
filepath = processed_source.file_path
basename = File.basename(filepath, '.rb')
basename = remove_gem_suffix(basename)
basename.sub(/\A\d+_/, '')
end
# e.g.: from `add_blobs.active_storage` to `add_blobs`.
def remove_gem_suffix(file_name)
file_name.sub(/\..+\z/, '')
end
def to_camelcase(word)
word.split('_').map(&:capitalize).join
end

Some files were not shown because too many files have changed in this diff Show More