From b2951b120ae92f7059cbec178263db19a2aa1195 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Mon, 5 Mar 2018 11:45:19 +0100 Subject: [PATCH 1/6] Update Rubocop gem to 0.53.0 --- Gemfile | 2 +- Gemfile.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gemfile b/Gemfile index d9298f710..ffbc0e3ce 100644 --- a/Gemfile +++ b/Gemfile @@ -86,7 +86,7 @@ group :development do gem 'capistrano-rails', '~> 1.3.1', require: false gem 'capistrano3-delayed-job', '~> 1.7.3' gem 'mdl', '~> 0.4.0', require: false - gem 'rubocop', '~> 0.52.1', require: false + gem 'rubocop', '~> 0.53.0', require: false gem 'rubocop-rspec', '~> 1.22.1', require: false gem 'rvm1-capistrano3', '~> 1.4.0', require: false gem 'scss_lint', '~> 0.54.0', require: false diff --git a/Gemfile.lock b/Gemfile.lock index db16889db..dca5dadf6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,7 +60,7 @@ GEM ancestry (3.0.1) activerecord (>= 3.2.0) arel (6.0.4) - ast (2.3.0) + ast (2.4.0) babel-source (5.8.35) babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) @@ -305,8 +305,8 @@ GEM parallel (1.12.1) paranoia (2.4.0) activerecord (>= 4.0, < 5.2) - parser (2.4.0.2) - ast (~> 2.3) + parser (2.5.0.5) + ast (~> 2.4.0) pg (0.21.0) pg_search (2.0.1) activerecord (>= 4.2) @@ -352,7 +352,7 @@ GEM rainbow (2.2.2) rake raindrops (0.19.0) - rake (12.3.0) + rake (12.3.1) redcarpet (3.4.0) referer-parser (0.3.0) request_store (1.3.2) @@ -379,9 +379,9 @@ GEM rspec-mocks (~> 3.7.0) rspec-support (~> 3.7.0) rspec-support (3.7.0) - rubocop (0.52.1) + rubocop (0.53.0) parallel (~> 1.10) - parser (>= 2.4.0.2, < 3.0) + parser (>= 2.5) powerpack (~> 0.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) @@ -550,7 +550,7 @@ DEPENDENCIES rinku (~> 2.0.2) rollbar (~> 2.15.5) rspec-rails (~> 3.6) - rubocop (~> 0.52.1) + rubocop (~> 0.53.0) rubocop-rspec (~> 1.22.1) rvm1-capistrano3 (~> 1.4.0) sass-rails (~> 5.0, >= 5.0.4) From b0c0578cbe65b89f085a17e9e311f4507b5e1245 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Mon, 5 Mar 2018 11:45:27 +0100 Subject: [PATCH 2/6] Remove deprecated Performance/HashEachMethods cop At release https://github.com/bbatsov/rubocop/releases/tag/v0.53.0 it has been removed with https://github.com/bbatsov/rubocop/issues/5589 --- .rubocop.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0ff2d3154..8b7233714 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -73,9 +73,6 @@ Performance/FixedSize: Performance/FlatMap: Enabled: true -Performance/HashEachMethods: - Enabled: true - Performance/LstripRstrip: Enabled: true From 1d0bf77cca5998aaed8465934e4a0b2d085e170e Mon Sep 17 00:00:00 2001 From: Bertocq Date: Wed, 7 Mar 2018 13:31:00 +0100 Subject: [PATCH 3/6] Update rubocop-rspec gem to 1.24.0 from 1.22.1 --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index ffbc0e3ce..85f8a1c33 100644 --- a/Gemfile +++ b/Gemfile @@ -87,7 +87,7 @@ group :development do gem 'capistrano3-delayed-job', '~> 1.7.3' gem 'mdl', '~> 0.4.0', require: false gem 'rubocop', '~> 0.53.0', require: false - gem 'rubocop-rspec', '~> 1.22.1', require: false + gem 'rubocop-rspec', '~> 1.24.0', require: false gem 'rvm1-capistrano3', '~> 1.4.0', require: false gem 'scss_lint', '~> 0.54.0', require: false gem 'web-console', '~> 3.3.0' diff --git a/Gemfile.lock b/Gemfile.lock index dca5dadf6..8d206f2d9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -386,8 +386,8 @@ GEM rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) - rubocop-rspec (1.22.1) - rubocop (>= 0.52.1) + rubocop-rspec (1.24.0) + rubocop (>= 0.53.0) ruby-progressbar (1.9.0) rubyzip (1.2.1) rvm1-capistrano3 (1.4.0) @@ -551,7 +551,7 @@ DEPENDENCIES rollbar (~> 2.15.5) rspec-rails (~> 3.6) rubocop (~> 0.53.0) - rubocop-rspec (~> 1.22.1) + rubocop-rspec (~> 1.24.0) rvm1-capistrano3 (~> 1.4.0) sass-rails (~> 5.0, >= 5.0.4) savon (~> 2.11.1) From d3d9573086ce48a1e85f0415ef1dd7a1fa85c302 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Wed, 7 Mar 2018 13:39:10 +0100 Subject: [PATCH 4/6] Enable new Rails/HttpStatus cop without issues rubocop-rspec 1.23.0 release introduced the cop RSpec/Rails/HttpStatus to enforce consistent usage of the status format (numeric or symbolic). * https://github.com/rubocop-rspec/rubocop-rspec/pull/553 * https://github.com/rubocop-rspec/rubocop-rspec/releases/tag/v1.23.0 --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 8b7233714..34c798d5f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -370,6 +370,9 @@ RSpec/OverwritingSetup: RSpec/PredicateMatcher: Enabled: true +Rails/HttpStatus: + Enabled: true + RSpec/RepeatedDescription: Enabled: true From e2c42a3c63ab90b0fadfd3444c9cc402341d458e Mon Sep 17 00:00:00 2001 From: Bertocq Date: Wed, 7 Mar 2018 13:44:54 +0100 Subject: [PATCH 5/6] Enable StaticAttributeDefinedDynamically cop & fix rubocop-rspec gem includes cops for FactoryBot like the new FactoryBot/StaticAttributeDefinedDynamically to enforce declaring static attribute values without a block. * http://www.rubydoc.info/gems/rubocop-rspec/1.24.0/RuboCop/Cop/RSpec/FactoryBot/StaticAttributeDefinedDynamically --- .rubocop.yml | 3 +++ spec/factories.rb | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 34c798d5f..4b4bf3148 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -403,6 +403,9 @@ RSpec/VerifiedDoubles: RSpec/VoidExpect: Enabled: true +FactoryBot/StaticAttributeDefinedDynamically: + Enabled: true + Security/Eval: Enabled: true diff --git a/spec/factories.rb b/spec/factories.rb index 2f9cc4acc..6df58f03b 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -638,13 +638,13 @@ FactoryBot.define do factory :poll_partial_result, class: 'Poll::PartialResult' do association :question, factory: [:poll_question, :with_answers] association :author, factory: :user - origin { 'web' } + origin 'web' answer { question.question_answers.sample.title } end factory :poll_recount, class: 'Poll::Recount' do association :author, factory: :user - origin { 'web' } + origin 'web' end factory :officing_residence, class: 'Officing::Residence' do From 2bf019f08ba441a38fd718351a90428d01284bab Mon Sep 17 00:00:00 2001 From: Bertocq Date: Wed, 4 Apr 2018 17:51:09 +0200 Subject: [PATCH 6/6] Disable DynamicAttributeDefinedStatically cop rubocop-rspec includes a FactoryBot cop DynamicAttributeDefinedStatically that enforces declaring dynamic attribute values in a block. It was decided not to follow this convention. Explicitly disabling it gives more insight about current rubocop rules. http://www.rubydoc.info/gems/rubocop-rspec/1.24.0/RuboCop/Cop/RSpec/FactoryBot/DynamicAttributeDefinedStatically --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 4b4bf3148..f697dab0f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -406,6 +406,9 @@ RSpec/VoidExpect: FactoryBot/StaticAttributeDefinedDynamically: Enabled: true +FactoryBot/DynamicAttributeDefinedStatically: + Enabled: false + Security/Eval: Enabled: true