Skip to content

Commit b6ec188

Browse files
committed
style: auto-correct config files rubocop offenses
- Add frozen_string_literal comments - Fix string literal quotes (prefer single quotes) - Correct indentation and spacing - Add empty lines after magic comments
1 parent 049562b commit b6ec188

13 files changed

Lines changed: 399 additions & 387 deletions

File tree

Rakefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Add your own tasks in files placed in lib/tasks ending in .rake,
2-
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3-
4-
require_relative "config/application"
5-
6-
Rails.application.load_tasks
1+
# frozen_string_literal: true
2+
3+
# Add your own tasks in files placed in lib/tasks ending in .rake,
4+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
5+
6+
require_relative 'config/application'
7+
8+
Rails.application.load_tasks

config/application.rb

Lines changed: 83 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,83 @@
1-
require_relative "boot"
2-
3-
require "rails"
4-
# Pick the frameworks you want:
5-
require "active_model/railtie"
6-
require "active_job/railtie"
7-
require "active_record/railtie"
8-
require "active_storage/engine"
9-
require "action_controller/railtie"
10-
require "action_mailer/railtie"
11-
require "action_mailbox/engine"
12-
require "action_text/engine"
13-
require "action_view/railtie"
14-
require "action_cable/engine"
15-
# require "rails/test_unit/railtie"
16-
17-
# Require the gems listed in Gemfile, including any gems
18-
# you've limited to :test, :development, or :production.
19-
Bundler.require(*Rails.groups)
20-
21-
module ProstaffApi
22-
class Application < Rails::Application
23-
# Initialize configuration defaults for originally generated Rails version.
24-
config.load_defaults 7.1
25-
26-
# Please, add to the `ignore` list any other `lib` subdirectories that do
27-
# not contain `.rb` files, or that should not be reloaded or eager loaded.
28-
# Common ones are `templates`, `generators`, or `middleware`.
29-
config.autoload_lib(ignore: %w(assets tasks))
30-
31-
# Configuration for the application, engines, and railties goes here.
32-
#
33-
# These settings can be overridden in specific environments using the files
34-
# in config/environments/, which are processed later.
35-
#
36-
# config.time_zone = "Central Time (US & Canada)"
37-
# config.eager_load_paths << Rails.root.join("extras")
38-
39-
# Only loads a smaller set of middleware suitable for API only apps.
40-
# Middleware like session, flash, cookies can be added back manually.
41-
# Skip views, helpers and assets when generating a new resource.
42-
config.api_only = true
43-
44-
# Load modules directory
45-
config.autoload_paths += %W(#{config.root}/app/modules)
46-
config.eager_load_paths += %W(#{config.root}/app/modules)
47-
48-
# CORS configuration
49-
config.middleware.insert_before 0, Rack::Cors do
50-
allow do
51-
origins ENV.fetch('CORS_ORIGINS', 'http://localhost:5173').split(',')
52-
53-
resource '*',
54-
headers: :any,
55-
methods: [:get, :post, :put, :patch, :delete, :options, :head],
56-
credentials: true,
57-
max_age: 86400
58-
end
59-
end
60-
61-
# Rack Attack for rate limiting
62-
config.middleware.use Rack::Attack
63-
64-
# Time zone
65-
config.time_zone = 'UTC'
66-
67-
# Generator configuration
68-
config.generators do |g|
69-
g.test_framework :rspec
70-
g.factory_bot_dir 'spec/factories'
71-
g.skip_routes true
72-
g.helper false
73-
g.assets false
74-
g.view_specs false
75-
g.helper_specs false
76-
g.routing_specs false
77-
g.controller_specs false
78-
g.request_specs true
79-
end
80-
end
81-
end
1+
# frozen_string_literal: true
2+
3+
require_relative 'boot'
4+
5+
require 'rails'
6+
# Pick the frameworks you want:
7+
require 'active_model/railtie'
8+
require 'active_job/railtie'
9+
require 'active_record/railtie'
10+
require 'active_storage/engine'
11+
require 'action_controller/railtie'
12+
require 'action_mailer/railtie'
13+
require 'action_mailbox/engine'
14+
require 'action_text/engine'
15+
require 'action_view/railtie'
16+
require 'action_cable/engine'
17+
# require "rails/test_unit/railtie"
18+
19+
# Require the gems listed in Gemfile, including any gems
20+
# you've limited to :test, :development, or :production.
21+
Bundler.require(*Rails.groups)
22+
23+
module ProstaffApi
24+
class Application < Rails::Application
25+
# Initialize configuration defaults for originally generated Rails version.
26+
config.load_defaults 7.1
27+
28+
# Please, add to the `ignore` list any other `lib` subdirectories that do
29+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
30+
# Common ones are `templates`, `generators`, or `middleware`.
31+
config.autoload_lib(ignore: %w[assets tasks])
32+
33+
# Configuration for the application, engines, and railties goes here.
34+
#
35+
# These settings can be overridden in specific environments using the files
36+
# in config/environments/, which are processed later.
37+
#
38+
# config.time_zone = "Central Time (US & Canada)"
39+
# config.eager_load_paths << Rails.root.join("extras")
40+
41+
# Only loads a smaller set of middleware suitable for API only apps.
42+
# Middleware like session, flash, cookies can be added back manually.
43+
# Skip views, helpers and assets when generating a new resource.
44+
config.api_only = true
45+
46+
# Load modules directory
47+
config.autoload_paths += %W[#{config.root}/app/modules]
48+
config.eager_load_paths += %W[#{config.root}/app/modules]
49+
50+
# CORS configuration
51+
config.middleware.insert_before 0, Rack::Cors do
52+
allow do
53+
origins ENV.fetch('CORS_ORIGINS', 'http://localhost:5173').split(',')
54+
55+
resource '*',
56+
headers: :any,
57+
methods: %i[get post put patch delete options head],
58+
credentials: true,
59+
max_age: 86_400
60+
end
61+
end
62+
63+
# Rack Attack for rate limiting
64+
config.middleware.use Rack::Attack
65+
66+
# Time zone
67+
config.time_zone = 'UTC'
68+
69+
# Generator configuration
70+
config.generators do |g|
71+
g.test_framework :rspec
72+
g.factory_bot_dir 'spec/factories'
73+
g.skip_routes true
74+
g.helper false
75+
g.assets false
76+
g.view_specs false
77+
g.helper_specs false
78+
g.routing_specs false
79+
g.controller_specs false
80+
g.request_specs true
81+
end
82+
end
83+
end

config/boot.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2-
3-
require "bundler/setup" # Set up gems listed in the Gemfile.
4-
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
1+
# frozen_string_literal: true
2+
3+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
4+
5+
require 'bundler/setup' # Set up gems listed in the Gemfile.
6+
require 'bootsnap/setup' # Speed up boot time by caching expensive operations.

config/environment.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
require_relative "application"
2-
3-
Rails.application.initialize!
1+
# frozen_string_literal: true
2+
3+
require_relative 'application'
4+
5+
Rails.application.initialize!

config/environments/development.rb

Lines changed: 61 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,61 @@
1-
require "active_support/core_ext/integer/time"
2-
3-
Rails.application.configure do
4-
# Settings specified here will take precedence over those in config/application.rb.
5-
6-
# In the development environment your application's code is reloaded any time
7-
# it changes. This slows down response time but is perfect for development
8-
# since you don't have to restart the web server when you make code changes.
9-
config.cache_classes = false
10-
11-
config.eager_load = false
12-
13-
config.consider_all_requests_local = true
14-
15-
config.server_timing = true
16-
17-
if Rails.root.join("tmp/caching-dev.txt").exist?
18-
config.cache_store = :memory_store
19-
config.public_file_server.headers = {
20-
"Cache-Control" => "public, max-age=#{2.days.to_i}"
21-
}
22-
else
23-
config.action_controller.perform_caching = false
24-
25-
config.cache_store = :null_store
26-
end
27-
28-
config.active_storage.variant_processor = :mini_magick
29-
30-
config.action_mailer.raise_delivery_errors = false
31-
32-
config.action_mailer.perform_caching = false
33-
34-
config.active_support.deprecation = :log
35-
36-
config.active_support.disallowed_deprecation = :raise
37-
38-
config.active_support.disallowed_deprecation_warnings = []
39-
40-
config.active_record.migration_error = :page_load
41-
42-
config.active_record.verbose_query_logs = true
43-
44-
config.assets.quiet = true if defined?(config.assets)
45-
46-
config.assets.debug = true if defined?(config.assets)
47-
48-
config.assets.quiet = true if defined?(config.assets)
49-
50-
# Bullet for N+1 query detection
51-
# Uncomment if using Bullet gem
52-
# config.after_initialize do
53-
# Bullet.enable = true
54-
# Bullet.alert = true
55-
# Bullet.bullet_logger = true
56-
# Bullet.console = true
57-
# Bullet.rails_logger = true
58-
# end
59-
end
1+
# frozen_string_literal: true
2+
3+
require 'active_support/core_ext/integer/time'
4+
5+
Rails.application.configure do
6+
# Settings specified here will take precedence over those in config/application.rb.
7+
8+
# In the development environment your application's code is reloaded any time
9+
# it changes. This slows down response time but is perfect for development
10+
# since you don't have to restart the web server when you make code changes.
11+
config.cache_classes = false
12+
13+
config.eager_load = false
14+
15+
config.consider_all_requests_local = true
16+
17+
config.server_timing = true
18+
19+
if Rails.root.join('tmp/caching-dev.txt').exist?
20+
config.cache_store = :memory_store
21+
config.public_file_server.headers = {
22+
'Cache-Control' => "public, max-age=#{2.days.to_i}"
23+
}
24+
else
25+
config.action_controller.perform_caching = false
26+
27+
config.cache_store = :null_store
28+
end
29+
30+
config.active_storage.variant_processor = :mini_magick
31+
32+
config.action_mailer.raise_delivery_errors = false
33+
34+
config.action_mailer.perform_caching = false
35+
36+
config.active_support.deprecation = :log
37+
38+
config.active_support.disallowed_deprecation = :raise
39+
40+
config.active_support.disallowed_deprecation_warnings = []
41+
42+
config.active_record.migration_error = :page_load
43+
44+
config.active_record.verbose_query_logs = true
45+
46+
config.assets.quiet = true if defined?(config.assets)
47+
48+
config.assets.debug = true if defined?(config.assets)
49+
50+
config.assets.quiet = true if defined?(config.assets)
51+
52+
# Bullet for N+1 query detection
53+
# Uncomment if using Bullet gem
54+
# config.after_initialize do
55+
# Bullet.enable = true
56+
# Bullet.alert = true
57+
# Bullet.bullet_logger = true
58+
# Bullet.console = true
59+
# Bullet.rails_logger = true
60+
# end
61+
end

0 commit comments

Comments
 (0)