Skip to content

Commit

Permalink
Merge branch 'master' into 20240102-drop-rails-5
Browse files Browse the repository at this point in the history
  • Loading branch information
xjunior authored Jan 2, 2024
2 parents 1b46983 + 771058a commit 2e2d9a1
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
---
engines:
rubocop:
enabled: true
channel: rubocop-0-49
enabled: false
ratings:
paths:
- "**.rb"
51 changes: 45 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,44 @@ jobs:
fail-fast: false
matrix:
ruby:
- 2.4
- 2.5
- 2.6
- 2.7
- 3.0
- 3.1
- 3.2
- 3.3
rails:
- 6.0.0
- 6.1.0
- 7.0.1
- 7.1.2
include:
- ruby: 2.7
rails: 7.0.1
- ruby: 3.0
exclude: # These Rails versions are too new for the respective Ruby versions, or vice-versa
- ruby: 2.4
rails: 6.0.0
- ruby: 2.4
rails: 6.1.0
- ruby: 3.0
- ruby: 2.4
rails: 7.0.1
- ruby: 2.4
rails: 7.1.2
exclude:
- ruby: 2.5
rails: 7.0.1
- ruby: 2.5
rails: 7.1.2
- ruby: 2.6
rails: 7.0.1
- ruby: 2.6
rails: 7.1.2
- ruby: 3.0
rails: 6.0.0
- ruby: 3.1
rails: 6.0.0
- ruby: 3.2
rails: 6.0.0
- ruby: 3.3
rails: 6.0.0
env:
PERCONA_DB_USER: root
PERCONA_DB_PASSWORD: root
Expand All @@ -48,3 +67,23 @@ jobs:
run: sudo systemctl start mysql.service
- run: bin/setup
- run: bundle exec rake
lint:
strategy:
fail-fast: false
matrix:
ruby:
- 2.7
rails:
- 6.1.0
env:
PERCONA_DB_USER: root
PERCONA_DB_PASSWORD: root
RAILS_VERSION: "~> ${{ matrix.rails }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rubocop --parallel
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
inherit_from:
- .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.4

Expand Down Expand Up @@ -39,6 +42,7 @@ Style/BracesAroundHashParameters:
Exclude:
- 'spec/fixtures/migrate/**.rb'
- 'spec/integration/**.rb'
- 'spec/lhm/adapter/**.rb'

Style/CommandLiteral:
Exclude:
Expand Down
111 changes: 111 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-01-02 13:03:20 -0300 using RuboCop version 0.49.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: leading, trailing
Layout/DotPosition:
Exclude:
- 'spec/integration/indexes_spec.rb'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
Layout/IndentArray:
EnforcedStyle: consistent

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Width, IgnoredPatterns.
Layout/IndentationWidth:
Exclude:
- 'spec/integration/indexes_spec.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, EnforcedStyleForEmptyBraces, SupportedStylesForEmptyBraces.
# SupportedStyles: space, no_space, compact
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideHashLiteralBraces:
Exclude:
- 'spec/active_record/connection_adapters/percona_adapter_spec.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
Lint/UnusedMethodArgument:
Exclude:
- 'lib/active_record/connection_adapters/for_alter.rb'
- 'spec/spec_helper.rb'

# Offense count: 1
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 123

# Offense count: 1
# Cop supports --auto-correct.
Security/YAMLLoad:
Exclude:
- 'configuration.rb'

# Offense count: 12
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: braces, no_braces, context_dependent
Style/BracesAroundHashParameters:
Exclude:
- 'spec/fixtures/migrate/**.rb'
- 'spec/integration/**.rb'
- 'spec/lhm/adapter/add_unique_index_spec.rb'
- 'spec/lhm/adapter/remove_index_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: compact, expanded
Style/EmptyMethod:
Exclude:
- 'spec/fixtures/migrate/0029_disable_departure.rb'

# Offense count: 12
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Exclude:
- 'spec/active_record/connection_adapters/percona_adapter_spec.rb'
- 'spec/fixtures/migrate/0030_data_migration_with_upsert_all.rb'
- 'spec/integration/data_migrations_spec.rb'
- 'spec/integration/foreign_keys_spec.rb'
- 'spec/lhm/column_with_sql_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStylesForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArguments:
Exclude:
- 'spec/departure/runner_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline, SupportedStylesForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInLiteral:
Exclude:
- 'spec/integration/data_migrations_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/UnneededInterpolation:
Exclude:
- 'spec/active_record/connection_adapters/percona_adapter_spec.rb'
4 changes: 2 additions & 2 deletions lib/active_record/connection_adapters/percona_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def adapter
end

class SchemaCreation < ActiveRecord::ConnectionAdapters::MySQL::SchemaCreation
def visit_DropForeignKey(name) # rubocop:disable Naming/MethodName
def visit_DropForeignKey(name) # rubocop:disable Style/MethodName
fk_name =
if name =~ /^__(.+)/
Regexp.last_match(1)
Expand Down Expand Up @@ -188,7 +188,7 @@ def full_version

# This is a method defined in Rails 6.0, and we have no control over the
# naming of this method.
def get_full_version # rubocop:disable Naming/AccessorMethodName
def get_full_version # rubocop:disable Style/AccessorMethodName
mysql_adapter.raw_connection.server_info[:version]
end

Expand Down
2 changes: 1 addition & 1 deletion spec/integration/indexes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Comment < ActiveRecord::Base; end

it 'executes the percona command' do
if ActiveRecord::Base.connection.send(:supports_rename_index?)
expect_percona_command('RENAME INDEX `index_comments_on_some_id_field` TO `new_index_comments_on_some_id_field`')
expect_percona_command('RENAME INDEX `index_comments_on_some_id_field` TO `new_index_comments_on_some_id_field`') # rubocop:disable Metrics/LineLength
else
expect_percona_command('ADD INDEX `new_index_comments_on_some_id_field` (`some_id_field`)')
expect_percona_command('DROP INDEX `index_comments_on_some_id_field`')
Expand Down
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@
# Cleans up the database before each example, so the current example doesn't
# see the state of the previous one
config.before(:each) do |example|
test_database.setup if example.metadata[:integration]
if example.metadata[:integration]
test_database.setup
ActiveRecord::Base.connection_pool.disconnect!
end
end

config.order = :random
Expand Down

0 comments on commit 2e2d9a1

Please sign in to comment.