Skip to content

Commit

Permalink
rubocopped the config files
Browse files Browse the repository at this point in the history
  • Loading branch information
briri committed Jul 10, 2020
1 parent ed4c019 commit 3a1bcab
Show file tree
Hide file tree
Showing 38 changed files with 636 additions and 588 deletions.
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AllCops:
- 'lib/tasks/**/*'
- 'Gemfile'
- 'db/**/*'
- 'config/**/*'
# - 'config/**/*'
- 'script/**/*'
- '**/Rakefile'
- '**/config.ru'
Expand Down Expand Up @@ -83,7 +83,7 @@ Metrics/ClassLength:
# Bumping the default AbcSize so we don't need to refactor everything
Metrics/AbcSize:
Max: 25

# Bumping the default CyclomaticComplexity so we don't need to refactor everything
Metrics/CyclomaticComplexity:
Max: 25
Expand Down
15 changes: 10 additions & 5 deletions config/application.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
require_relative 'boot'
# frozen_string_literal: true

require 'rails/all'
require_relative "boot"

require 'csv'
require "rails/all"

require "csv"

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module DMPRoadmap

class Application < Rails::Application

# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 5.2

Expand All @@ -22,7 +26,7 @@ class Application < Rails::Application
# OVERRIDES TO DEFAULT RAILS CONFIG #
# --------------------------------- #

config.autoload_paths += %W(#{config.root}/lib)
config.autoload_paths += %W[#{config.root}/lib]

# HTML tags that are allowed to pass through `sanitize`.
config.action_view.sanitized_allowed_tags = %w[
Expand All @@ -42,7 +46,8 @@ class Application < Rails::Application
config.action_controller.include_all_helpers = true

# Set the default host for mailer URLs
config.action_mailer.default_url_options = { :host => "#{Socket.gethostname}" }
config.action_mailer.default_url_options = { host: Socket.gethostname.to_s }

end

end
8 changes: 5 additions & 3 deletions config/boot.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
# frozen_string_literal: true

require 'bundler/setup' # Set up gems listed in the Gemfile.
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)

require "bundler/setup" # Set up gems listed in the Gemfile.
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
4 changes: 3 additions & 1 deletion config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

# Load the Rails application.
require_relative 'application'
require_relative "application"

# Initialize the Rails application.
Rails.application.initialize!
6 changes: 4 additions & 2 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand All @@ -14,12 +16,12 @@

# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if Rails.root.join('tmp', 'caching-dev.txt').exist?
if Rails.root.join("tmp", "caching-dev.txt").exist?
config.action_controller.perform_caching = true

config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}"
"Cache-Control" => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
Expand Down
9 changes: 6 additions & 3 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand All @@ -20,7 +22,7 @@

# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?

# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
Expand All @@ -29,7 +31,8 @@
# Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false

# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# `config.assets.precompile` and `config.assets.version` have moved to
# config/initializers/assets.rb

# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
Expand All @@ -54,7 +57,7 @@
config.log_level = :debug

# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
config.log_tags = [:request_id]

# Use a different cache store in production.
# config.cache_store = :mem_cache_store
Expand Down
4 changes: 3 additions & 1 deletion config/environments/test.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.

Expand All @@ -15,7 +17,7 @@
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{1.hour.to_i}"
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
}

# Disable fragment caching used in ExternalApis and OrgSelection services
Expand Down
10 changes: 6 additions & 4 deletions config/initializers/_dmproadmap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#
# This file's name begins with an underscore so that it is processed first and its
# values are available to all other initializers within this directory!
# rubocop:disable Layout/LineLength
module DMPRoadmap

class Application < Rails::Application
Expand All @@ -33,7 +34,7 @@ class Application < Rails::Application
# This email is used as the 'from' address for emails generated by the application
config.x.organisation.email = "[email protected]"
# This email is used as the 'from' address for the feedback_complete email to users
config.x.organisation.do_not_reply_email 'do-not-reply@cc_curation_centre.org'
config.x.organisation.do_not_reply_email "do-not-reply@cc_curation_centre.org"
# This email is used in email communications
config.x.organisation.helpdesk_email = "[email protected]"
# Your organisation's telephone number - used on the contact us page
Expand Down Expand Up @@ -181,14 +182,14 @@ class Application < Rails::Application
# ---------------------------------------------------- #

# Determines how long to cache results for OrgSelection::SearchService
config.x.cache.org_selection_expiration = 86400
config.x.cache.org_selection_expiration = 86_400
# Determines how long to cache results for the ResearchProjectsController
config.x.cache.research_projects_expiration = 86400
config.x.cache.research_projects_expiration = 86_400

# ---------------- #
# Google Analytics #
# ---------------- #
config.x.tracker_root = '[need to pull this from the credentials.yml]'
config.x.tracker_root = "[need to pull this from the credentials.yml]"

# ------------------------------------------------------------------------ #
# reCAPTCHA - recaptcha appears on the create account and contact us forms #
Expand All @@ -198,3 +199,4 @@ class Application < Rails::Application
end

end
# rubocop:enable Layout/LineLength
8 changes: 5 additions & 3 deletions config/initializers/api_pagination.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# frozen_string_literal: true

ApiPagination.configure do |config|
# If you have more than one gem included, you can choose a paginator.
config.paginator = :kaminari # or :will_paginate

# By default, this is set to 'Total'
config.total_header = 'X-Total'
config.total_header = "X-Total"

# By default, this is set to 'Per-Page'
config.per_page_header = 'X-Per-Page'
config.per_page_header = "X-Per-Page"

# Optional: set this to add a header with the current page number.
config.page_header = 'X-Page'
config.page_header = "X-Page"

# Optional: set this to add other response format. Useful with tools that define :jsonapi format
config.response_formats = [:json]
Expand Down
1 change: 1 addition & 0 deletions config/initializers/application_controller_renderer.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.

# ActiveSupport::Reloader.to_prepare do
Expand Down
6 changes: 4 additions & 2 deletions config/initializers/assets.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.version = "1.0"

# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
Rails.application.config.assets.paths << Rails.root.join('node_modules')
Rails.application.config.assets.paths << Rails.root.join("node_modules")

# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
Expand Down
7 changes: 5 additions & 2 deletions config/initializers/backtrace_silencers.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# frozen_string_literal: true
# Be sure to restart your server when you modify this file.

# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# You can add backtrace silencers for libraries that you're using but don't
# wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }

# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# You can also remove all the silencers if you're trying to debug a problem
# that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
46 changes: 26 additions & 20 deletions config/initializers/bullet.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
Bullet.tap do |config|
config.enable = true
# config.alert = true
config.bullet_logger = true
config.console = true
# config.growl = true
# config.xmpp = { :account => '[email protected]',
# :password => 'bullets_password_for_jabber',
# :receiver => '[email protected]',
# :show_online_status => true }
config.rails_logger = true
# config.honeybadger = true
# config.bugsnag = true
# config.airbrake = true
# config.rollbar = true
config.add_footer = true
# config.stacktrace_includes = [ 'your_gem', 'your_middleware' ]
# config.stacktrace_excludes = [ 'their_gem', 'their_middleware' ]
# config.slack = { webhook_url: 'http://some.slack.url', channel: '#default', username: 'notifier' }
end if defined?(Bullet)
# frozen_string_literal: true

if defined?(Bullet)
Bullet.tap do |config|
config.enable = true
# config.alert = true
config.bullet_logger = true
config.console = true
# config.growl = true
# config.xmpp = { :account => '[email protected]',
# :password => 'bullets_password_for_jabber',
# :receiver => '[email protected]',
# :show_online_status => true }
config.rails_logger = true
# config.honeybadger = true
# config.bugsnag = true
# config.airbrake = true
# config.rollbar = true
config.add_footer = true
# config.stacktrace_includes = [ 'your_gem', 'your_middleware' ]
# config.stacktrace_excludes = [ 'their_gem', 'their_middleware' ]
# config.slack = {
# webhook_url: 'http://some.slack.url', channel: '#default', username: 'notifier'
# }
end
end
10 changes: 6 additions & 4 deletions config/initializers/contact_us.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# frozen_string_literal: true

# Use this hook to configure contact mailer.
ContactUs.setup do |config|

# ==> Mailer Configuration

# Configure the e-mail address which email notifications should be sent from. If emails must be sent from a verified email address you may set it here.
# Configure the e-mail address which email notifications should be sent from.
# If emails must be sent from a verified email address you may set it here.
# Example:
# config.mailer_from = "[email protected]"
config.mailer_from = nil
Expand All @@ -23,8 +25,8 @@
# Example:
# config.form_gem = 'formtastic
# config.form_gem = 'formtastic'

# Set the following variable to true if you are using localized paths
# e.g. /en/contact-us OR /fr/contact-us
config.localize_routes = true
end
end
3 changes: 2 additions & 1 deletion config/initializers/contact_us.rb.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ ContactUs.setup do |config|

# ==> Mailer Configuration

# Configure the e-mail address which email notifications should be sent from. If emails must be sent from a verified email address you may set it here.
# Configure the e-mail address which email notifications should be sent from.
# If emails must be sent from a verified email address you may set it here.
# Example:
# config.mailer_from = "[email protected]"
config.mailer_from = nil
Expand Down
10 changes: 8 additions & 2 deletions config/initializers/content_security_policy.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Define an application-wide content security policy
Expand All @@ -17,7 +19,9 @@
# end

# If you are using UJS then enable automatic nonce generation
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
# Rails.application.config.content_security_policy_nonce_generator = -> request {
# SecureRandom.base64(16)
# }

# Report CSP violations to a specified URI
# For further information see the following documentation:
Expand All @@ -26,5 +30,7 @@

# This allows Webpacker dev server to work
Rails.application.config.content_security_policy do |policy|
policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development?
if Rails.env.development?
policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035"
end
end
2 changes: 2 additions & 0 deletions config/initializers/cookies_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# Be sure to restart your server when you modify this file.

# Specify a serializer for the signed and encrypted cookie jars.
Expand Down
Loading

0 comments on commit 3a1bcab

Please sign in to comment.