Skip to content

Commit 74ea5b1

Browse files
authored
Bump rubocop to 0.71 / Enable Style/FrozenStringLiteralComment rule (#767)
* Bump rubocop from 0.40 to 0.71 Since rubocop v0.71 support Ruby v2.7 * Rename cop: `Style/MethodName→Naming/MethodName` / `Style/FileName→Naming/FileName` * Fix `Layout/TrailingBlankLines` * Fix `Style/Encoding` * Fix `Style/FrozenStringLiteralComment`, `Layout/EmptyLineAfterMagicComment` * Update rubocop setting
1 parent ea304fd commit 74ea5b1

File tree

116 files changed

+316
-24
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+316
-24
lines changed

.rubocop.yml

+74-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
inherit_from: .rubocop_todo.yml
22

3-
Lint/EndAlignment:
4-
AlignWith: variable
5-
63
Metrics/AbcSize:
74
Enabled: false
85

6+
Metrics/BlockLength:
7+
Enabled: false
8+
99
Metrics/ClassLength:
1010
Enabled: false
1111

@@ -24,19 +24,34 @@ Metrics/ModuleLength:
2424
Metrics/PerceivedComplexity:
2525
Enabled: false
2626

27-
Style/AlignParameters:
28-
EnforcedStyle: with_fixed_indentation
27+
Style/CommentedKeyword:
28+
Enabled: false
2929

3030
Style/ClassAndModuleChildren:
3131
Enabled: false
3232

3333
Style/Documentation:
3434
Enabled: false
3535

36-
Style/ElseAlignment:
36+
Style/EvalWithLocation:
37+
Enabled: false
38+
39+
Style/ExpandPathArguments:
40+
Enabled: false
41+
42+
Style/GuardClause:
43+
Enabled: false
44+
45+
Style/IfUnlessModifier:
46+
Enabled: false
47+
48+
Style/NumericPredicate:
49+
Enabled: false
50+
51+
Style/PercentLiteralDelimiters:
3752
Enabled: false
3853

39-
Style/SpaceInsideParens:
54+
Style/RedundantBegin:
4055
Enabled: false
4156

4257
Style/SpecialGlobalVars:
@@ -45,5 +60,56 @@ Style/SpecialGlobalVars:
4560
Style/StringLiterals:
4661
Enabled: false
4762

48-
Style/TrailingCommaInLiteral:
63+
Style/SymbolArray:
64+
Enabled: false
65+
66+
Style/TrailingCommaInArrayLiteral:
67+
Enabled: false
68+
69+
Layout/AlignArguments:
70+
Enabled: false
71+
72+
Layout/AlignParameters:
73+
EnforcedStyle: with_fixed_indentation
74+
75+
Layout/EndAlignment:
76+
EnforcedStyleAlignWith: variable
77+
78+
Layout/ElseAlignment:
79+
Enabled: false
80+
81+
Layout/EmptyLineAfterGuardClause:
82+
Enabled: false
83+
84+
Layout/IndentHeredoc:
85+
Enabled: false
86+
87+
Layout/SpaceInsideParens:
88+
Enabled: false
89+
90+
Layout/SpaceInsidePercentLiteralDelimiters:
91+
Enabled: false
92+
93+
Lint/ErbNewArguments:
94+
Enabled: false
95+
96+
Lint/MissingCopEnableDirective:
97+
Enabled: false
98+
99+
Lint/PercentStringArray:
100+
Enabled: false
101+
102+
Naming/HeredocDelimiterNaming:
103+
Enabled: false
104+
105+
Naming/UncommunicativeMethodParamName:
106+
Enabled: false
107+
108+
Security/YAMLLoad:
109+
Enabled: false
110+
111+
Gemspec/RequiredRubyVersion:
112+
Enabled: false
113+
114+
Bundler/OrderedGems:
49115
Enabled: false

Brewfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
brew "mysql"
24
brew "postgresql"
3-
brew "sqlite"
5+
brew "sqlite"

Gemfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
source 'https://rubygems.org'
24

35
gemspec
@@ -13,7 +15,7 @@ pg_version = '0.9'
1315
pg_version = '1.1' if version >= 6.1
1416

1517
group :development, :test do
16-
gem 'rubocop', '~> 0.40.0'
18+
gem 'rubocop', '~> 0.71.0'
1719
gem 'rake'
1820
end
1921

Rakefile

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "bundler"
24
Bundler.setup
35

activerecord-import.gemspec

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# -*- encoding: utf-8 -*-
1+
# frozen_string_literal: true
2+
23
require File.expand_path('../lib/activerecord-import/version', __FILE__)
34

45
Gem::Specification.new do |gem|

benchmarks/benchmark.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'pathname'
24
require "fileutils"
35
require "active_record"

benchmarks/lib/base.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class BenchmarkBase
24
attr_reader :results
35

benchmarks/lib/cli_parser.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'optparse'
24
require 'ostruct'
35

@@ -8,7 +10,7 @@
810
# * t - the table types to test. ie: myisam, innodb, memory, temporary, etc.
911
#
1012
module BenchmarkOptionParser
11-
BANNER = "Usage: ruby #{$0} [options]\nSee ruby #{$0} -h for more options.".freeze
13+
BANNER = "Usage: ruby #{$0} [options]\nSee ruby #{$0} -h for more options."
1214

1315
def self.print_banner
1416
puts BANNER

benchmarks/lib/float.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Taken from http://www.programmingishard.com/posts/show/128
24
# Posted by rbates
35
class Float

benchmarks/lib/mysql2_benchmark.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class Mysql2Benchmark < BenchmarkBase
24
def benchmark_all( array_of_cols_and_vals )
35
methods = self.methods.find_all { |m| m =~ /benchmark_/ }

benchmarks/lib/output_to_csv.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'csv'
24

35
module OutputToCSV

benchmarks/lib/output_to_html.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1+
# frozen_string_literal: true
2+
13
require 'erb'
24

35
module OutputToHTML
4-
TEMPLATE_HEADER = <<"EOT".freeze
6+
TEMPLATE_HEADER = <<"EOT"
57
<div>
68
All times are rounded to the nearest thousandth for display purposes. Speedups next to each time are computed
79
before any rounding occurs. Also, all speedup calculations are computed by comparing a given time against
810
the very first column (which is always the default ActiveRecord::Base.create method.
911
</div>
1012
EOT
1113

12-
TEMPLATE = <<"EOT".freeze
14+
TEMPLATE = <<"EOT"
1315
<style>
1416
td#benchmarkTitle {
1517
border: 1px solid black;

benchmarks/models/test_innodb.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class TestInnoDb < ActiveRecord::Base
24
self.table_name = 'test_innodb'
35
end

benchmarks/models/test_memory.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class TestMemory < ActiveRecord::Base
24
self.table_name = 'test_memory'
35
end

benchmarks/models/test_myisam.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class TestMyISAM < ActiveRecord::Base
24
self.table_name = 'test_myisam'
35
end

benchmarks/schema/mysql2_schema.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
ActiveRecord::Schema.define do
24
create_table :test_myisam, options: 'ENGINE=MyISAM', force: true do |t|
35
t.column :my_name, :string, null: false

gemfiles/4.2.gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
gem 'activerecord', '~> 4.2.0'
24
gem 'composite_primary_keys', '~> 8.0'

gemfiles/5.0.gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
gem 'activerecord', '~> 5.0.0'
24
gem 'composite_primary_keys', '~> 9.0'

gemfiles/5.1.gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
gem 'activerecord', '~> 5.1.0'
24
gem 'composite_primary_keys', '~> 10.0'

gemfiles/5.2.gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
gem 'activerecord', '~> 5.2.0'
24
gem 'composite_primary_keys', '~> 11.0'

gemfiles/6.0.gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
gem 'activerecord', '~> 6.0.0'
24
gem 'composite_primary_keys', '~> 12.0'

gemfiles/6.1.gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
# frozen_string_literal: true
2+
13
gem 'activerecord', '~> 6.1.0'
24
gem 'composite_primary_keys', '~> 13.0'

gemfiles/7.0.gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# frozen_string_literal: true
2+
13
gem 'activerecord', '~> 7.0.0'

lib/activerecord-import.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# rubocop:disable Style/FileName
1+
# rubocop:disable Naming/FileName
2+
# frozen_string_literal: true
3+
24
require "active_support/lazy_load_hooks"
35

46
ActiveSupport.on_load(:active_record) do

lib/activerecord-import/active_record/adapters/abstract_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "activerecord-import/adapters/abstract_adapter"
24

35
module ActiveRecord # :nodoc:

lib/activerecord-import/active_record/adapters/jdbcmysql_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "active_record/connection_adapters/mysql2_adapter"
24
require "activerecord-import/adapters/mysql2_adapter"
35

lib/activerecord-import/active_record/adapters/jdbcpostgresql_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "active_record/connection_adapters/postgresql_adapter"
24
require "activerecord-import/adapters/postgresql_adapter"
35

lib/activerecord-import/active_record/adapters/jdbcsqlite3_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "active_record/connection_adapters/sqlite3_adapter"
24
require "activerecord-import/adapters/sqlite3_adapter"
35

lib/activerecord-import/active_record/adapters/mysql2_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "active_record/connection_adapters/mysql2_adapter"
24
require "activerecord-import/adapters/mysql2_adapter"
35

lib/activerecord-import/active_record/adapters/postgresql_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "active_record/connection_adapters/postgresql_adapter"
24
require "activerecord-import/adapters/postgresql_adapter"
35

lib/activerecord-import/active_record/adapters/seamless_database_pool_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "seamless_database_pool"
24
require "active_record/connection_adapters/seamless_database_pool_adapter"
35
require "activerecord-import/adapters/mysql_adapter"

lib/activerecord-import/active_record/adapters/sqlite3_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "active_record/connection_adapters/sqlite3_adapter"
24
require "activerecord-import/adapters/sqlite3_adapter"
35

lib/activerecord-import/adapters/abstract_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module ActiveRecord::Import::AbstractAdapter
24
module InstanceMethods
35
def next_value_for_sequence(sequence_name)

lib/activerecord-import/adapters/em_mysql2_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "activerecord-import/adapters/mysql_adapter"
24

35
module ActiveRecord::Import::EMMysql2Adapter

lib/activerecord-import/adapters/mysql2_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "activerecord-import/adapters/mysql_adapter"
24

35
module ActiveRecord::Import::Mysql2Adapter

lib/activerecord-import/adapters/mysql_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module ActiveRecord::Import::MysqlAdapter
24
include ActiveRecord::Import::ImportSupport
35
include ActiveRecord::Import::OnDuplicateKeyUpdateSupport

lib/activerecord-import/adapters/postgresql_adapter.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module ActiveRecord::Import::PostgreSQLAdapter
24
include ActiveRecord::Import::ImportSupport
35
include ActiveRecord::Import::OnDuplicateKeyUpdateSupport

lib/activerecord-import/adapters/sqlite3_adapter.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# frozen_string_literal: true
2+
13
module ActiveRecord::Import::SQLite3Adapter
24
include ActiveRecord::Import::ImportSupport
35
include ActiveRecord::Import::OnDuplicateKeyUpdateSupport
46

5-
MIN_VERSION_FOR_IMPORT = "3.7.11".freeze
6-
MIN_VERSION_FOR_UPSERT = "3.24.0".freeze
7+
MIN_VERSION_FOR_IMPORT = "3.7.11"
8+
MIN_VERSION_FOR_UPSERT = "3.24.0"
79
SQLITE_LIMIT_COMPOUND_SELECT = 500
810

911
# Override our conformance to ActiveRecord::Import::ImportSupport interface

lib/activerecord-import/base.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
# frozen_string_literal: true
2+
13
require "pathname"
24
require "active_record"
35
require "active_record/version"
46

57
module ActiveRecord::Import
6-
ADAPTER_PATH = "activerecord-import/active_record/adapters".freeze
8+
ADAPTER_PATH = "activerecord-import/active_record/adapters"
79

810
def self.base_adapter(adapter)
911
case adapter

lib/activerecord-import/import.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require "ostruct"
24

35
module ActiveRecord::Import::ConnectionAdapters; end

lib/activerecord-import/mysql2.rb

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
warn <<-MSG
24
[DEPRECATION] loading activerecord-import via 'require "activerecord-import/<adapter-name>"'
35
is deprecated. Update to autorequire using 'require "activerecord-import"'. See

0 commit comments

Comments
 (0)