Skip to content

Commit b38d0c8

Browse files
committed
Style/PercentLiteralDelimiters
1 parent 6a4d443 commit b38d0c8

File tree

9 files changed

+17
-31
lines changed

9 files changed

+17
-31
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,6 @@ Style/GlobalVars:
7878
Style/NumericLiterals:
7979
MinDigits: 20
8080

81-
# Offense count: 15
82-
# Cop supports --auto-correct.
83-
# Configuration parameters: PreferredDelimiters.
84-
Style/PercentLiteralDelimiters:
85-
Exclude:
86-
- 'benchmark/active_record.rb'
87-
- 'benchmark/active_record_threaded.rb'
88-
- 'benchmark/setup_db.rb'
89-
- 'ext/mysql2/extconf.rb'
90-
- 'spec/mysql2/client_spec.rb'
91-
- 'spec/mysql2/result_spec.rb'
92-
- 'spec/mysql2/statement_spec.rb'
93-
- 'tasks/rspec.rake'
94-
9581
# Offense count: 2
9682
# Cop supports --auto-correct.
9783
# Configuration parameters: EnforcedStyle, SupportedStyles.

benchmark/active_record.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TestModel < ActiveRecord::Base
1818
batch_size = 1000
1919

2020
Benchmark.ips do |x|
21-
%w(mysql mysql2).each do |adapter|
21+
%w[mysql mysql2].each do |adapter|
2222
TestModel.establish_connection(opts.merge(adapter: adapter))
2323

2424
x.report(adapter) do

benchmark/active_record_threaded.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
opts = { database: 'test', pool: number_of_threads }
1111

1212
Benchmark.ips do |x|
13-
%w(mysql mysql2).each do |adapter|
13+
%w[mysql mysql2].each do |adapter|
1414
ActiveRecord::Base.establish_connection(opts.merge(adapter: adapter))
1515

1616
x.report(adapter) do

benchmark/setup_db.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ def insert_record(args)
109109
medium_text_test: twenty5_paragraphs,
110110
long_blob_test: twenty5_paragraphs,
111111
long_text_test: twenty5_paragraphs,
112-
enum_test: %w(val1 val2).sample,
113-
set_test: %w(val1 val2 val1,val2).sample,
112+
enum_test: %w[val1 val2].sample,
113+
set_test: %w[val1 val2 val1,val2].sample,
114114
)
115115
if (n % 100).zero?
116116
$stdout.putc '.'

ext/mysql2/extconf.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def asplode(lib)
1414
end
1515

1616
def add_ssl_defines(header)
17-
all_modes_found = %w(SSL_MODE_DISABLED SSL_MODE_PREFERRED SSL_MODE_REQUIRED SSL_MODE_VERIFY_CA SSL_MODE_VERIFY_IDENTITY).inject(true) do |m, ssl_mode|
17+
all_modes_found = %w[SSL_MODE_DISABLED SSL_MODE_PREFERRED SSL_MODE_REQUIRED SSL_MODE_VERIFY_CA SSL_MODE_VERIFY_IDENTITY].inject(true) do |m, ssl_mode|
1818
m && have_const(ssl_mode, header)
1919
end
2020
$CFLAGS << ' -DFULL_SSL_MODE_SUPPORT' if all_modes_found
@@ -35,7 +35,7 @@ def add_ssl_defines(header)
3535

3636
# borrowed from mysqlplus
3737
# http://github.com/oldmoe/mysqlplus/blob/master/ext/extconf.rb
38-
dirs = ENV.fetch('PATH').split(File::PATH_SEPARATOR) + %w(
38+
dirs = ENV.fetch('PATH').split(File::PATH_SEPARATOR) + %w[
3939
/opt
4040
/opt/local
4141
/opt/local/mysql
@@ -47,7 +47,7 @@ def add_ssl_defines(header)
4747
/usr/local/mysql-*
4848
/usr/local/lib/mysql5*
4949
/usr/local/opt/mysql5*
50-
).map { |dir| dir << '/bin' }
50+
].map { |dir| dir << '/bin' }
5151

5252
# For those without HOMEBREW_ROOT in PATH
5353
dirs << "#{ENV['HOMEBREW_ROOT']}/bin" if ENV['HOMEBREW_ROOT']
@@ -102,7 +102,7 @@ def add_ssl_defines(header)
102102
asplode 'mysql.h'
103103
end
104104

105-
%w(errmsg.h).each do |h|
105+
%w[errmsg.h].each do |h|
106106
header = [prefix, h].compact.join('/')
107107
asplode h unless have_header header
108108
end
@@ -152,7 +152,7 @@ def add_ssl_defines(header)
152152
case sanitizers
153153
when true
154154
# Try them all, turn on whatever we can
155-
enabled_sanitizers = %w(address cfi integer memory thread undefined).select do |s|
155+
enabled_sanitizers = %w[address cfi integer memory thread undefined].select do |s|
156156
try_link('int main() {return 0;}', "-Werror -fsanitize=#{s}")
157157
end
158158
abort "-----\nCould not enable any sanitizers!\n-----" if enabled_sanitizers.empty?

spec/mysql2/client_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def connect(*args)
6363
end
6464

6565
it "should parse flags array" do
66-
client = Klient.new flags: %w(FOUND_ROWS -PROTOCOL_41)
66+
client = Klient.new flags: %w[FOUND_ROWS -PROTOCOL_41]
6767
expect(client.connect_args.last[6] & Mysql2::Client::FOUND_ROWS).to eql(Mysql2::Client::FOUND_ROWS)
6868
expect(client.connect_args.last[6] & Mysql2::Client::PROTOCOL_41).to eql(0)
6969
end

spec/mysql2/result_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119

120120
it "should return an array of field names in proper order" do
121121
result = @client.query "SELECT 'a', 'b', 'c'"
122-
expect(result.fields).to eql(%w(a b c))
122+
expect(result.fields).to eql(%w[a b c])
123123
end
124124
end
125125

@@ -428,7 +428,7 @@
428428
end
429429

430430
context "string encoding for #{type} values" do
431-
if %w(VARBINARY TINYBLOB BLOB MEDIUMBLOB LONGBLOB).include?(type)
431+
if %w[VARBINARY TINYBLOB BLOB MEDIUMBLOB LONGBLOB].include?(type)
432432
it "should default to binary if Encoding.default_internal is nil" do
433433
with_internal_encoding nil do
434434
result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first

spec/mysql2/statement_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def stmt_count
218218

219219
it "should be able to retrieve utf8 field names correctly" do
220220
stmt = @client.prepare 'SELECT * FROM `テーブル`'
221-
expect(stmt.fields).to eq(%w(整数 文字列))
221+
expect(stmt.fields).to eq(%w[整数 文字列])
222222
result = stmt.execute
223223

224224
expect(result.to_a).to eq([{ "整数" => 1, "文字列" => "イチ" }, { "整数" => 2, "文字列" => "弐" }, { "整数" => 3, "文字列" => "さん" }])
@@ -342,7 +342,7 @@ def stmt_count
342342

343343
it "should return an array of field names in proper order" do
344344
stmt = @client.prepare("SELECT 'a', 'b', 'c'")
345-
expect(stmt.fields).to eql(%w(a b c))
345+
expect(stmt.fields).to eql(%w[a b c])
346346
end
347347

348348
it "should return nil for statement with no result fields" do
@@ -600,7 +600,7 @@ def stmt_count
600600
end
601601

602602
context "string encoding for #{type} values" do
603-
if %w(VARBINARY TINYBLOB BLOB MEDIUMBLOB LONGBLOB).include?(type)
603+
if %w[VARBINARY TINYBLOB BLOB MEDIUMBLOB LONGBLOB].include?(type)
604604
it "should default to binary if Encoding.default_internal is nil" do
605605
with_internal_encoding nil do
606606
result = @client.query("SELECT * FROM mysql2_test ORDER BY id DESC LIMIT 1").first

tasks/rspec.rake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ begin
77
desc " Run all examples with Valgrind"
88
namespace :spec do
99
task :valgrind do
10-
VALGRIND_OPTS = %w(
10+
VALGRIND_OPTS = %w[
1111
--num-callers=50
1212
--error-limit=no
1313
--partial-loads-ok=yes
1414
--undef-value-errors=no
1515
--trace-children=yes
16-
).freeze
16+
].freeze
1717
cmdline = "valgrind #{VALGRIND_OPTS.join(' ')} bundle exec rake spec"
1818
puts cmdline
1919
system cmdline

0 commit comments

Comments
 (0)