Skip to content

Commit 36b037d

Browse files
committed
Bump RuboCop
This is the terminal version with Ruby 1.9 support.
1 parent a2fadb6 commit 36b037d

File tree

4 files changed

+235
-43
lines changed

4 files changed

+235
-43
lines changed

.rubocop.yml

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
inherit_from: .rubocop_todo.yml
22

33
AllCops:
4+
TargetRubyVersion: 1.9
5+
46
DisplayCopNames: true
57
Exclude:
68
- 'pkg/**/*'
79
- 'tmp/**/*'
810
- 'vendor/**/*'
911

10-
Lint/EndAlignment:
11-
AlignWith: variable
12-
13-
Style/CaseIndentation:
14-
IndentWhenRelativeTo: end
12+
Layout/CaseIndentation:
13+
EnforcedStyle: end
1514

16-
Style/IndentHash:
15+
Layout/IndentHash:
1716
EnforcedStyle: consistent
1817

19-
Style/TrailingComma:
18+
Lint/EndAlignment:
19+
EnforcedStyleAlignWith: variable
20+
21+
Style/TrailingCommaInArguments:
22+
EnforcedStyleForMultiline: consistent_comma
23+
24+
Style/TrailingCommaInLiteral:
2025
EnforcedStyleForMultiline: consistent_comma
2126

2227
Style/TrivialAccessors:
2328
AllowPredicates: true
24-
25-
# TODO: remove when we end support for < 1.9.3
26-
27-
Style/HashSyntax:
28-
EnforcedStyle: hash_rockets
29-
30-
Style/Lambda:
31-
Enabled: false

.rubocop_todo.yml

Lines changed: 215 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,274 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2015-09-06 13:16:09 -0400 using RuboCop version 0.34.0.
3+
# on 2017-11-25 19:54:28 -0500 using RuboCop version 0.50.0.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9+
# Offense count: 15
10+
# Cop supports --auto-correct.
11+
Layout/EmptyLineAfterMagicComment:
12+
Exclude:
13+
- 'Rakefile'
14+
- 'benchmark/active_record.rb'
15+
- 'benchmark/active_record_threaded.rb'
16+
- 'benchmark/allocations.rb'
17+
- 'benchmark/escape.rb'
18+
- 'benchmark/query_with_mysql_casting.rb'
19+
- 'benchmark/query_without_mysql_casting.rb'
20+
- 'benchmark/sequel.rb'
21+
- 'benchmark/setup_db.rb'
22+
- 'ext/mysql2/extconf.rb'
23+
- 'lib/mysql2.rb'
24+
- 'spec/em/em_spec.rb'
25+
- 'spec/mysql2/client_spec.rb'
26+
- 'spec/mysql2/result_spec.rb'
27+
- 'spec/mysql2/statement_spec.rb'
28+
29+
# Offense count: 3
30+
# Cop supports --auto-correct.
31+
# Configuration parameters: EnforcedStyle, SupportedStyles.
32+
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
33+
Layout/IndentHeredoc:
34+
Exclude:
35+
- 'support/ruby_enc_to_mysql.rb'
36+
- 'tasks/compile.rake'
37+
38+
# Offense count: 2
39+
# Cop supports --auto-correct.
40+
Layout/SpaceInsidePercentLiteralDelimiters:
41+
Exclude:
42+
- 'spec/mysql2/client_spec.rb'
43+
44+
# Offense count: 2
45+
Lint/AmbiguousBlockAssociation:
46+
Exclude:
47+
- 'spec/mysql2/client_spec.rb'
48+
49+
# Offense count: 1
50+
Lint/RescueWithoutErrorClass:
51+
Exclude:
52+
- 'lib/mysql2/em.rb'
53+
54+
# Offense count: 2
55+
# Cop supports --auto-correct.
56+
Lint/UnifiedInteger:
57+
Exclude:
58+
- 'spec/spec_helper.rb'
59+
960
# Offense count: 2
1061
Metrics/AbcSize:
11-
Max: 93
62+
Max: 90
63+
64+
# Offense count: 31
65+
# Configuration parameters: CountComments, ExcludedMethods.
66+
Metrics/BlockLength:
67+
Max: 825
1268

1369
# Offense count: 1
70+
# Configuration parameters: CountBlocks.
1471
Metrics/BlockNesting:
1572
Max: 5
1673

1774
# Offense count: 1
75+
# Configuration parameters: CountComments.
1876
Metrics/ClassLength:
1977
Max: 125
2078

21-
# Offense count: 2
79+
# Offense count: 3
2280
Metrics/CyclomaticComplexity:
2381
Max: 30
2482

25-
# Offense count: 290
26-
# Configuration parameters: AllowURI, URISchemes.
83+
# Offense count: 313
84+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
85+
# URISchemes: http, https
2786
Metrics/LineLength:
2887
Max: 232
2988

30-
# Offense count: 5
89+
# Offense count: 6
3190
# Configuration parameters: CountComments.
3291
Metrics/MethodLength:
33-
Max: 60
92+
Max: 57
3493

35-
# Offense count: 1
94+
# Offense count: 2
3695
Metrics/PerceivedComplexity:
3796
Max: 27
3897

39-
# Offense count: 40
98+
# Offense count: 1
99+
# Configuration parameters: EnforcedStyle, SupportedStyles.
100+
# SupportedStyles: lowercase, uppercase
101+
Naming/HeredocDelimiterCase:
102+
Exclude:
103+
- 'support/ruby_enc_to_mysql.rb'
104+
105+
# Offense count: 3
106+
# Configuration parameters: Blacklist.
107+
# Blacklist: END, (?-mix:EO[A-Z]{1})
108+
Naming/HeredocDelimiterNaming:
109+
Exclude:
110+
- 'tasks/compile.rake'
111+
112+
# Offense count: 2
113+
# Cop supports --auto-correct.
114+
# Configuration parameters: AutoCorrect.
115+
Performance/HashEachMethods:
116+
Exclude:
117+
- 'benchmark/active_record.rb'
118+
- 'benchmark/allocations.rb'
119+
120+
# Offense count: 2
121+
# Cop supports --auto-correct.
122+
# Configuration parameters: MaxKeyValuePairs.
123+
Performance/RedundantMerge:
124+
Exclude:
125+
- 'spec/mysql2/client_spec.rb'
126+
- 'spec/mysql2/statement_spec.rb'
127+
128+
# Offense count: 3
129+
# Cop supports --auto-correct.
130+
# Configuration parameters: AutoCorrect.
131+
Performance/TimesMap:
132+
Exclude:
133+
- 'benchmark/active_record_threaded.rb'
134+
- 'examples/threaded.rb'
135+
- 'spec/mysql2/client_spec.rb'
136+
137+
# Offense count: 2
138+
# Cop supports --auto-correct.
139+
# Configuration parameters: EnforcedStyle, SupportedStyles.
140+
# SupportedStyles: prefer_alias, prefer_alias_method
141+
Style/Alias:
142+
Exclude:
143+
- 'lib/mysql2/error.rb'
144+
145+
# Offense count: 48
40146
# Cop supports --auto-correct.
41147
# Configuration parameters: EnforcedStyle, SupportedStyles, ProceduralMethods, FunctionalMethods, IgnoredMethods.
148+
# SupportedStyles: line_count_based, semantic, braces_for_chaining
149+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
150+
# FunctionalMethods: let, let!, subject, watch
151+
# IgnoredMethods: lambda, proc, it
42152
Style/BlockDelimiters:
43-
Enabled: false
153+
Exclude:
154+
- 'spec/em/em_spec.rb'
155+
- 'spec/mysql2/client_spec.rb'
156+
- 'spec/mysql2/result_spec.rb'
157+
- 'spec/mysql2/statement_spec.rb'
44158

45-
# Offense count: 12
159+
# Offense count: 1
160+
# Cop supports --auto-correct.
161+
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly, IncludeTernaryExpressions.
162+
# SupportedStyles: assign_to_condition, assign_inside_condition
163+
Style/ConditionalAssignment:
164+
Exclude:
165+
- 'support/ruby_enc_to_mysql.rb'
166+
167+
# Offense count: 10
46168
Style/Documentation:
47169
Exclude:
170+
- 'spec/**/*'
171+
- 'test/**/*'
48172
- 'benchmark/active_record.rb'
49173
- 'benchmark/allocations.rb'
50174
- 'benchmark/query_with_mysql_casting.rb'
51175
- 'lib/mysql2.rb'
52176
- 'lib/mysql2/client.rb'
53177
- 'lib/mysql2/em.rb'
54178
- 'lib/mysql2/error.rb'
55-
- 'lib/mysql2/field.rb'
56179
- 'lib/mysql2/result.rb'
57180
- 'lib/mysql2/statement.rb'
58-
- 'lib/mysql2/version.rb'
59181

60-
# Offense count: 9
182+
# Offense count: 21
183+
# Cop supports --auto-correct.
184+
# Configuration parameters: EnforcedStyle, SupportedStyles, AutoCorrectEncodingComment.
185+
# SupportedStyles: when_needed, always, never
186+
Style/Encoding:
187+
Enabled: false
188+
189+
# Offense count: 14
61190
# Configuration parameters: AllowedVariables.
62191
Style/GlobalVars:
63192
Exclude:
64193
- 'ext/mysql2/extconf.rb'
65194

66-
# Offense count: 14
195+
# Offense count: 1
196+
# Configuration parameters: MinBodyLength.
197+
Style/GuardClause:
198+
Exclude:
199+
- 'spec/mysql2/client_spec.rb'
200+
201+
# Offense count: 175
67202
# Cop supports --auto-correct.
203+
# Configuration parameters: SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
204+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
205+
Style/HashSyntax:
206+
EnforcedStyle: hash_rockets
207+
208+
# Offense count: 1
209+
Style/IfInsideElse:
210+
Exclude:
211+
- 'tasks/compile.rake'
212+
213+
# Offense count: 4
214+
# Cop supports --auto-correct.
215+
Style/MutableConstant:
216+
Exclude:
217+
- 'ext/mysql2/extconf.rb'
218+
- 'lib/mysql2/version.rb'
219+
- 'tasks/rspec.rake'
220+
- 'tasks/vendor_mysql.rake'
221+
222+
# Offense count: 17
223+
# Cop supports --auto-correct.
224+
# Configuration parameters: Strict.
68225
Style/NumericLiterals:
69226
MinDigits: 20
70227

71-
# Offense count: 680
228+
# Offense count: 2
229+
# Cop supports --auto-correct.
230+
# Configuration parameters: AutoCorrect, EnforcedStyle, SupportedStyles.
231+
# SupportedStyles: predicate, comparison
232+
Style/NumericPredicate:
233+
Exclude:
234+
- 'spec/**/*'
235+
- 'benchmark/setup_db.rb'
236+
- 'lib/mysql2.rb'
237+
238+
# Offense count: 15
239+
# Cop supports --auto-correct.
240+
# Configuration parameters: PreferredDelimiters.
241+
Style/PercentLiteralDelimiters:
242+
Exclude:
243+
- 'benchmark/active_record.rb'
244+
- 'benchmark/active_record_threaded.rb'
245+
- 'benchmark/setup_db.rb'
246+
- 'ext/mysql2/extconf.rb'
247+
- 'spec/mysql2/client_spec.rb'
248+
- 'spec/mysql2/result_spec.rb'
249+
- 'spec/mysql2/statement_spec.rb'
250+
- 'tasks/rspec.rake'
251+
252+
# Offense count: 2
72253
# Cop supports --auto-correct.
73254
# Configuration parameters: EnforcedStyle, SupportedStyles.
255+
# SupportedStyles: only_raise, only_fail, semantic
256+
Style/SignalException:
257+
Exclude:
258+
- 'lib/mysql2/client.rb'
259+
- 'spec/em/em_spec.rb'
260+
261+
# Offense count: 726
262+
# Cop supports --auto-correct.
263+
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
264+
# SupportedStyles: single_quotes, double_quotes
74265
Style/StringLiterals:
75266
Enabled: false
267+
268+
# Offense count: 1
269+
# Cop supports --auto-correct.
270+
# Configuration parameters: EnforcedStyle, SupportedStyles.
271+
# SupportedStyles: all_comparison_operators, equality_operators_only
272+
Style/YodaCondition:
273+
Exclude:
274+
- 'lib/mysql2.rb'

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ gem 'rake-compiler', '~> 1.0'
88
group :test do
99
gem 'eventmachine' unless RUBY_PLATFORM =~ /mswin|mingw/
1010
gem 'rspec', '~> 3.2'
11-
gem 'rubocop', '~> 0.34.0'
11+
# https://github.com/bbatsov/rubocop/pull/3328
12+
# https://github.com/bbatsov/rubocop/pull/4789
13+
gem 'rubocop', '~> 0.50.0' unless RUBY_VERSION =~ /1.9/
1214
end
1315

1416
group :benchmarks do

Rakefile

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,11 @@ load 'tasks/compile.rake'
88
load 'tasks/generate.rake'
99
load 'tasks/benchmarks.rake'
1010

11-
# TODO: remove engine check when rubinius stops crashing on RuboCop
12-
has_rubocop = if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby'
13-
begin
14-
require 'rubocop/rake_task'
15-
RuboCop::RakeTask.new
16-
task :default => [:spec, :rubocop]
17-
rescue LoadError # rubocop:disable Lint/HandleExceptions
18-
end
19-
end
20-
21-
unless has_rubocop
11+
begin
12+
require 'rubocop/rake_task'
13+
RuboCop::RakeTask.new
14+
task :default => [:spec, :rubocop]
15+
rescue LoadError
2216
warn 'RuboCop is not available'
2317
task :default => :spec
2418
end

0 commit comments

Comments
 (0)