Skip to content

Commit 4aad010

Browse files
authored
Upgrade rubocop and config (#536)
* Upgrade rubocop and config * Run rubocop on github actions * Try rubocop github actions * Fixes to workflow, try cache * bundle exec rubocop -a * Cache? * Test cache * Fix error in yml * Work rubocop, work * Exclude vendor rubocop * ok, now cache works * Cache works!
1 parent 646d3cd commit 4aad010

File tree

5 files changed

+53
-22
lines changed

5 files changed

+53
-22
lines changed

.github/workflows/rubocop.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: RuboCop
2+
3+
on:
4+
push:
5+
branches: [ master, bs4 ]
6+
pull_request:
7+
branches: [ master, bs4 ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Ruby 2.6
16+
uses: ruby/setup-ruby@v1
17+
with:
18+
ruby-version: 2.6
19+
- name: Cache gems
20+
uses: actions/cache@v1
21+
with:
22+
path: vendor/bundle
23+
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
24+
restore-keys: |
25+
${{ runner.os }}-rubocop-
26+
- name: Install gems
27+
run: |
28+
bundle config path vendor/bundle
29+
bundle install --jobs 4 --retry 3
30+
- name: Run RuboCop
31+
run: bundle exec rubocop

.rubocop.yml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ AllCops:
88
Exclude:
99
- 'ext/**/*'
1010
- 'db/**/*'
11+
- '**/vendor/**/*'
1112

1213
# Style
1314
Style/StringLiterals:

Gemfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ group :development, :test do
6666
gem 'launchy' # for capybara's save_and_open_page
6767
gem 'mimic', '~> 0.4'
6868
gem 'railroady' # for doc/diagrams
69-
gem 'rubocop', '~> 1.5.2', require: false # HoundCI requires 1.5.2
70-
gem 'rubocop-rails_config', '~> 1.2.2' # Rubocop locked
69+
gem 'rubocop', '~> 1.13', require: false # HoundCI requires 1.5.2
70+
gem 'rubocop-rails_config', '~> 1.5' # Rubocop locked
7171
gem 'ruby-prof', '~> 1.4' # for performance tests
7272
gem 'simplecov', require: false
7373
end

Gemfile.lock

+14-14
Original file line numberDiff line numberDiff line change
@@ -347,32 +347,32 @@ GEM
347347
rspec-mocks (~> 3.10)
348348
rspec-support (~> 3.10)
349349
rspec-support (3.10.2)
350-
rubocop (1.5.2)
350+
rubocop (1.15.0)
351351
parallel (~> 1.10)
352-
parser (>= 2.7.1.5)
352+
parser (>= 3.0.0.0)
353353
rainbow (>= 2.2.2, < 4.0)
354354
regexp_parser (>= 1.8, < 3.0)
355355
rexml
356-
rubocop-ast (>= 1.2.0, < 2.0)
356+
rubocop-ast (>= 1.5.0, < 2.0)
357357
ruby-progressbar (~> 1.7)
358-
unicode-display_width (>= 1.4.0, < 2.0)
358+
unicode-display_width (>= 1.4.0, < 3.0)
359359
rubocop-ast (1.5.0)
360360
parser (>= 3.0.1.1)
361361
rubocop-packaging (0.5.1)
362362
rubocop (>= 0.89, < 2.0)
363-
rubocop-performance (1.10.2)
364-
rubocop (>= 0.90.0, < 2.0)
363+
rubocop-performance (1.11.3)
364+
rubocop (>= 1.7.0, < 2.0)
365365
rubocop-ast (>= 0.4.0)
366-
rubocop-rails (2.9.1)
366+
rubocop-rails (2.10.1)
367367
activesupport (>= 4.2.0)
368368
rack (>= 1.1)
369-
rubocop (>= 0.90.0, < 2.0)
370-
rubocop-rails_config (1.2.2)
369+
rubocop (>= 1.7.0, < 2.0)
370+
rubocop-rails_config (1.5.3)
371371
railties (>= 5.0)
372-
rubocop (>= 1.0)
372+
rubocop (>= 1.13)
373373
rubocop-ast (>= 1.0.1)
374374
rubocop-packaging (~> 0.5)
375-
rubocop-performance (~> 1.3)
375+
rubocop-performance (~> 1.11)
376376
rubocop-rails (~> 2.0)
377377
ruby-prof (1.4.3)
378378
ruby-progressbar (1.11.0)
@@ -426,7 +426,7 @@ GEM
426426
unf (0.1.4)
427427
unf_ext
428428
unf_ext (0.0.7.7)
429-
unicode-display_width (1.7.0)
429+
unicode-display_width (2.0.0)
430430
webrick (1.7.0)
431431
websocket-driver (0.7.3)
432432
websocket-extensions (>= 0.1.0)
@@ -489,8 +489,8 @@ DEPENDENCIES
489489
rspec-activemodel-mocks (~> 1.1)
490490
rspec-core (~> 3.10)
491491
rspec-rails (~> 5.0)
492-
rubocop (~> 1.5.2)
493-
rubocop-rails_config (~> 1.2.2)
492+
rubocop (~> 1.13)
493+
rubocop-rails_config (~> 1.5)
494494
ruby-prof (~> 1.4)
495495
sassc-rails (~> 2.1)
496496
simplecov

app/models/source_file_list.rb

+5-6
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,12 @@ def self.make_path_names_relative(root_dir, files)
154154

155155
def self.sort_source_files(files)
156156
files.sort_by do |f|
157-
priority = begin
158-
if f.path.include?('WEB-INF/') then 1
159-
elsif f.path.start_with?('src/main/resources') then 2
160-
elsif f.path == 'pom.xml' then 3
161-
else 0
162-
end
157+
priority = if f.path.include?('WEB-INF/') then 1
158+
elsif f.path.start_with?('src/main/resources') then 2
159+
elsif f.path == 'pom.xml' then 3
160+
else 0
163161
end
162+
164163
[priority, f.path]
165164
end
166165
end

0 commit comments

Comments
 (0)