Skip to content

Commit 0adbbb8

Browse files
committed
Upgrade to Rubocop 1.8
1 parent 5543ea7 commit 0adbbb8

File tree

8 files changed

+76
-52
lines changed

8 files changed

+76
-52
lines changed

.rubocop.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ inherit_from:
55
#- Core -----------------------------------------------------------------------
66

77
AllCops:
8+
TargetRubyVersion: 2.6
9+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
10+
# to ignore them, so only the ones explicitly set in this file are enabled.
11+
DisabledByDefault: true
12+
SuggestExtensions: false
813
Exclude:
914
- spec/fixtures/**/*
1015
- lib/cocoapods-core/vendor/**/*
1116

12-
FileName:
17+
Naming/FileName:
1318
Exclude:
1419
- lib/cocoapods-core.rb
1520

.rubocop_cocoapods.yml

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,73 @@
1+
require:
2+
- rubocop-performance
3+
14
AllCops:
25
Include:
3-
- ./Rakefile
4-
- ./Gemfile
5-
- ./*.gemspec
6+
- lib/**/*.rb
7+
- Rakefile
8+
- Gemfile
9+
- /*.gemspec
610
Exclude:
7-
- ./spec/fixtures/**/*
8-
- ./vendor/bundle/**/*
11+
- spec/fixtures/**/*
12+
- vendor/bundle/**/*
913

1014
# At the moment not ready to be used
1115
# https://github.com/bbatsov/rubocop/issues/947
12-
Documentation:
16+
Style/Documentation:
1317
Enabled: false
1418

1519
#- CocoaPods -----------------------------------------------------------------#
1620

1721
# We adopted raise instead of fail.
18-
SignalException:
22+
Style/SignalException:
1923
EnforcedStyle: only_raise
2024

2125
# They are idiomatic
22-
AssignmentInCondition:
26+
Lint/AssignmentInCondition:
2327
Enabled: false
2428

2529
# Allow backticks
26-
AsciiComments:
30+
Style/AsciiComments:
2731
Enabled: false
2832

2933
# Indentation clarifies logic branches in implementations
30-
IfUnlessModifier:
34+
Style/IfUnlessModifier:
3135
Enabled: false
3236

3337
# No enforced convention here.
34-
SingleLineBlockParams:
38+
Style/SingleLineBlockParams:
3539
Enabled: false
3640

3741
# We only add the comment when needed.
38-
Encoding:
42+
Style/Encoding:
3943
Enabled: false
4044

4145
# Having these make it easier to *not* forget to add one when adding a new
4246
# value and you can simply copy the previous line.
4347
Style/TrailingCommaInArguments:
4448
EnforcedStyleForMultiline: comma
4549

46-
Style/TrailingCommaInLiteral:
50+
Style/TrailingCommaInArrayLiteral:
51+
EnforcedStyleForMultiline: comma
52+
53+
Style/TrailingCommaInHashLiteral:
4754
EnforcedStyleForMultiline: comma
4855

49-
Style/MultilineOperationIndentation:
56+
Layout/MultilineOperationIndentation:
5057
EnforcedStyle: indented
5158

5259
# Clashes with CLAide Command#validate!
53-
GuardClause:
60+
Style/GuardClause:
5461
Enabled: false
5562

5663
# Not always desirable: lib/claide/command/plugins_helper.rb:12:15
57-
Next:
64+
Style/Next:
5865
Enabled: false
5966

6067
# Autocorrect makes this cop much more useful, taking away needless guessing
61-
Lint/EndAlignment:
68+
Layout/EndAlignment:
6269
AutoCorrect: true
6370

64-
6571
# Arbitrary max lengths for classes simply do not work and enabling this will
6672
# lead to a never ending stream of annoyance and changes.
6773
Metrics/ClassLength:
@@ -98,16 +104,16 @@ Metrics/PerceivedComplexity:
98104

99105
#- CocoaPods support for Ruby 1.8.7 ------------------------------------------#
100106

101-
HashSyntax:
107+
Style/HashSyntax:
102108
EnforcedStyle: hash_rockets
103109

104-
Lambda:
110+
Style/Lambda:
105111
Enabled: false
106112

107-
DotPosition:
113+
Layout/DotPosition:
108114
EnforcedStyle: trailing
109115

110-
EachWithObject:
116+
Style/EachWithObject:
111117
Enabled: false
112118

113119
Style/SpecialGlobalVars:
@@ -116,7 +122,7 @@ Style/SpecialGlobalVars:
116122
#- CocoaPods specs -----------------------------------------------------------#
117123

118124
# Allow for `should.match /regexp/`.
119-
AmbiguousRegexpLiteral:
125+
Lint/AmbiguousRegexpLiteral:
120126
Exclude:
121127
- spec/**/*
122128

@@ -125,14 +131,14 @@ Performance/RedundantMatch:
125131
- spec/**/*
126132

127133
# Allow `object.should == object` syntax.
128-
Void:
134+
Lint/Void:
129135
Exclude:
130136
- spec/**/*
131137

132-
ClassAndModuleChildren:
138+
Style/ClassAndModuleChildren:
133139
Exclude:
134140
- spec/**/*
135141

136-
UselessComparison:
142+
Lint/BinaryOperatorWithIdenticalOperands:
137143
Exclude:
138144
- spec/**/*

.rubocop_todo.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
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+
require:
10+
- rubocop-performance
11+
912
# Offense count: 5
1013
Lint/IneffectiveAccessModifier:
1114
Exclude:
@@ -34,7 +37,7 @@ Lint/UselessAccessModifier:
3437
# Offense count: 474
3538
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
3639
# URISchemes: http, https
37-
Metrics/LineLength:
40+
Layout/LineLength:
3841
Max: 175
3942

4043
# Offense count: 2
@@ -77,7 +80,7 @@ Style/ConditionalAssignment:
7780
# Offense count: 1
7881
# Cop supports --auto-correct.
7982
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
80-
Style/ExtraSpacing:
83+
Layout/ExtraSpacing:
8184
Exclude:
8285
- 'spec/specification/dsl/attribute_support_spec.rb'
8386

@@ -89,15 +92,15 @@ Style/IfInsideElse:
8992
# Offense count: 1
9093
# Cop supports --auto-correct.
9194
# Configuration parameters: IndentationWidth.
92-
Style/IndentAssignment:
95+
Layout/AssignmentIndentation:
9396
Exclude:
9497
- 'spec/specification/linter/result_spec.rb'
9598

9699
# Offense count: 1
97100
# Cop supports --auto-correct.
98101
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
99102
# SupportedStyles: aligned, indented
100-
Style/MultilineMethodCallIndentation:
103+
Layout/MultilineMethodCallIndentation:
101104
Enabled: false
102105

103106
# Offense count: 4
@@ -129,6 +132,6 @@ Style/RedundantSelf:
129132

130133
# Offense count: 2
131134
# Cop supports --auto-correct.
132-
Style/UnneededInterpolation:
135+
Style/RedundantInterpolation:
133136
Exclude:
134137
- 'lib/cocoapods-core/yaml_helper.rb'

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ group :development do
1313
gem 'webmock'
1414
gem 'webrick', '~> 1.7.0'
1515

16-
gem 'rubocop', '~> 0.38.0'
16+
gem 'rubocop', '~> 1.8', :require => false
17+
gem 'rubocop-performance', :require => false
1718
end
1819

1920
group :debugging do

Gemfile.lock

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ GEM
2626
algoliasearch (1.27.5)
2727
httpclient (~> 2.8, >= 2.8.3)
2828
json (>= 1.5.1)
29-
ast (2.4.0)
29+
ast (2.4.1)
3030
awesome_print (1.8.0)
3131
bacon (1.2.0)
3232
coderay (1.1.3)
@@ -58,36 +58,44 @@ GEM
5858
nap (1.1.0)
5959
netrc (0.11.0)
6060
notify (0.5.2)
61-
parser (2.7.1.3)
62-
ast (~> 2.4.0)
63-
powerpack (0.1.2)
61+
parallel (1.20.1)
62+
parser (3.0.0.0)
63+
ast (~> 2.4.1)
6464
prettybacon (0.0.2)
6565
bacon (~> 1.2)
6666
pry (0.13.1)
6767
coderay (~> 1.1)
6868
method_source (~> 1.0)
6969
public_suffix (4.0.6)
70-
rainbow (2.2.2)
71-
rake
70+
rainbow (3.0.0)
7271
rake (12.3.3)
7372
rb-fsevent (0.10.4)
7473
rb-inotify (0.10.1)
7574
ffi (~> 1.0)
7675
rb-kqueue (0.2.5)
7776
ffi (>= 0.5.0)
77+
regexp_parser (2.0.3)
7878
rexml (3.2.4)
79-
rubocop (0.38.0)
80-
parser (>= 2.3.0.6, < 3.0)
81-
powerpack (~> 0.1)
82-
rainbow (>= 1.99.1, < 3.0)
79+
rubocop (1.8.1)
80+
parallel (~> 1.10)
81+
parser (>= 3.0.0.0)
82+
rainbow (>= 2.2.2, < 4.0)
83+
regexp_parser (>= 1.8, < 3.0)
84+
rexml
85+
rubocop-ast (>= 1.2.0, < 2.0)
8386
ruby-progressbar (~> 1.7)
84-
unicode-display_width (~> 1.0, >= 1.0.1)
85-
ruby-progressbar (1.10.1)
87+
unicode-display_width (>= 1.4.0, < 3.0)
88+
rubocop-ast (1.4.0)
89+
parser (>= 2.7.1.5)
90+
rubocop-performance (1.9.2)
91+
rubocop (>= 0.90.0, < 2.0)
92+
rubocop-ast (>= 0.4.0)
93+
ruby-progressbar (1.11.0)
8694
typhoeus (1.4.0)
8795
ethon (>= 0.9.0)
8896
tzinfo (2.0.4)
8997
concurrent-ruby (~> 1.0)
90-
unicode-display_width (1.7.0)
98+
unicode-display_width (2.0.0)
9199
vcr (6.0.0)
92100
webmock (3.11.0)
93101
addressable (>= 2.3.6)
@@ -111,7 +119,8 @@ DEPENDENCIES
111119
rake (~> 12.0)
112120
rb-fsevent
113121
rexml (~> 3.2.4)
114-
rubocop (~> 0.38.0)
122+
rubocop (~> 1.8)
123+
rubocop-performance
115124
vcr
116125
webmock
117126
webrick (~> 1.7.0)

lib/cocoapods-core/podfile.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,9 @@ def self.from_ruby(path, contents = nil)
327327
podfile = Podfile.new(path) do
328328
# rubocop:disable Lint/RescueException
329329
begin
330-
# rubocop:disable Eval
330+
# rubocop:disable Security/Eval
331331
eval(contents, nil, path.to_s)
332-
# rubocop:enable Eval
332+
# rubocop:enable Security/Eval
333333
rescue Exception => e
334334
message = "Invalid `#{path.basename}` file: #{e.message}"
335335
raise DSLError.new(message, path, e, contents)

lib/cocoapods-core/requirement.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Requirement < Pod::Vendor::Gem::Requirement
1515
#
1616
PATTERN = /\A\s*(#{quoted_operators})?\s*(#{Version::VERSION_PATTERN})\s*\z/
1717

18-
DefaultRequirement = ['>=', Version.new(0)] # rubocop:disable Style/ConstantName
18+
DefaultRequirement = ['>=', Version.new(0)] # rubocop:disable Naming/ConstantName
1919

2020
#-------------------------------------------------------------------------#
2121

lib/cocoapods-core/specification.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,9 +824,9 @@ def validate_cocoapods_version
824824
#
825825
#
826826
def self._eval_podspec(string, path)
827-
# rubocop:disable Eval
827+
# rubocop:disable Security/Eval
828828
eval(string, nil, path.to_s)
829-
# rubocop:enable Eval
829+
# rubocop:enable Security/Eval
830830

831831
# rubocop:disable Lint/RescueException
832832
rescue Exception => e

0 commit comments

Comments
 (0)