From 6d703c0bd06851308fac0f5dc0697491b86fea7c Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 4 Mar 2020 15:54:06 +0100 Subject: [PATCH 01/12] Replace prawn_rails with prawn-rails --- Gemfile | 3 +-- Gemfile.lock | 12 +++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 032f94b43..5af091a74 100644 --- a/Gemfile +++ b/Gemfile @@ -51,9 +51,8 @@ gem 'openid_connect' gem 'openstack' gem 'pg' gem 'phonelib' -gem 'prawn' # PDF Generation +gem 'prawn-rails' # PDF Generation gem 'prawn-svg' -gem 'prawn_rails' gem 'premailer-rails' gem 'puma' # Use Puma as the app server gem 'pundit' diff --git a/Gemfile.lock b/Gemfile.lock index a13bb0995..b4e63f9ef 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -431,12 +431,15 @@ GEM prawn (2.2.2) pdf-core (~> 0.7.0) ttfunk (~> 1.5) + prawn-rails (1.3.0) + prawn + prawn-table + rails (>= 3.1.0) prawn-svg (0.29.1) css_parser (~> 1.6) prawn (>= 0.11.1, < 3) - prawn_rails (0.0.11) - prawn (>= 0.11.1) - railties (>= 3.0.0) + prawn-table (0.2.2) + prawn (>= 1.3.0, < 3.0.0) premailer (1.11.1) addressable css_parser (>= 1.6.0) @@ -779,9 +782,8 @@ DEPENDENCIES openstack pg phonelib - prawn + prawn-rails prawn-svg - prawn_rails premailer-rails pry-byebug puma From ae2cfdd44e9ce5efb514ddcc5923cac1e76856e1 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 4 Mar 2020 16:23:54 +0100 Subject: [PATCH 02/12] Update browser gem `modern?` method was removed in version 4 --- Gemfile.lock | 2 +- app/controllers/application_controller.rb | 2 +- app/helpers/application_helper.rb | 8 ++++++++ app/services/browser_support.rb | 13 +++++++++++++ .../layouts/_outdated_browser_banner.html.haml | 3 +-- config/initializers/browser.rb | 8 -------- 6 files changed, 24 insertions(+), 12 deletions(-) create mode 100644 app/services/browser_support.rb delete mode 100644 config/initializers/browser.rb diff --git a/Gemfile.lock b/Gemfile.lock index b4e63f9ef..6265df9f2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -118,7 +118,7 @@ GEM bootstrap-wysihtml5-rails (0.3.3.8) railties (>= 3.0) brakeman (4.3.1) - browser (2.5.3) + browser (4.0.0) builder (3.2.4) byebug (10.0.2) capybara (3.29.0) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c192c0f75..b78fe1b90 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -233,7 +233,7 @@ class ApplicationController < ActionController::Base key: sentry[:client_key], enabled: sentry[:enabled], environment: sentry[:environment], - browser: { modern: browser.modern? }, + browser: { modern: BrowserSupport.supported?(browser) }, user: sentry_user } end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9929ab7f6..e45d95781 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -131,4 +131,12 @@ module ApplicationHelper def has_dismissed_outdated_browser_banner? cookies[:dismissed_outdated_browser_banner] == 'true' end + + def supported_browser? + BrowserSupport.supported?(browser) + end + + def show_outdated_browser_banner? + !supported_browser? && !has_dismissed_outdated_browser_banner? + end end diff --git a/app/services/browser_support.rb b/app/services/browser_support.rb new file mode 100644 index 000000000..46f5a372d --- /dev/null +++ b/app/services/browser_support.rb @@ -0,0 +1,13 @@ +class BrowserSupport + def self.supported?(browser) + # See .browserslistrc + [ + browser.chrome? && browser.version.to_i >= 50 && !browser.platform.ios?, + browser.edge? && browser.version.to_i >= 14 && !browser.compatibility_view?, + browser.firefox? && browser.version.to_i >= 50 && !browser.platform.ios?, + browser.opera? && browser.version.to_i >= 40, + browser.safari? && browser.version.to_i >= 8, + browser.platform.ios? && browser.platform.version.to_i >= 8 + ].any? + end +end diff --git a/app/views/layouts/_outdated_browser_banner.html.haml b/app/views/layouts/_outdated_browser_banner.html.haml index ee39e191d..25a8bcbd8 100644 --- a/app/views/layouts/_outdated_browser_banner.html.haml +++ b/app/views/layouts/_outdated_browser_banner.html.haml @@ -1,5 +1,4 @@ --# See config/browser.rb -- if !browser.modern? && !has_dismissed_outdated_browser_banner? +- if show_outdated_browser_banner? #outdated-browser-banner.site-banner .container .site-banner-icon ⚠️ diff --git a/config/initializers/browser.rb b/config/initializers/browser.rb deleted file mode 100644 index f9d22d40b..000000000 --- a/config/initializers/browser.rb +++ /dev/null @@ -1,8 +0,0 @@ -# See .browserslistrc -Browser.modern_rules.clear -Browser.modern_rules << -> b { b.chrome? && b.version.to_i >= 50 && !b.platform.ios? } -Browser.modern_rules << -> b { b.edge? && b.version.to_i >= 14 && !b.compatibility_view? } -Browser.modern_rules << -> b { b.firefox? && b.version.to_i >= 50 && !b.platform.ios? } -Browser.modern_rules << -> b { b.opera? && b.version.to_i >= 40 } -Browser.modern_rules << -> b { b.safari? && b.version.to_i >= 8 } -Browser.modern_rules << -> b { b.platform.ios? && b.platform.version.to_i >= 8 } From 74f7eaaf2e43fc054f2ffcbe59bf2d83efe198b2 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 4 Mar 2020 16:32:40 +0100 Subject: [PATCH 03/12] Update spreadsheet_architect --- Gemfile | 1 - Gemfile.lock | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Gemfile b/Gemfile index 5af091a74..247cac509 100644 --- a/Gemfile +++ b/Gemfile @@ -9,7 +9,6 @@ gem 'activestorage-openstack' gem 'administrate' gem 'after_party' gem 'anchored' -gem 'axlsx', '~> 3.0.0.pre' # https://github.com/randym/axlsx/issues/501#issuecomment-373640365 gem 'bcrypt' gem 'bootstrap-sass', '>= 3.4.1' gem 'bootstrap-wysihtml5-rails', '~> 0.3.3.8' diff --git a/Gemfile.lock b/Gemfile.lock index 6265df9f2..4a13d0c21 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,14 +97,9 @@ GEM attr_required (1.0.1) autoprefixer-rails (9.4.4) execjs - axlsx (3.0.0.pre) - htmlentities (~> 4.3, >= 4.3.4) - mimemagic (~> 0.3) - nokogiri (~> 1.8, >= 1.8.2) - rubyzip (~> 1.2, >= 1.2.1) - axlsx_styler (0.2.0) + axlsx_styler (1.0.0) activesupport (>= 3.1) - axlsx (>= 2.0, < 4) + caxlsx (>= 2.0.2) babel-source (5.8.35) babel-transpiler (0.7.0) babel-source (>= 4.0, < 6) @@ -140,6 +135,11 @@ GEM selenium-webdriver case_transform (0.2) activesupport + caxlsx (3.0.1) + htmlentities (~> 4.3, >= 4.3.4) + mimemagic (~> 0.3) + nokogiri (~> 1.10, >= 1.10.4) + rubyzip (>= 1.3.0, < 3) chartkick (3.3.1) childprocess (0.9.0) ffi (~> 1.0, >= 1.0.11) @@ -197,6 +197,7 @@ GEM dotenv-rails (2.5.0) dotenv (= 2.5.0) railties (>= 3.2, < 6.0) + dry-inflector (0.2.0) em-websocket (0.5.1) eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) @@ -531,9 +532,9 @@ GEM rgeo (2.0.0) rgeo-geojson (2.1.1) rgeo (>= 1.0.0) - rodf (1.0.0) - activesupport (>= 3.0) + rodf (1.1.1) builder (>= 3.0) + dry-inflector (~> 0.1) rubyzip (>= 1.0) rouge (3.16.0) rspec (3.9.0) @@ -631,9 +632,9 @@ GEM jquery-rails kaminari (>= 0.17) rails (>= 3.2) - spreadsheet_architect (3.2.0) - axlsx (>= 2, < 4) - axlsx_styler (>= 0.1.7, < 2) + spreadsheet_architect (4.0.0) + axlsx_styler (>= 1.0.0, < 2) + caxlsx (>= 2.0.2, < 4) rodf (>= 1.0.0, < 2) spring (2.0.2) activesupport (>= 4.2) @@ -724,7 +725,6 @@ DEPENDENCIES administrate after_party anchored - axlsx (~> 3.0.0.pre) bcrypt bootstrap-sass (>= 3.4.1) bootstrap-wysihtml5-rails (~> 0.3.3.8) From 6a3f137495fc95a61d00d02f0d2b65b4a66a2d56 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 4 Mar 2020 16:40:12 +0100 Subject: [PATCH 04/12] Update deep_cloneable gem --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4a13d0c21..efb23dfb8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -165,8 +165,8 @@ GEM database_cleaner (1.7.0) datetime_picker_rails (0.0.7) momentjs-rails (>= 2.8.1) - deep_cloneable (2.3.2) - activerecord (>= 3.1.0, < 6) + deep_cloneable (3.0.0) + activerecord (>= 3.1.0, < 7) delayed_cron_job (0.7.2) delayed_job (>= 4.1) delayed_job (4.1.5) From ef4ca5d72bf0e2e9a87d0289b0a44879d69f07a1 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 4 Mar 2020 16:41:10 +0100 Subject: [PATCH 05/12] Update dotenv-rails gem --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index efb23dfb8..198d1e2c6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -193,10 +193,10 @@ GEM activerecord (>= 4.2, < 7) domain_name (0.5.20180417) unf (>= 0.0.5, < 1.0.0) - dotenv (2.5.0) - dotenv-rails (2.5.0) - dotenv (= 2.5.0) - railties (>= 3.2, < 6.0) + dotenv (2.7.5) + dotenv-rails (2.7.5) + dotenv (= 2.7.5) + railties (>= 3.2, < 6.1) dry-inflector (0.2.0) em-websocket (0.5.1) eventmachine (>= 0.12.9) From 011d773de54e0fbd07918ee2612aa2a2901a9a14 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 4 Mar 2020 16:41:53 +0100 Subject: [PATCH 06/12] Update delayed_job --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 198d1e2c6..b3b89fd58 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -169,10 +169,10 @@ GEM activerecord (>= 3.1.0, < 7) delayed_cron_job (0.7.2) delayed_job (>= 4.1) - delayed_job (4.1.5) - activesupport (>= 3.0, < 5.3) - delayed_job_active_record (4.1.3) - activerecord (>= 3.0, < 5.3) + delayed_job (4.1.8) + activesupport (>= 3.0, < 6.1) + delayed_job_active_record (4.1.4) + activerecord (>= 3.0, < 6.1) delayed_job (>= 3.0, < 5) delayed_job_web (1.4.3) activerecord (> 3.0.0) From 2286049447dbfeae809f81d4873102e9d78bcd63 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 4 Mar 2020 16:42:21 +0100 Subject: [PATCH 07/12] Update groupdate gem --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b3b89fd58..3ca1dfea4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -261,8 +261,8 @@ GEM bundler (>= 1.14) graphql (~> 1.10) thor (>= 0.19, < 2.0) - groupdate (4.1.1) - activesupport (>= 4.2) + groupdate (5.0.0) + activesupport (>= 5) guard (2.15.0) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) From 82d040d21e77165d4fd13cbf2fc4d03743bb256a Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 4 Mar 2020 16:42:52 +0100 Subject: [PATCH 08/12] Update premailer-rails gem --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3ca1dfea4..9aa9ede1d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -158,7 +158,7 @@ GEM crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.6) - css_parser (1.6.0) + css_parser (1.7.1) addressable curb (0.9.10) daemons (1.3.1) @@ -445,8 +445,8 @@ GEM addressable css_parser (>= 1.6.0) htmlentities (>= 4.0.0) - premailer-rails (1.10.2) - actionmailer (>= 3, < 6) + premailer-rails (1.10.3) + actionmailer (>= 3) premailer (~> 1.7, >= 1.7.9) promise.rb (0.7.4) pry (0.12.2) From 5bccfba122220eb081888b8e2b2c1579e71a9d5b Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 4 Mar 2020 16:35:02 +0100 Subject: [PATCH 09/12] Update administrate gem --- Gemfile | 1 + Gemfile.lock | 27 +++++++++++---------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Gemfile b/Gemfile index 247cac509..f30eda63b 100644 --- a/Gemfile +++ b/Gemfile @@ -69,6 +69,7 @@ gem 'sentry-raven' gem 'skylight' gem 'smart_listing' gem 'spreadsheet_architect' +gem 'sprockets', '< 4' gem 'turbolinks' # Turbolinks makes following links in your web application faster gem 'typhoeus' gem 'warden' diff --git a/Gemfile.lock b/Gemfile.lock index 9aa9ede1d..3a6299fa4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -78,16 +78,16 @@ GEM tzinfo (~> 1.1) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - administrate (0.11.0) - actionpack (>= 4.2, < 6.0) - actionview (>= 4.2, < 6.0) - activerecord (>= 4.2, < 6.0) + administrate (0.12.0) + actionpack (>= 4.2) + actionview (>= 4.2) + activerecord (>= 4.2) autoprefixer-rails (>= 6.0) datetime_picker_rails (~> 0.0.7) jquery-rails (>= 4.0) kaminari (>= 1.0) momentjs-rails (~> 2.8) - sass-rails (~> 5.0) + sassc-rails (~> 2.1) selectize-rails (~> 0.6) aes_key_wrap (1.0.1) after_party (1.10.0) @@ -95,7 +95,7 @@ GEM arel (9.0.0) ast (2.4.0) attr_required (1.0.1) - autoprefixer-rails (9.4.4) + autoprefixer-rails (9.7.4) execjs axlsx_styler (1.0.0) activesupport (>= 3.1) @@ -315,7 +315,7 @@ GEM concurrent-ruby (~> 1.0) ipaddress (0.8.3) jaro_winkler (1.5.2) - jquery-rails (4.3.3) + jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -511,7 +511,7 @@ GEM rake (12.3.3) rake-progressbar (0.0.5) rb-fsevent (0.10.3) - rb-inotify (0.10.0) + rb-inotify (0.10.1) ffi (~> 1.0) react-rails (2.4.7) babel-transpiler (>= 0.7.0) @@ -579,17 +579,11 @@ GEM rubyzip (1.3.0) safe_yaml (1.0.4) sanitize-url (0.1.4) - sass (3.7.3) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sass-rails (5.0.7) - railties (>= 4.0.0, < 6) - sass (~> 3.1) - sprockets (>= 2.8, < 4.0) - sprockets-rails (>= 2.0, < 4.0) - tilt (>= 1.1, < 3) sassc (2.0.0) ffi (~> 1.9.6) rake @@ -655,7 +649,7 @@ GEM temple (0.8.0) thor (1.0.1) thread_safe (0.3.6) - tilt (2.0.9) + tilt (2.0.10) timecop (0.9.1) ttfunk (1.5.1) turbolinks (5.2.0) @@ -813,6 +807,7 @@ DEPENDENCIES spreadsheet_architect spring spring-commands-rspec + sprockets (< 4) timecop turbolinks typhoeus From 10f2bd21ecae685f58be9104f3d6c98ca608776d Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 4 Mar 2020 17:59:00 +0100 Subject: [PATCH 10/12] Update haml --- Gemfile.lock | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3a6299fa4..c98386b35 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -282,21 +282,20 @@ GEM guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - haml (5.0.4) + haml (5.1.2) temple (>= 0.8.0) tilt haml-lint (0.999.999) haml_lint - haml-rails (1.0.0) - actionpack (>= 4.0.1) - activesupport (>= 4.0.1) + haml-rails (2.0.1) + actionpack (>= 5.1) + activesupport (>= 5.1) haml (>= 4.0.6, < 6.0) html2haml (>= 1.0.1) - railties (>= 4.0.1) - haml_lint (0.28.0) - haml (>= 4.0, < 5.1) + railties (>= 5.1) + haml_lint (0.35.0) + haml (>= 4.0, < 5.2) rainbow - rake (>= 10, < 13) rubocop (>= 0.50.0) sysexits (~> 1.1) hashdiff (0.3.8) @@ -314,7 +313,7 @@ GEM i18n (1.8.2) concurrent-ruby (~> 1.0) ipaddress (0.8.3) - jaro_winkler (1.5.2) + jaro_winkler (1.5.4) jquery-rails (4.3.5) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) @@ -422,13 +421,12 @@ GEM openstack (3.3.21) json orm_adapter (0.5.0) - parallel (1.12.1) - parser (2.5.3.0) + parallel (1.19.1) + parser (2.7.0.4) ast (~> 2.4.0) pdf-core (0.7.0) pg (1.1.3) phonelib (0.6.39) - powerpack (0.1.2) prawn (2.2.2) pdf-core (~> 0.7.0) ttfunk (~> 1.5) @@ -529,6 +527,7 @@ GEM http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) + rexml (3.2.4) rgeo (2.0.0) rgeo-geojson (2.1.1) rgeo (>= 1.0.0) @@ -560,21 +559,21 @@ GEM rspec-support (3.9.2) rspec_junit_formatter (0.4.1) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (0.62.0) + rubocop (0.80.1) jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.5, != 2.5.1.1) - powerpack (~> 0.1) + parser (>= 2.7.0.1) rainbow (>= 2.2.2, < 4.0) + rexml ruby-progressbar (~> 1.7) - unicode-display_width (~> 1.4.0) + unicode-display_width (>= 1.4.0, < 1.7) rubocop-rspec-focused (1.0.0) rubocop (>= 0.51) ruby-debug-ide (0.6.1) rake (>= 0.8.1) - ruby-progressbar (1.10.0) + ruby-progressbar (1.10.1) ruby_dep (1.5.0) - ruby_parser (3.12.0) + ruby_parser (3.14.2) sexp_processor (~> 4.9) rubyzip (1.3.0) safe_yaml (1.0.4) @@ -605,7 +604,7 @@ GEM rubyzip (~> 1.2, >= 1.2.2) sentry-raven (2.7.4) faraday (>= 0.7.6, < 1.0) - sexp_processor (4.11.0) + sexp_processor (4.14.1) shellany (0.0.1) shoulda-matchers (4.0.1) activesupport (>= 4.2.0) @@ -646,7 +645,7 @@ GEM attr_required (>= 0.0.5) httpclient (>= 2.4) sysexits (1.2.0) - temple (0.8.0) + temple (0.8.2) thor (1.0.1) thread_safe (0.3.6) tilt (2.0.10) @@ -662,7 +661,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.5) - unicode-display_width (1.4.1) + unicode-display_width (1.6.1) validate_email (0.1.6) activemodel (>= 3.0) mail (>= 2.2.5) From 444d19e1914c77266555cbbb46ece02825196160 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Wed, 4 Mar 2020 16:59:54 +0100 Subject: [PATCH 11/12] Remove unused gems --- Gemfile | 4 ---- Gemfile.lock | 12 ------------ app/assets/stylesheets/application.scss | 1 - config/initializers/openstack_version.rb | 1 - 4 files changed, 18 deletions(-) delete mode 100644 config/initializers/openstack_version.rb diff --git a/Gemfile b/Gemfile index f30eda63b..4493bec41 100644 --- a/Gemfile +++ b/Gemfile @@ -28,8 +28,6 @@ gem 'dotenv-rails', require: 'dotenv/rails-now' # dotenv should always be loaded gem 'flipper' gem 'flipper-active_record' gem 'flipper-ui' -gem 'fog-openstack' -gem 'font-awesome-rails' gem 'geocoder' gem 'gon' gem 'graphiql-rails' @@ -47,7 +45,6 @@ gem 'mailjet' gem 'omniauth-github' gem 'omniauth-rails_csrf_protection', '~> 0.1' gem 'openid_connect' -gem 'openstack' gem 'pg' gem 'phonelib' gem 'prawn-rails' # PDF Generation @@ -64,7 +61,6 @@ gem 'react-rails' gem 'rgeo-geojson' gem 'sanitize-url' gem 'sassc-rails' # Use SCSS for stylesheets -gem 'scenic' gem 'sentry-raven' gem 'skylight' gem 'smart_listing' diff --git a/Gemfile.lock b/Gemfile.lock index c98386b35..fd6bd9a2f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -234,8 +234,6 @@ GEM fog-core (~> 2.1) fog-json (>= 1.0) ipaddress (>= 0.8) - font-awesome-rails (4.7.0.4) - railties (>= 3.2, < 6.0) formatador (0.2.5) geocoder (1.6.0) globalid (0.4.2) @@ -318,7 +316,6 @@ GEM rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (2.2.0) json-jwt (1.11.0) activesupport (>= 4.2) aes_key_wrap @@ -418,8 +415,6 @@ GEM validate_email validate_url webfinger (>= 1.0.1) - openstack (3.3.21) - json orm_adapter (0.5.0) parallel (1.19.1) parser (2.7.0.4) @@ -592,9 +587,6 @@ GEM sprockets (> 3.0) sprockets-rails tilt - scenic (1.4.1) - activerecord (>= 4.0.0) - railties (>= 4.0.0) scss_lint (0.57.1) rake (>= 0.9, < 13) sass (~> 3.5, >= 3.5.5) @@ -745,8 +737,6 @@ DEPENDENCIES flipper flipper-active_record flipper-ui - fog-openstack - font-awesome-rails geocoder gon graphiql-rails @@ -772,7 +762,6 @@ DEPENDENCIES omniauth-github omniauth-rails_csrf_protection (~> 0.1) openid_connect - openstack pg phonelib prawn-rails @@ -796,7 +785,6 @@ DEPENDENCIES ruby-debug-ide sanitize-url sassc-rails - scenic scss_lint sentry-raven shoulda-matchers diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 2f3b5b45e..121de171b 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -34,7 +34,6 @@ // = require_self // = require leaflet -// = require font-awesome // = require franceconnect // = require bootstrap-wysihtml5 diff --git a/config/initializers/openstack_version.rb b/config/initializers/openstack_version.rb deleted file mode 100644 index 0ebdec459..000000000 --- a/config/initializers/openstack_version.rb +++ /dev/null @@ -1 +0,0 @@ -OpenStack::VERSION = 2.0 From 3cd459700624a04bfff5794e2d55dec572b795ee Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 5 Mar 2020 11:03:39 +0100 Subject: [PATCH 12/12] Update rubocop roules --- .rubocop.yml | 80 +++++++++++++++-------------- Gemfile | 1 + Gemfile.lock | 11 ++++ app/controllers/stats_controller.rb | 1 - app/models/dossier.rb | 1 - app/models/instructeur.rb | 1 - spec/factories/procedure.rb | 2 +- 7 files changed, 55 insertions(+), 42 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 3c9ae87c8..0be36f46e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,9 @@ require: - rubocop/rspec/focused - ./lib/cops/unscoped.rb +inherit_gem: + rubocop-rails_config: + - config/rails.yml AllCops: Exclude: @@ -30,13 +33,13 @@ Gemspec/RequiredRubyVersion: Layout/AccessModifierIndentation: Enabled: true -Layout/AlignArray: +Layout/ArrayAlignment: Enabled: true -Layout/AlignHash: +Layout/HashAlignment: Enabled: false -Layout/AlignParameters: +Layout/ParameterAlignment: Enabled: true EnforcedStyle: with_fixed_indentation @@ -89,6 +92,7 @@ Layout/EmptyLineAfterGuardClause: # FIXME: private should not be a column name on TypeDeChamp Layout/EmptyLinesAroundAccessModifier: Enabled: true + EnforcedStyle: around Exclude: - "spec/factories/type_de_champ.rb" @@ -141,22 +145,23 @@ Layout/FirstMethodParameterLineBreak: Layout/FirstParameterIndentation: Enabled: true -Layout/IndentArray: +Layout/FirstArrayElementIndentation: Enabled: true EnforcedStyle: consistent -Layout/IndentAssignment: +Layout/AssignmentIndentation: Enabled: true -Layout/IndentHash: +Layout/FirstHashElementIndentation: Enabled: true EnforcedStyle: consistent -Layout/IndentHeredoc: +Layout/HeredocIndentation: Enabled: true Layout/IndentationConsistency: Enabled: true + EnforcedStyle: normal Layout/IndentationWidth: Enabled: true @@ -275,7 +280,7 @@ Layout/SpaceInsideStringInterpolation: Layout/Tab: Enabled: true -Layout/TrailingBlankLines: +Layout/TrailingEmptyLines: Enabled: true Layout/TrailingWhitespace: @@ -314,7 +319,7 @@ Lint/DuplicateCaseCondition: Lint/DuplicateMethods: Enabled: true -Lint/DuplicatedKey: +Lint/DuplicateHashKey: Enabled: true Lint/EachWithObjectArgument: @@ -347,7 +352,7 @@ Lint/FloatOutOfRange: Lint/FormatParameterMismatch: Enabled: true -Lint/HandleExceptions: +Lint/SuppressedException: Enabled: false Lint/ImplicitStringConcatenation: @@ -374,7 +379,7 @@ Lint/Loop: Lint/MissingCopEnableDirective: Enabled: true -Lint/MultipleCompare: +Lint/MultipleComparison: Enabled: true Lint/NestedMethodDefinition: @@ -445,7 +450,7 @@ Lint/ShadowedException: Lint/ShadowingOuterLocalVariable: Enabled: false -Lint/StringConversionInInterpolation: +Lint/RedundantStringCoercion: Enabled: true Lint/Syntax: @@ -457,16 +462,16 @@ Lint/UnderscorePrefixedVariableName: Lint/UnifiedInteger: Enabled: true -Lint/UnneededCopDisableDirective: +Lint/RedundantCopDisableDirective: Enabled: true -Lint/UnneededCopEnableDirective: +Lint/RedundantCopEnableDirective: Enabled: true -Lint/UnneededRequireStatement: +Lint/RedundantRequireStatement: Enabled: true -Lint/UnneededSplatExpansion: +Lint/RedundantSplatExpansion: Enabled: false Lint/UnreachableCode: @@ -519,7 +524,7 @@ Metrics/ClassLength: Metrics/CyclomaticComplexity: Enabled: false -Metrics/LineLength: +Layout/LineLength: Enabled: false Metrics/MethodLength: @@ -567,10 +572,10 @@ Naming/MethodName: Naming/PredicateName: Enabled: false -Naming/UncommunicativeBlockParamName: +Naming/BlockParameterName: Enabled: true -Naming/UncommunicativeMethodParamName: +Naming/MethodParameterName: Enabled: false Naming/VariableName: @@ -593,6 +598,8 @@ Performance/CompareWithBlock: Performance/Count: Enabled: true + Exclude: + - "app/services/administrateur_usage_statistics_service.rb" Performance/Detect: Enabled: true @@ -609,9 +616,6 @@ Performance/FixedSize: Performance/FlatMap: Enabled: true -Performance/LstripRstrip: - Enabled: true - Performance/RangeInclude: Enabled: true @@ -624,7 +628,7 @@ Performance/RedundantMatch: Performance/RedundantMerge: Enabled: true -Performance/RedundantSortBy: +Style/RedundantSortBy: Enabled: true Performance/RegexpMatch: @@ -633,7 +637,7 @@ Performance/RegexpMatch: Performance/ReverseEach: Enabled: true -Performance/Sample: +Style/Sample: Enabled: true Performance/Size: @@ -669,6 +673,12 @@ Rails/ApplicationJob: Rails/ApplicationRecord: Enabled: true +Rails/ApplicationController: + Enabled: false + +Rails/RakeEnvironment: + Enabled: false + Rails/Blank: Enabled: true @@ -707,7 +717,7 @@ Rails/Exit: Enabled: true Rails/FilePath: - Enabled: true + Enabled: false Rails/FindBy: Enabled: true @@ -754,6 +764,9 @@ Rails/Present: Rails/ReadWriteAttribute: Enabled: false +Rails/RedundantAllowNil: + Enabled: false + Rails/RedundantReceiverInWithOptions: Enabled: true @@ -766,9 +779,6 @@ Rails/RequestReferer: Rails/ReversibleMigration: Enabled: false -Rails/SafeNavigation: - Enabled: true - Rails/SaveBang: Enabled: false @@ -846,9 +856,6 @@ Style/BlockDelimiters: Exclude: - "spec/**/*" -Style/BracesAroundHashParameters: - Enabled: false - Style/CaseEquality: Enabled: true @@ -955,9 +962,6 @@ Style/EvenOdd: Style/ExpandPathArguments: Enabled: true -Style/FlipFlop: - Enabled: true - Style/For: Enabled: true @@ -965,7 +969,7 @@ Style/FormatString: Enabled: true Style/FormatStringToken: - Enabled: true + Enabled: false EnforcedStyle: template Style/FrozenStringLiteralComment: @@ -1267,13 +1271,13 @@ Style/TrivialAccessors: Style/UnlessElse: Enabled: true -Style/UnneededCapitalW: +Style/RedundantCapitalW: Enabled: true -Style/UnneededInterpolation: +Style/RedundantInterpolation: Enabled: true -Style/UnneededPercentQ: +Style/RedundantPercentQ: Enabled: true Style/VariableInterpolation: diff --git a/Gemfile b/Gemfile index 4493bec41..ada4d9e22 100644 --- a/Gemfile +++ b/Gemfile @@ -97,6 +97,7 @@ group :development do gem 'haml-lint' gem 'letter_opener_web' gem 'rubocop', require: false + gem 'rubocop-rails_config' gem 'rubocop-rspec-focused', require: false gem 'scss_lint', require: false gem 'web-console' diff --git a/Gemfile.lock b/Gemfile.lock index fd6bd9a2f..224b5f9a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -562,6 +562,16 @@ GEM rexml ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 1.7) + rubocop-performance (1.5.2) + rubocop (>= 0.71.0) + rubocop-rails (2.4.2) + rack (>= 1.1) + rubocop (>= 0.72.0) + rubocop-rails_config (0.10.0) + railties (>= 5.0) + rubocop (~> 0.80) + rubocop-performance (~> 1.3) + rubocop-rails (~> 2.0) rubocop-rspec-focused (1.0.0) rubocop (>= 0.51) ruby-debug-ide (0.6.1) @@ -781,6 +791,7 @@ DEPENDENCIES rspec-rails (~> 4.0.0.beta) rspec_junit_formatter rubocop + rubocop-rails_config rubocop-rspec-focused ruby-debug-ide sanitize-url diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index fea994a0a..9e3934c35 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -58,7 +58,6 @@ class StatsController < ApplicationController .includes(:procedure, :user) .in_batches .flat_map do |dossiers| - dossiers .pluck( "dossiers.id", diff --git a/app/models/dossier.rb b/app/models/dossier.rb index da98331c1..8e3734e5b 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -692,7 +692,6 @@ class Dossier < ApplicationRecord .includes(:procedure, :user) .group_by(&:user) .each do |(user, dossiers)| - dossier_hashes = dossiers.map(&:hash_for_deletion_mail) DossierMailer.notify_brouillon_deletion(user, dossier_hashes).deliver_later diff --git a/app/models/instructeur.rb b/app/models/instructeur.rb index 93289e0da..fdea0cc7b 100644 --- a/app/models/instructeur.rb +++ b/app/models/instructeur.rb @@ -148,7 +148,6 @@ class Instructeur < ApplicationRecord def email_notification_data groupe_instructeur_with_email_notifications .reduce([]) do |acc, groupe| - procedure = groupe.procedure h = { diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb index 32c4a6586..c42b22194 100644 --- a/spec/factories/procedure.rb +++ b/spec/factories/procedure.rb @@ -14,7 +14,7 @@ FactoryBot.define do path { SecureRandom.uuid } transient do - administrateur {} + administrateur { } instructeurs { [] } end