Skip to content

Commit

Permalink
Rubocoped config files
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminfaure committed Jun 10, 2022
1 parent 2273b60 commit d448bdb
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 20 deletions.
5 changes: 0 additions & 5 deletions app/controllers/orgs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ def admin_update
# Remove the extraneous Org Selector hidden fields
attrs = remove_org_selection_params(params_in: attrs)

pp attrs
junk_org = Org.new(attrs)
p junk_org.valid?
p junk_org.errors.full_messages

if @org.update(attrs)
# Save any identifiers that were found
if current_user.can_super_admin? && lookup.present?
Expand Down
2 changes: 1 addition & 1 deletion config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
# This file is used by Rack-based servers to start the application.
require File.expand_path("#{File.dirname(__FILE__)}/config/environment")

map ENV['RAILS_RELATIVE_URL_ROOT'] || '/' do
map ENV.fetch('RAILS_RELATIVE_URL_ROOT', '/') do
run DMPRoadmap::Application
end
6 changes: 4 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# frozen_string_literal: true
require 'active_support/core_ext/integer/time'

require 'active_support/core_ext/integer/time'

# rubocop:disable Metrics/BlockLength
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand Down Expand Up @@ -92,6 +93,7 @@
# set this environment variable
config.hosts << ENV['DMPROADMAP_HOST'] if ENV['DMPROADMAP_HOST'].present?
end
# rubocop:enable Metrics/BlockLength

# Used by Rails' routes url_helpers (typically when including a link in an email)
Rails.application.routes.default_url_options[:host] = ENV['DMPROADMAP_HOST'] || 'localhost:3000'
Rails.application.routes.default_url_options[:host] = ENV.fetch('DMPROADMAP_HOST', 'localhost:3000')
5 changes: 3 additions & 2 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'active_support/core_ext/integer/time'

Rails.application.configure do
Expand Down Expand Up @@ -93,7 +94,7 @@
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')

if ENV['RAILS_LOG_TO_STDOUT'].present?
logger = ActiveSupport::Logger.new(STDOUT)
logger = ActiveSupport::Logger.new($stdout)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
Expand Down Expand Up @@ -131,4 +132,4 @@
config.hosts << ENV['DMPROADMAP_HOST'] if ENV['DMPROADMAP_HOST'].present?
end
# Used by Rails' routes url_helpers (typically when including a link in an email)
Rails.application.routes.default_url_options[:host] = ENV['DMPROADMAP_HOST'] || 'example.org'
Rails.application.routes.default_url_options[:host] = ENV.fetch('DMPROADMAP_HOST', 'example.org')
1 change: 1 addition & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# frozen_string_literal: true

require 'active_support/core_ext/integer/time'

Rails.application.configure do
Expand Down
8 changes: 4 additions & 4 deletions config/initializers/dragonfly.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
if ENV['DRAGONFLY_AWS'] == 'true'
require 'dragonfly/s3_data_store'
datastore(:s3, {
bucket_name: ENV['AWS_BUCKET_NAME'],
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
region: ENV['AWS_REGION'],
bucket_name: ENV.fetch('AWS_BUCKET_NAME'),
access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
region: ENV.fetch('AWS_REGION'),
root_path: Rails.env,
url_scheme: 'https'
})
Expand Down
1 change: 1 addition & 0 deletions config/initializers/new_framework_defaults_6_1.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.1 upgrade.
Expand Down
1 change: 1 addition & 0 deletions config/initializers/permissions_policy.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/rollbar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Without configuration, Rollbar is enabled in all environments.
# To disable in specific environments, set config.enabled=false.

config.access_token = ENV['ROLLBAR_ACCESS_TOKEN']
config.access_token = ENV.fetch('ROLLBAR_ACCESS_TOKEN', nil)

# Here we'll disable in 'test':
config.enabled = false if Rails.env.test?
Expand Down
7 changes: 3 additions & 4 deletions config/initializers/translation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
SUPPORTED_LOCALES = %w[de en-CA en-GB en-US es fi fr-CA fr-FR pt-BR sv-FI tr-TR].freeze
# You can define a subset of the locales for your instance's version of Translation.io if applicable
CLIENT_LOCALES = %w[de en-CA en-GB en-US es fi fr-CA fr-FR pt-BR sv-FI tr-TR].freeze
DEFAULT_LOCALE = 'en-GB'.freeze

DEFAULT_LOCALE = 'en-GB'
# Here we define the translation domains for the Roadmap application, `app` will
# contain translations from the open-source repository and ignore the contents
# of the `app/views/branded` directory. The `client` domain will
Expand All @@ -22,7 +21,7 @@
# domain specified in order to generate both sets of translation keys.
if !ENV['DOMAIN'] || ENV['DOMAIN'] == 'app'
TranslationIO.configure do |config|
config.api_key = ENV['TRANSLATION_API_ROADMAP']
config.api_key = ENV.fetch('TRANSLATION_API_ROADMAP', nil)
config.source_locale = 'en'
config.target_locales = SUPPORTED_LOCALES
config.text_domain = 'app'
Expand All @@ -32,7 +31,7 @@
end
elsif ENV['DOMAIN'] == 'client'
TranslationIO.configure do |config|
config.api_key = ENV['TRANSLATION_API_CLIENT']
config.api_key = ENV.fetch('TRANSLATION_API_CLIENT', nil)
config.source_locale = 'en'
config.target_locales = CLIENT_LOCALES
config.text_domain = 'client'
Expand Down
2 changes: 1 addition & 1 deletion spec/support/helpers/autocomplete_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def select_an_org(autocomplete_id, org)

def choose_suggestion(suggestion_text)
matcher = '.ui-autocomplete .ui-menu-item'
matching_element = all(:css, matcher).detect do |element|
matching_element = find(:css, matcher).detect do |element|
element.text.strip == suggestion_text.strip
end
raise ArgumentError, "No such suggestion with text '#{suggestion_text}'" unless matching_element.present?
Expand Down

0 comments on commit d448bdb

Please sign in to comment.