Skip to content

Commit

Permalink
Upgrade to Rubocop 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Jan 24, 2021
1 parent 6bca7ae commit d1fa25f
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 52 deletions.
7 changes: 6 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ inherit_from:
#- Core -----------------------------------------------------------------------

AllCops:
TargetRubyVersion: 2.6
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
# to ignore them, so only the ones explicitly set in this file are enabled.
DisabledByDefault: true
SuggestExtensions: false
Exclude:
- spec/fixtures/**/*
- vendor/bundle/**/*
- lib/cocoapods-core/vendor/**/*

FileName:
Naming/FileName:
Exclude:
- lib/cocoapods-core.rb

Expand Down
58 changes: 32 additions & 26 deletions .rubocop_cocoapods.yml
Original file line number Diff line number Diff line change
@@ -1,67 +1,73 @@
require:
- rubocop-performance

AllCops:
Include:
- ./Rakefile
- ./Gemfile
- ./*.gemspec
- lib/**/*.rb
- Rakefile
- Gemfile
- "*.gemspec"
Exclude:
- ./spec/fixtures/**/*
- ./vendor/bundle/**/*
- spec/fixtures/**/*
- vendor/bundle/**/*

# At the moment not ready to be used
# https://github.com/bbatsov/rubocop/issues/947
Documentation:
Style/Documentation:
Enabled: false

#- CocoaPods -----------------------------------------------------------------#

# We adopted raise instead of fail.
SignalException:
Style/SignalException:
EnforcedStyle: only_raise

# They are idiomatic
AssignmentInCondition:
Lint/AssignmentInCondition:
Enabled: false

# Allow backticks
AsciiComments:
Style/AsciiComments:
Enabled: false

# Indentation clarifies logic branches in implementations
IfUnlessModifier:
Style/IfUnlessModifier:
Enabled: false

# No enforced convention here.
SingleLineBlockParams:
Style/SingleLineBlockParams:
Enabled: false

# We only add the comment when needed.
Encoding:
Style/Encoding:
Enabled: false

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

Style/TrailingCommaInLiteral:
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma

Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma

Style/MultilineOperationIndentation:
Layout/MultilineOperationIndentation:
EnforcedStyle: indented

# Clashes with CLAide Command#validate!
GuardClause:
Style/GuardClause:
Enabled: false

# Not always desirable: lib/claide/command/plugins_helper.rb:12:15
Next:
Style/Next:
Enabled: false

# Autocorrect makes this cop much more useful, taking away needless guessing
Lint/EndAlignment:
Layout/EndAlignment:
AutoCorrect: true


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

#- CocoaPods support for Ruby 1.8.7 ------------------------------------------#

HashSyntax:
Style/HashSyntax:
EnforcedStyle: hash_rockets

Lambda:
Style/Lambda:
Enabled: false

DotPosition:
Layout/DotPosition:
EnforcedStyle: trailing

EachWithObject:
Style/EachWithObject:
Enabled: false

Style/SpecialGlobalVars:
Expand All @@ -116,7 +122,7 @@ Style/SpecialGlobalVars:
#- CocoaPods specs -----------------------------------------------------------#

# Allow for `should.match /regexp/`.
AmbiguousRegexpLiteral:
Lint/AmbiguousRegexpLiteral:
Exclude:
- spec/**/*

Expand All @@ -125,14 +131,14 @@ Performance/RedundantMatch:
- spec/**/*

# Allow `object.should == object` syntax.
Void:
Lint/Void:
Exclude:
- spec/**/*

ClassAndModuleChildren:
Style/ClassAndModuleChildren:
Exclude:
- spec/**/*

UselessComparison:
Lint/BinaryOperatorWithIdenticalOperands:
Exclude:
- spec/**/*
13 changes: 8 additions & 5 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

require:
- rubocop-performance

# Offense count: 5
Lint/IneffectiveAccessModifier:
Exclude:
Expand Down Expand Up @@ -34,7 +37,7 @@ Lint/UselessAccessModifier:
# Offense count: 474
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
# URISchemes: http, https
Metrics/LineLength:
Layout/LineLength:
Max: 175

# Offense count: 2
Expand Down Expand Up @@ -77,7 +80,7 @@ Style/ConditionalAssignment:
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
Style/ExtraSpacing:
Layout/ExtraSpacing:
Exclude:
- 'spec/specification/dsl/attribute_support_spec.rb'

Expand All @@ -89,15 +92,15 @@ Style/IfInsideElse:
# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: IndentationWidth.
Style/IndentAssignment:
Layout/AssignmentIndentation:
Exclude:
- 'spec/specification/linter/result_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
# SupportedStyles: aligned, indented
Style/MultilineMethodCallIndentation:
Layout/MultilineMethodCallIndentation:
Enabled: false

# Offense count: 4
Expand Down Expand Up @@ -129,6 +132,6 @@ Style/RedundantSelf:

# Offense count: 2
# Cop supports --auto-correct.
Style/UnneededInterpolation:
Style/RedundantInterpolation:
Exclude:
- 'lib/cocoapods-core/yaml_helper.rb'
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ group :development do
gem 'webmock'
gem 'webrick', '~> 1.7.0'

gem 'rubocop', '~> 0.38.0'
gem 'rubocop', '~> 1.8', :require => false
gem 'rubocop-performance', :require => false
end

group :debugging do
Expand Down
37 changes: 23 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ GEM
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
ast (2.4.0)
ast (2.4.1)
awesome_print (1.8.0)
bacon (1.2.0)
coderay (1.1.3)
Expand Down Expand Up @@ -58,36 +58,44 @@ GEM
nap (1.1.0)
netrc (0.11.0)
notify (0.5.2)
parser (2.7.1.3)
ast (~> 2.4.0)
powerpack (0.1.2)
parallel (1.20.1)
parser (3.0.0.0)
ast (~> 2.4.1)
prettybacon (0.0.2)
bacon (~> 1.2)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.6)
rainbow (2.2.2)
rake
rainbow (3.0.0)
rake (12.3.3)
rb-fsevent (0.10.4)
rb-inotify (0.10.1)
ffi (~> 1.0)
rb-kqueue (0.2.5)
ffi (>= 0.5.0)
regexp_parser (2.0.3)
rexml (3.2.4)
rubocop (0.38.0)
parser (>= 2.3.0.6, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
rubocop (1.8.1)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml
rubocop-ast (>= 1.2.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.10.1)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.0)
parser (>= 2.7.1.5)
rubocop-performance (1.9.2)
rubocop (>= 0.90.0, < 2.0)
rubocop-ast (>= 0.4.0)
ruby-progressbar (1.11.0)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (1.7.0)
unicode-display_width (2.0.0)
vcr (6.0.0)
webmock (3.11.0)
addressable (>= 2.3.6)
Expand All @@ -111,7 +119,8 @@ DEPENDENCIES
rake (~> 12.0)
rb-fsevent
rexml (~> 3.2.4)
rubocop (~> 0.38.0)
rubocop (~> 1.8)
rubocop-performance
vcr
webmock
webrick (~> 1.7.0)
Expand Down
4 changes: 2 additions & 2 deletions lib/cocoapods-core/podfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ def self.from_ruby(path, contents = nil)
podfile = Podfile.new(path) do
# rubocop:disable Lint/RescueException
begin
# rubocop:disable Eval
# rubocop:disable Security/Eval
eval(contents, nil, path.to_s)
# rubocop:enable Eval
# rubocop:enable Security/Eval
rescue Exception => e
message = "Invalid `#{path.basename}` file: #{e.message}"
raise DSLError.new(message, path, e, contents)
Expand Down
2 changes: 1 addition & 1 deletion lib/cocoapods-core/requirement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Requirement < Pod::Vendor::Gem::Requirement
#
PATTERN = /\A\s*(#{quoted_operators})?\s*(#{Version::VERSION_PATTERN})\s*\z/

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

#-------------------------------------------------------------------------#

Expand Down
4 changes: 2 additions & 2 deletions lib/cocoapods-core/specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -824,9 +824,9 @@ def validate_cocoapods_version
#
#
def self._eval_podspec(string, path)
# rubocop:disable Eval
# rubocop:disable Security/Eval
eval(string, nil, path.to_s)
# rubocop:enable Eval
# rubocop:enable Security/Eval

# rubocop:disable Lint/RescueException
rescue Exception => e
Expand Down

0 comments on commit d1fa25f

Please sign in to comment.