Skip to content

Commit

Permalink
Merge pull request #713 from ydah/fix_spelling
Browse files Browse the repository at this point in the history
Fix some typos
  • Loading branch information
koic committed Jun 14, 2022
2 parents 9641b57 + 5a220f0 commit 46736e5
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion docs/modules/ROOT/pages/cops_rails.adoc
Expand Up @@ -5620,7 +5620,7 @@ time.to_formatted_s(:db)
Checks for the use of exit statements (namely `return`,
`break` and `throw`) in transactions. This is due to the eventual
unexpected behavior when using ActiveRecord >= 7, where transactions
exitted using these statements are being rollbacked rather than
exited using these statements are being rollbacked rather than
committed (pre ActiveRecord 7 behavior).

As alternatives, it would be more intuitive to explicitly raise an
Expand Down
4 changes: 2 additions & 2 deletions lib/rubocop/cop/rails/time_zone_assignment.rb
Expand Up @@ -22,12 +22,12 @@ class TimeZoneAssignment < Base
MSG = 'Use `Time.use_zone` with block instead of `Time.zone=`.'
RESTRICT_ON_SEND = %i[zone=].freeze

def_node_matcher :time_zone_assignement?, <<~PATTERN
def_node_matcher :time_zone_assignment?, <<~PATTERN
(send (const nil? :Time) :zone= ...)
PATTERN

def on_send(node)
return unless time_zone_assignement?(node)
return unless time_zone_assignment?(node)

add_offense(node)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rails/transaction_exit_statement.rb
Expand Up @@ -6,7 +6,7 @@ module Rails
# Checks for the use of exit statements (namely `return`,
# `break` and `throw`) in transactions. This is due to the eventual
# unexpected behavior when using ActiveRecord >= 7, where transactions
# exitted using these statements are being rollbacked rather than
# exited using these statements are being rollbacked rather than
# committed (pre ActiveRecord 7 behavior).
#
# As alternatives, it would be more intuitive to explicitly raise an
Expand Down
4 changes: 2 additions & 2 deletions lib/rubocop/cop/rails/unique_validation_without_index.rb
Expand Up @@ -56,9 +56,9 @@ def find_schema_information(node)

def with_index?(klass, table, names)
# Compatibility for Rails 4.2.
add_indicies = schema.add_indicies_by(table_name: table_name(klass))
add_indices = schema.add_indices_by(table_name: table_name(klass))

(table.indices + add_indicies).any? do |index|
(table.indices + add_indices).any? do |index|
index.unique &&
(index.columns.to_set == names ||
include_column_names_in_expression_index?(index, names))
Expand Down
10 changes: 5 additions & 5 deletions lib/rubocop/rails/schema_loader/schema.rb
Expand Up @@ -5,11 +5,11 @@ module Rails
module SchemaLoader
# Represent db/schema.rb
class Schema
attr_reader :tables, :add_indicies
attr_reader :tables, :add_indices

def initialize(ast)
@tables = []
@add_indicies = []
@add_indices = []

build!(ast)
end
Expand All @@ -20,8 +20,8 @@ def table_by(name:)
end
end

def add_indicies_by(table_name:)
add_indicies.select do |add_index|
def add_indices_by(table_name:)
add_indices.select do |add_index|
add_index.table_name == table_name
end
end
Expand All @@ -39,7 +39,7 @@ def build!(ast)

# Compatibility for Rails 4.2.
each_add_index(ast) do |add_index_def|
@add_indicies << AddIndex.new(add_index_def)
@add_indices << AddIndex.new(add_index_def)
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cli/autocorrect_spec.rb
Expand Up @@ -9,7 +9,7 @@
RuboCop::ConfigLoader.default_configuration.for_all_cops['SuggestExtensions'] = false
end

it 'corrects `Rails/SafeNavigation` with `Style/RedndantSelf`' do
it 'corrects `Rails/SafeNavigation` with `Style/RedundantSelf`' do
create_file('.rubocop.yml', <<~YAML)
Rails/SafeNavigation:
ConvertTry: true
Expand Down
6 changes: 3 additions & 3 deletions spec/rubocop/cop/rails/active_record_callbacks_order_spec.rb
Expand Up @@ -35,7 +35,7 @@ def some_method
RUBY
end

it 'correcly autocorrects when there is a preceding comment for callback method' do
it 'correctly autocorrects when there is a preceding comment for callback method' do
new_source = autocorrect_source(<<~RUBY)
class User < ApplicationRecord
# This is a
Expand Down Expand Up @@ -63,7 +63,7 @@ class User < ApplicationRecord
RUBY
end

it 'correcly autocorrects when there is an inline comment for callback method' do
it 'correctly autocorrects when there is an inline comment for callback method' do
new_source = autocorrect_source(<<~RUBY)
class User < ApplicationRecord
after_commit :after_commit_callback # after_commit inline comment
Expand All @@ -79,7 +79,7 @@ class User < ApplicationRecord
RUBY
end

it 'correcly autocorrects when there are multiple callbacks of the same type' do
it 'correctly autocorrects when there are multiple callbacks of the same type' do
new_source = autocorrect_source(<<~RUBY)
class User < ApplicationRecord
after_commit :after_commit_callback1
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/rails/blank_spec.rb
Expand Up @@ -41,7 +41,7 @@
end

# Bug: https://github.com/rubocop/rubocop/issues/4814
it 'does not break when LHS of `or` is a send node with an arugment' do
it 'does not break when LHS of `or` is a send node with an argument' do
expect_no_offenses('x(1) || something')
end

Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/rails/dynamic_find_by_spec.rb
Expand Up @@ -91,7 +91,7 @@
end
end

context 'with column includes undersoce' do
context 'with column includes underscore' do
it 'registers an offense and corrects' do
expect_offense(<<~RUBY)
User.find_by_first_name(name)
Expand Down
@@ -1,7 +1,7 @@
# frozen_string_literal: true

RSpec.describe RuboCop::Cop::Rails::EagerEvaluationLogMessage, :config do
it 'regesters an offense when passing an interpolated string to Rails.logger.debug' do
it 'registers an offense when passing an interpolated string to Rails.logger.debug' do
expect_offense(<<~'RUBY')
Rails.logger.debug "The time is #{Time.now}"
^^^^^^^^^^^^^^^^^^^^^^^^^ Pass a block to `Rails.logger.debug`.
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/rails/find_by_spec.rb
Expand Up @@ -29,7 +29,7 @@
expect_no_offenses('User.find_by(id: x)')
end

it 'does not register an offense whtn `take` is not used immediately after `where`' do
it 'does not register an offense when `take` is not used immediately after `where`' do
expect_no_offenses(<<~RUBY)
Model.where(foo: :bar).order(:baz).take
RUBY
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/rails/output_safety_spec.rb
Expand Up @@ -110,7 +110,7 @@
expect_no_offenses('raw(one, two)')
end

it 'does not ergister an offense for comments' do
it 'does not register an offense for comments' do
expect_no_offenses(<<~RUBY)
# foo.html_safe
# raw foo
Expand Down
Expand Up @@ -44,7 +44,7 @@ class Account < ApplicationRecord
end

it 'registers an offense and corrects when including multiple ' \
'redendant receivers in single line' do
'redundant receivers in single line' do
expect_offense(<<~RUBY)
with_options options: false do |merger|
merger.invoke(merger.something)
Expand Down
2 changes: 1 addition & 1 deletion spec/rubocop/cop/rails/transaction_exit_statement_spec.rb
Expand Up @@ -95,7 +95,7 @@
RUBY
end

it 'registers an officense when `return` is used outside of a `rescue`' do
it 'registers an offense when `return` is used outside of a `rescue`' do
expect_offense(<<~RUBY)
ApplicationRecord.transaction do
return if user.active?
Expand Down
12 changes: 6 additions & 6 deletions spec/rubocop/rails/schema_loader_spec.rb
Expand Up @@ -99,12 +99,12 @@
RUBY

it 'has an `add_index` for users table' do
add_indicies = loaded_schema.add_indicies_by(table_name: 'users')
expect(add_indicies.size).to eq 2
expect(add_indicies.first.name).to eq 'index_users_on_account'
expect(add_indicies.first.table_name).to eq 'users'
expect(add_indicies.first.columns).to eq ['account']
expect(add_indicies.first.unique).to be true
add_indices = loaded_schema.add_indices_by(table_name: 'users')
expect(add_indices.size).to eq 2
expect(add_indices.first.name).to eq 'index_users_on_account'
expect(add_indices.first.table_name).to eq 'users'
expect(add_indices.first.columns).to eq ['account']
expect(add_indices.first.unique).to be true
end
end
end
Expand Down

0 comments on commit 46736e5

Please sign in to comment.