Skip to content

Commit

Permalink
Add Rubocop to CI (#356)
Browse files Browse the repository at this point in the history
* Add Rubocop to CI

Make Travis run Rubocop before running the RSpec suite so we catch any style violations.

This resolves https://github.com/DEFRA/waste-carriers-renewals/issues/176

* Install Rubocop as dependency
  • Loading branch information
irisfaraway committed Jan 4, 2019
1 parent 7a0d0b0 commit 8cccfb7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ before_script:
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter; fi
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then chmod +x ./cc-test-reporter; fi
- if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter before-build; fi
# Run rubocop. It's installed as a dependency (hence no install step) as this
# allows projects to control the version they are using (rather than getting)
# surprise build failures.
- bundle exec rubocop
script:
- bundle exec rspec
after_script:
Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ group :development, :test do
gem "byebug"
gem "dotenv-rails"
gem "rspec-rails", "~> 3.6"
# Rubocop to ensure consistency in how the code is written
gem "rubocop"
end

group :development do
Expand Down
17 changes: 17 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ GEM
airbrake-ruby (~> 1.8)
airbrake-ruby (1.8.0)
arel (6.0.4)
ast (2.4.0)
bcrypt (3.1.12)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
Expand Down Expand Up @@ -130,6 +131,7 @@ GEM
i18n (0.9.5)
concurrent-ruby (~> 1.0)
i18n_data (0.8.0)
jaro_winkler (1.5.2)
jbuilder (2.8.0)
activesupport (>= 4.2.0)
multi_json (>= 1.2)
Expand Down Expand Up @@ -165,7 +167,11 @@ GEM
sawyer (~> 0.8.0, >= 0.5.3)
origin (2.3.1)
orm_adapter (0.5.0)
parallel (1.12.1)
parser (2.5.3.0)
ast (~> 2.4.0)
phonelib (0.6.28)
powerpack (0.1.2)
public_suffix (3.0.3)
rack (1.6.11)
rack-test (0.6.3)
Expand Down Expand Up @@ -229,6 +235,15 @@ GEM
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
rubocop (0.62.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.5, != 2.5.1.1)
powerpack (~> 0.1)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.4.0)
ruby-progressbar (1.10.0)
safe_yaml (1.0.4)
sass (3.7.2)
sass-listen (~> 4.0.0)
Expand Down Expand Up @@ -267,6 +282,7 @@ GEM
unf (0.1.4)
unf_ext
unf_ext (0.0.7.5)
unicode-display_width (1.4.1)
unicode_utils (1.4.0)
useragent (0.16.10)
validates_email_format_of (1.6.3)
Expand Down Expand Up @@ -305,6 +321,7 @@ DEPENDENCIES
rails-html-sanitizer (>= 1.0.4)
rails_12factor
rspec-rails (~> 3.6)
rubocop
secure_headers (~> 5.0)
simplecov
spring
Expand Down

0 comments on commit 8cccfb7

Please sign in to comment.