diff --git a/.ruby-version b/.ruby-version index 944880fa..49cdd668 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.2.0 +2.7.6 diff --git a/Dockerfile b/Dockerfile index 27e70b39..3c43e2d8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.2.0 +FROM ruby:2.7.6 WORKDIR /srv/app/datagovuk_find diff --git a/Gemfile b/Gemfile index 8996eeaa..eb9f54e2 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem "govuk_publishing_components" gem "htmlentities" gem "jbuilder" gem "jquery-rails" -gem "kaminari" +gem "kaminari", "< 1.2" # do not upgrade this unless elasticsearch is also upgraded gem "lograge" gem "logstash-event" gem "mime-types" diff --git a/Gemfile.lock b/Gemfile.lock index 592a0656..3aea88c0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,7 +67,7 @@ GEM debug_inspector (>= 0.0.1) bootsnap (1.10.3) msgpack (~> 1.2) - brakeman (5.4.1) + brakeman (5.2.1) browser (5.3.1) builder (3.2.4) byebug (11.1.3) @@ -86,7 +86,6 @@ GEM crack (0.4.5) rexml crass (1.0.6) - date (3.3.3) debug_inspector (1.1.0) diff-lcs (1.5.0) docile (1.4.0) @@ -137,33 +136,30 @@ GEM ffi (1.15.5) globalid (1.0.0) activesupport (>= 5.0) - govuk_app_config (5.1.0) - logstasher (~> 2.1) - plek (>= 4, < 6) - prometheus_exporter (~> 2.0) - puma (>= 5.6, < 7.0) - rack-proxy (~> 0.7) - sentry-rails (~> 5.3) - sentry-ruby (~> 5.3) - statsd-ruby (~> 1.5) - unicorn (~> 6.1) + govuk_app_config (4.3.0) + logstasher (>= 1.2.2, < 2.2.0) + puma (~> 5.0) + sentry-rails (~> 4.5.0) + sentry-ruby (~> 4.5.0) + statsd-ruby (~> 1.5.0) + unicorn (>= 5.4, < 5.9) govuk_elements_rails (3.1.3) govuk_frontend_toolkit (>= 6.0.2) rails (>= 4.1.0) sass (>= 3.2.0) govuk_frontend_toolkit (9.0.1) railties (>= 3.1.0) - govuk_personalisation (0.13.0) + govuk_personalisation (0.11.2) plek (>= 1.9.0) rails (>= 6, < 8) - govuk_publishing_components (35.0.0) + govuk_publishing_components (28.6.0) govuk_app_config govuk_personalisation (>= 0.7.0) kramdown plek - rails (>= 6) + rails (~> 6) rouge - sprockets (>= 3) + sprockets (< 4) govuk_test (2.3.0) brakeman (>= 5.0.2) capybara @@ -187,20 +183,20 @@ GEM railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (2.6.2) - kaminari (1.2.2) + kaminari (1.1.1) activesupport (>= 4.1.0) - kaminari-actionview (= 1.2.2) - kaminari-activerecord (= 1.2.2) - kaminari-core (= 1.2.2) - kaminari-actionview (1.2.2) + kaminari-actionview (= 1.1.1) + kaminari-activerecord (= 1.1.1) + kaminari-core (= 1.1.1) + kaminari-actionview (1.1.1) actionview - kaminari-core (= 1.2.2) - kaminari-activerecord (1.2.2) + kaminari-core (= 1.1.1) + kaminari-activerecord (1.1.1) activerecord - kaminari-core (= 1.2.2) - kaminari-core (1.2.2) + kaminari-core (= 1.1.1) + kaminari-core (1.1.1) kgio (2.11.4) - kramdown (2.4.0) + kramdown (2.3.1) rexml listen (3.7.1) rb-fsevent (~> 0.10, >= 0.10.3) @@ -217,11 +213,8 @@ GEM loofah (2.18.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.8.1) + mail (2.7.1) mini_mime (>= 0.1.1) - net-imap - net-pop - net-smtp marcel (1.0.2) matrix (0.4.2) method_source (1.0.0) @@ -234,18 +227,9 @@ GEM msgpack (1.4.5) multi_json (1.15.0) multipart-post (2.1.1) - net-imap (0.3.4) - date - net-protocol - net-pop (0.1.2) - net-protocol - net-protocol (0.2.1) - timeout - net-smtp (0.3.3) - net-protocol netrc (0.11.0) nio4r (2.5.8) - nokogiri (1.14.2) + nokogiri (1.13.3) mini_portile2 (~> 2.8.0) racc (~> 1.4) parallel (1.22.1) @@ -253,9 +237,7 @@ GEM ast (~> 2.4.1) parslet (2.0.0) pg (1.3.2) - plek (5.0.0) - prometheus_exporter (2.0.8) - webrick + plek (4.0.0) pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) @@ -270,8 +252,6 @@ GEM nio4r (~> 2.0) racc (1.6.0) rack (2.2.4) - rack-proxy (0.7.6) - rack rack-test (2.0.2) rack (>= 1.3) rails (6.1.6.1) @@ -301,7 +281,7 @@ GEM rake (>= 12.2) thor (~> 1.0) rainbow (3.1.1) - raindrops (0.20.1) + raindrops (0.20.0) rake (13.0.6) rb-fsevent (0.11.1) rb-inotify (0.10.1) @@ -316,7 +296,7 @@ GEM mime-types (>= 1.16, < 4.0) netrc (~> 0.8) rexml (3.2.5) - rouge (4.1.0) + rouge (3.28.0) rspec (3.11.0) rspec-core (~> 3.11.0) rspec-expectations (~> 3.11.0) @@ -387,13 +367,18 @@ GEM childprocess (>= 0.5, < 5.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2) - sentry-rails (5.8.0) + sentry-rails (4.5.2) railties (>= 5.0) - sentry-ruby (~> 5.8.0) + sentry-ruby-core (~> 4.5.0) sentry-raven (3.1.2) faraday (>= 1.0) - sentry-ruby (5.8.0) + sentry-ruby (4.5.2) concurrent-ruby (~> 1.0, >= 1.0.2) + faraday (>= 1.0) + sentry-ruby-core (= 4.5.2) + sentry-ruby-core (4.5.2) + concurrent-ruby + faraday simplecov (0.17.1) docile (~> 1.1) json (>= 1.8, < 3) @@ -415,7 +400,6 @@ GEM statsd-ruby (1.5.0) thor (1.2.1) tilt (2.0.10) - timeout (0.3.2) tzinfo (2.0.5) concurrent-ruby (~> 1.0) uglifier (4.2.0) @@ -424,7 +408,7 @@ GEM unf_ext unf_ext (0.0.8) unicode-display_width (2.2.0) - unicorn (6.1.0) + unicorn (5.8.0) kgio (~> 2.6) raindrops (~> 0.7) webdrivers (5.0.0) @@ -435,7 +419,6 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -471,7 +454,7 @@ DEPENDENCIES htmlentities jbuilder jquery-rails - kaminari + kaminari (< 1.2) lograge logstash-event mime-types @@ -500,7 +483,7 @@ DEPENDENCIES zendesk_api RUBY VERSION - ruby 3.2.0p0 + ruby 2.7.6p219 BUNDLED WITH 2.1.4 diff --git a/app/controllers/legacy/search_controller.rb b/app/controllers/legacy/search_controller.rb index bbb325ea..84b77853 100644 --- a/app/controllers/legacy/search_controller.rb +++ b/app/controllers/legacy/search_controller.rb @@ -6,7 +6,7 @@ def redirect licence: licence_param, }.compact - redirect_to search_path(q: params["q"], filters:) + redirect_to search_path(q: params["q"], filters: filters) end private diff --git a/app/models/datafile.rb b/app/models/datafile.rb index 968ebafd..1ddf2b19 100644 --- a/app/models/datafile.rb +++ b/app/models/datafile.rb @@ -46,6 +46,6 @@ def wfs? end def preview - @preview ||= Preview.new(url:, format:) + @preview ||= Preview.new(url: url, format: format) end end diff --git a/app/services/search/query.rb b/app/services/search/query.rb index b1a6cee4..d30376af 100644 --- a/app/services/search/query.rb +++ b/app/services/search/query.rb @@ -185,7 +185,7 @@ def self.by_legacy_name(legacy_name) query: { constant_score: { filter: { - term: { legacy_name: }, + term: { legacy_name: legacy_name }, }, }, }, @@ -197,7 +197,7 @@ def self.by_uuid(uuid) query: { constant_score: { filter: { - term: { uuid: }, + term: { uuid: uuid }, }, }, }, @@ -285,7 +285,7 @@ def self.organisation_category_filter(organisation_category, boost: 2) term: { "organisation.category.keyword" => { value: organisation_category, - boost:, + boost: boost, }, }, }, @@ -302,7 +302,7 @@ def self.organisation_title_filter(organisation_title, boost: 2) "organisation.title.english" => { query: organisation_title, analyzer: "english", - boost:, + boost: boost, }, }, }, diff --git a/config/brakeman.ignore b/config/brakeman.ignore new file mode 100644 index 00000000..ac810562 --- /dev/null +++ b/config/brakeman.ignore @@ -0,0 +1,22 @@ +{ + "ignored_warnings": [ + { + "warning_type": "Unmaintained Dependency", + "warning_code": 123, + "fingerprint": "870fa4a5cfd770898e1b7a159368b4210fe366634512563f9fb1c1cbbfef1d78", + "check_name": "EOLRuby", + "message": "Support for Ruby 2.7.6 ends on 2023-03-31", + "file": "Gemfile.lock", + "line": 257, + "link": "https://brakemanscanner.org/docs/warning_types/unmaintained_dependency/", + "code": null, + "render_path": null, + "location": null, + "user_input": null, + "confidence": "Medium", + "note": "CI won't pass with this warning enabled, preventing us from deploying" + } + ], + "updated": "2023-03-21 15:53:39 +0000", + "brakeman_version": "5.2.1" +} diff --git a/config/initializers/elasticsearch.rb b/config/initializers/elasticsearch.rb index ba59c7c5..1a2e71b7 100644 --- a/config/initializers/elasticsearch.rb +++ b/config/initializers/elasticsearch.rb @@ -10,7 +10,7 @@ raise StandardError, "No opensearch environment variables found" if host.blank? Elasticsearch::Model.client = Elasticsearch::Client.new( - host:, + host: host, transport_options: { request: { timeout: es_config.fetch(:elastic_timeout), diff --git a/spec/services/search/phrase_clause_spec.rb b/spec/services/search/phrase_clause_spec.rb index 4ead4e6a..e65d738e 100644 --- a/spec/services/search/phrase_clause_spec.rb +++ b/spec/services/search/phrase_clause_spec.rb @@ -5,5 +5,5 @@ let(:phrase) { double } - it { is_expected.to have_attributes(phrase:) } + it { is_expected.to have_attributes(phrase: phrase) } end diff --git a/spec/services/search/terms_clause_spec.rb b/spec/services/search/terms_clause_spec.rb index ae8604b2..72e9cee7 100644 --- a/spec/services/search/terms_clause_spec.rb +++ b/spec/services/search/terms_clause_spec.rb @@ -5,5 +5,5 @@ let(:terms) { double } - it { is_expected.to have_attributes(terms:) } + it { is_expected.to have_attributes(terms: terms) } end