Skip to content

Commit

Permalink
Rubocop upgrade
Browse files Browse the repository at this point in the history
Move to use gc_rubocop official gem, fix-up outstanding cops, add a
rubocop todo.
  • Loading branch information
lawrencejones committed Aug 4, 2020
1 parent d8269cd commit 0d26934
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 24 deletions.
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
inherit_from: .rubocop_todo.yml

---
inherit_gem:
ruboconfig: rubocop.yml
gc_ruboconfig: rubocop.yml

AllCops:
Exclude:
Expand Down
74 changes: 74 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-07-24 09:19:02 UTC using RuboCop version 0.88.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: leading, trailing
Layout/DotPosition:
Exclude:
- 'spec/draupnir/health_check_spec.rb'

# Offense count: 7
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
# ExcludedMethods: refine
Metrics/BlockLength:
Max: 190

# Offense count: 4
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
Metrics/MethodLength:
Max: 12

# Offense count: 1
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'Vagrantfile'

# Offense count: 259
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Exclude:
- 'Vagrantfile'
- 'spec/draupnir/access_token_spec.rb'
- 'spec/draupnir/health_check_spec.rb'
- 'spec/draupnir/image_spec.rb'
- 'spec/draupnir/instance_spec.rb'
- 'spec/spec_helper.rb'

# Offense count: 18
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArguments:
Exclude:
- 'spec/draupnir/image_spec.rb'
- 'spec/draupnir/instance_spec.rb'
- 'spec/spec_helper.rb'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArrayLiteral:
Exclude:
- 'spec/draupnir/image_spec.rb'
- 'spec/draupnir/instance_spec.rb'

# Offense count: 30
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInHashLiteral:
Exclude:
- 'spec/draupnir/image_spec.rb'
- 'spec/draupnir/instance_spec.rb'
- 'spec/spec_helper.rb'
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ source 'https://rubygems.org'
gem 'activesupport'
gem 'docker-api'
gem 'fpm'
gem 'gc_ruboconfig'
gem 'pry'
gem 'rest-client'
gem 'rspec'
gem 'ruboconfig', git: 'https://github.com/gocardless/ruboconfig', branch: 'v1.0.1'
gem 'rubocop'
44 changes: 25 additions & 19 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
GIT
remote: https://github.com/gocardless/ruboconfig
revision: cd02a1d21846d3bbf5844e385d6e518556a96cef
branch: v1.0.1
specs:
ruboconfig (1.0.1)

GEM
remote: https://rubygems.org/
specs:
Expand All @@ -15,7 +8,7 @@ GEM
tzinfo (~> 1.1)
arr-pm (0.0.10)
cabin (> 0)
ast (2.3.0)
ast (2.4.1)
backports (3.10.3)
cabin (0.9.0)
childprocess (0.8.0)
Expand Down Expand Up @@ -43,6 +36,10 @@ GEM
pleaserun (~> 0.0.29)
ruby-xz
stud
gc_ruboconfig (2.16.0)
rubocop (>= 0.87)
rubocop-performance (~> 1.7)
rubocop-rspec (>= 1.38.1)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (1.8.2)
Expand All @@ -58,25 +55,26 @@ GEM
multi_json (1.12.2)
mustache (0.99.8)
netrc (0.11.0)
parallel (1.12.1)
parser (2.4.0.2)
ast (~> 2.3)
parallel (1.19.2)
parser (2.7.1.4)
ast (~> 2.4.1)
pleaserun (0.0.30)
cabin (> 0)
clamp
dotenv
insist
mustache (= 0.99.8)
stud
powerpack (0.1.1)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
rainbow (3.0.0)
regexp_parser (1.7.1)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
rexml (3.2.4)
rspec (3.7.0)
rspec-core (~> 3.7.0)
rspec-expectations (~> 3.7.0)
Expand All @@ -90,14 +88,22 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.7.0)
rspec-support (3.7.0)
rubocop (0.52.0)
rubocop (0.88.0)
parallel (~> 1.10)
parser (>= 2.4.0.2, < 3.0)
powerpack (~> 0.1)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.1.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.9.0)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.2.0)
parser (>= 2.7.0.1)
rubocop-performance (1.7.1)
rubocop (>= 0.82.0)
rubocop-rspec (1.42.0)
rubocop (>= 0.87.0)
ruby-progressbar (1.10.1)
ruby-xz (0.2.3)
ffi (~> 1.9)
io-like (~> 0.3)
Expand All @@ -108,7 +114,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.4)
unicode-display_width (1.3.0)
unicode-display_width (1.7.0)

PLATFORMS
ruby
Expand All @@ -117,10 +123,10 @@ DEPENDENCIES
activesupport
docker-api
fpm
gc_ruboconfig
pry
rest-client
rspec
ruboconfig!
rubocop

BUNDLED WITH
Expand Down
2 changes: 1 addition & 1 deletion spec/draupnir/health_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
expect(response.headers[:draupnir_version]).to eq(Draupnir::VERSION)

# Verify that we have a well-formed version, ie. valid semver value
expect(response.headers[:draupnir_version]).not_to eql("0.0.0")
expect(response.headers[:draupnir_version]).to_not eql("0.0.0")
expect(response.headers[:draupnir_version]).to match(/^\d+\.\d+\.\d+$/)
end

Expand Down
1 change: 0 additions & 1 deletion spec/draupnir/instance_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def create_unready_image
),
)["data"]["id"]
end
# rubocop:enable Metrics/MethodLength

def create_ready_image
image_id = create_unready_image
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class Draupnir
BOOTSTRAP = "/workspace/spec/fixtures/bootstrap"
VERSION = File.read(File.expand_path("../../DRAUPNIR_VERSION", __FILE__)).chomp
VERSION = File.read(File.expand_path("../DRAUPNIR_VERSION", __dir__)).chomp
STREAMER = ->(stream, chunk) { puts(chunk) if ENV.key?("DEBUG") || stream == :stderr }

def self.client
Expand Down

0 comments on commit 0d26934

Please sign in to comment.