From 52a5453e4c41e7c7dddc600d506b144a0c2e963a Mon Sep 17 00:00:00 2001 From: Joel Moss Date: Mon, 15 Apr 2024 12:11:47 +0100 Subject: [PATCH] chore(release): 0.15.0.beta.5 + rubocop fixes --- Gemfile.lock | 2 +- .../app/controllers/bare_pages_controller.rb | 2 +- .../application_controller_renderer.rb | 1 + fixtures/dummy/config/initializers/assets.rb | 1 + .../initializers/content_security_policy.rb | 1 + .../dummy/config/initializers/mime_types.rb | 1 + .../config/initializers/permissions_policy.rb | 1 + lib/proscenium/builder.rb | 2 +- .../ui/breadcrumbs/computed_element.rb | 2 +- lib/proscenium/version.rb | 2 +- playground/app/models/application_record.rb | 2 ++ playground/bin/rails | 8 +++++--- playground/bin/rake | 6 ++++-- playground/bin/setup | 18 +++++++++-------- playground/config.ru | 4 +++- playground/config/boot.rb | 4 ++-- playground/config/environment.rb | 4 +++- playground/config/environments/development.rb | 2 ++ playground/config/environments/production.rb | 16 ++++++++------- playground/config/environments/test.rb | 8 +++++--- .../initializers/content_security_policy.rb | 2 ++ .../initializers/filter_parameter_logging.rb | 12 ++++++----- playground/config/initializers/inflections.rb | 2 ++ .../config/initializers/permissions_policy.rb | 2 ++ playground/config/puma.rb | 20 ++++++++++--------- 25 files changed, 79 insertions(+), 46 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1541db98..e9b86aab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,7 +9,7 @@ GIT PATH remote: . specs: - proscenium (0.15.0.beta.4) + proscenium (0.15.0.beta.5) activesupport (>= 6.1.0, < 8.0) dry-initializer (~> 3.1) dry-types (~> 1.7) diff --git a/fixtures/dummy/app/controllers/bare_pages_controller.rb b/fixtures/dummy/app/controllers/bare_pages_controller.rb index 3f4874e5..f70af3ca 100644 --- a/fixtures/dummy/app/controllers/bare_pages_controller.rb +++ b/fixtures/dummy/app/controllers/bare_pages_controller.rb @@ -7,7 +7,7 @@ class BarePagesController < ApplicationController private - def normalize_sideload_assets_params # rubocop:disable Metrics/AbcSize + def normalize_sideload_assets_params %i[sideload_view_assets sideload_layout_assets sideload_partial_assets sideload_partial_layout_assets].each do |key| next unless params[key] diff --git a/fixtures/dummy/config/initializers/application_controller_renderer.rb b/fixtures/dummy/config/initializers/application_controller_renderer.rb index f4556db3..6d56e439 100644 --- a/fixtures/dummy/config/initializers/application_controller_renderer.rb +++ b/fixtures/dummy/config/initializers/application_controller_renderer.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do diff --git a/fixtures/dummy/config/initializers/assets.rb b/fixtures/dummy/config/initializers/assets.rb index 6f260d5c..8968b929 100644 --- a/fixtures/dummy/config/initializers/assets.rb +++ b/fixtures/dummy/config/initializers/assets.rb @@ -1,4 +1,5 @@ # 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. diff --git a/fixtures/dummy/config/initializers/content_security_policy.rb b/fixtures/dummy/config/initializers/content_security_policy.rb index 413a8f16..0ff8be6a 100644 --- a/fixtures/dummy/config/initializers/content_security_policy.rb +++ b/fixtures/dummy/config/initializers/content_security_policy.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Define an application-wide content security policy diff --git a/fixtures/dummy/config/initializers/mime_types.rb b/fixtures/dummy/config/initializers/mime_types.rb index 6e1d16f0..be6fedc5 100644 --- a/fixtures/dummy/config/initializers/mime_types.rb +++ b/fixtures/dummy/config/initializers/mime_types.rb @@ -1,4 +1,5 @@ # frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: diff --git a/fixtures/dummy/config/initializers/permissions_policy.rb b/fixtures/dummy/config/initializers/permissions_policy.rb index 50bcf4ea..810aadeb 100644 --- a/fixtures/dummy/config/initializers/permissions_policy.rb +++ b/fixtures/dummy/config/initializers/permissions_policy.rb @@ -1,4 +1,5 @@ # 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 # diff --git a/lib/proscenium/builder.rb b/lib/proscenium/builder.rb index e22f671e..c2241a0f 100644 --- a/lib/proscenium/builder.rb +++ b/lib/proscenium/builder.rb @@ -100,7 +100,7 @@ def initialize(root: nil, base_url: nil) @base_url = base_url end - def build_to_path(path) # rubocop:disable Metrics/AbcSize + def build_to_path(path) ActiveSupport::Notifications.instrument('build_to_path.proscenium', identifier: path, cached: Proscenium.cache.exist?(path)) do diff --git a/lib/proscenium/ui/breadcrumbs/computed_element.rb b/lib/proscenium/ui/breadcrumbs/computed_element.rb index 28c28700..59a7dd4c 100644 --- a/lib/proscenium/ui/breadcrumbs/computed_element.rb +++ b/lib/proscenium/ui/breadcrumbs/computed_element.rb @@ -37,7 +37,7 @@ def name # No matter what, the result is always passed to `url_for` before being returned. # # @return [String] the URL for the element - def path # rubocop:disable Metrics/AbcSize + def path @path ||= unless @element.path.nil? case path = @element.path when Array diff --git a/lib/proscenium/version.rb b/lib/proscenium/version.rb index e6b4d652..54885912 100644 --- a/lib/proscenium/version.rb +++ b/lib/proscenium/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Proscenium - VERSION = '0.15.0.beta.4' + VERSION = '0.15.0.beta.5' end diff --git a/playground/app/models/application_record.rb b/playground/app/models/application_record.rb index b63caeb8..08dc5379 100644 --- a/playground/app/models/application_record.rb +++ b/playground/app/models/application_record.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationRecord < ActiveRecord::Base primary_abstract_class end diff --git a/playground/bin/rails b/playground/bin/rails index efc03774..a31728ab 100755 --- a/playground/bin/rails +++ b/playground/bin/rails @@ -1,4 +1,6 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path("../config/application", __dir__) -require_relative "../config/boot" -require "rails/commands" +# frozen_string_literal: true + +APP_PATH = File.expand_path('../config/application', __dir__) +require_relative '../config/boot' +require 'rails/commands' diff --git a/playground/bin/rake b/playground/bin/rake index 4fbf10b9..c1999550 100755 --- a/playground/bin/rake +++ b/playground/bin/rake @@ -1,4 +1,6 @@ #!/usr/bin/env ruby -require_relative "../config/boot" -require "rake" +# frozen_string_literal: true + +require_relative '../config/boot' +require 'rake' Rake.application.run diff --git a/playground/bin/setup b/playground/bin/setup index 3cd5a9d7..3a74034f 100755 --- a/playground/bin/setup +++ b/playground/bin/setup @@ -1,8 +1,10 @@ #!/usr/bin/env ruby -require "fileutils" +# frozen_string_literal: true + +require 'fileutils' # path to your application root. -APP_ROOT = File.expand_path("..", __dir__) +APP_ROOT = File.expand_path('..', __dir__) def system!(*args) system(*args, exception: true) @@ -13,9 +15,9 @@ FileUtils.chdir APP_ROOT do # This script is idempotent, so that you can run it at any time and get an expectable outcome. # Add necessary setup steps to this file. - puts "== Installing dependencies ==" - system! "gem install bundler --conservative" - system("bundle check") || system!("bundle install") + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') || system!('bundle install') # puts "\n== Copying sample files ==" # unless File.exist?("config/database.yml") @@ -23,11 +25,11 @@ FileUtils.chdir APP_ROOT do # end puts "\n== Preparing database ==" - system! "bin/rails db:prepare" + system! 'bin/rails db:prepare' puts "\n== Removing old logs and tempfiles ==" - system! "bin/rails log:clear tmp:clear" + system! 'bin/rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system! "bin/rails restart" + system! 'bin/rails restart' end diff --git a/playground/config.ru b/playground/config.ru index 4a3c09a6..6dc83218 100644 --- a/playground/config.ru +++ b/playground/config.ru @@ -1,6 +1,8 @@ +# frozen_string_literal: true + # This file is used by Rack-based servers to start the application. -require_relative "config/environment" +require_relative 'config/environment' run Rails.application Rails.application.load_server diff --git a/playground/config/boot.rb b/playground/config/boot.rb index e895a90c..7b1b1fa6 100644 --- a/playground/config/boot.rb +++ b/playground/config/boot.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __dir__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __dir__) -require "bundler/setup" # Set up gems listed in the Gemfile. +require 'bundler/setup' # Set up gems listed in the Gemfile. $LOAD_PATH.unshift File.expand_path('../../lib', __dir__) diff --git a/playground/config/environment.rb b/playground/config/environment.rb index cac53157..d5abe558 100644 --- a/playground/config/environment.rb +++ b/playground/config/environment.rb @@ -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! diff --git a/playground/config/environments/development.rb b/playground/config/environments/development.rb index bacf4db6..d6566939 100644 --- a/playground/config/environments/development.rb +++ b/playground/config/environments/development.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'active_support/core_ext/integer/time' Rails.application.configure do diff --git a/playground/config/environments/production.rb b/playground/config/environments/production.rb index 6bcd93dc..4f56ad15 100644 --- a/playground/config/environments/production.rb +++ b/playground/config/environments/production.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'active_support/core_ext/integer/time' Rails.application.configure do @@ -16,9 +18,9 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment - # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files). - # config.require_master_key = true + # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, + # or an environment key such as config/credentials/production.key. This key is used to decrypt + # credentials (and other encrypted files). config.require_master_key = true # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead. # config.public_file_server.enabled = false @@ -38,16 +40,16 @@ config.force_ssl = true # Log to STDOUT by default - config.logger = ActiveSupport::Logger.new(STDOUT) + config.logger = ActiveSupport::Logger.new($stdout) .tap { |logger| logger.formatter = Logger::Formatter.new } .then { |logger| ActiveSupport::TaggedLogging.new(logger) } # Prepend all log lines with the following tags. config.log_tags = [:request_id] - # "info" includes generic and useful information about system operation, but avoids logging too much - # information to avoid inadvertent exposure of personally identifiable information (PII). If you - # want to log everything, set the level to "debug". + # "info" includes generic and useful information about system operation, but avoids logging too + # much information to avoid inadvertent exposure of personally identifiable information (PII). If + # you want to log everything, set the level to "debug". config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info') # Use a different cache store in production. diff --git a/playground/config/environments/test.rb b/playground/config/environments/test.rb index d349c355..6f8d37b4 100644 --- a/playground/config/environments/test.rb +++ b/playground/config/environments/test.rb @@ -1,4 +1,6 @@ -require "active_support/core_ext/integer/time" +# frozen_string_literal: true + +require 'active_support/core_ext/integer/time' # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that @@ -15,12 +17,12 @@ # this is usually not necessary, and can slow down your test suite. However, it's # recommended that you enable it in continuous integration systems to ensure eager # loading is working properly before deploying your code. - config.eager_load = ENV["CI"].present? + config.eager_load = ENV['CI'].present? # 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}" } # Show full error reports and disable caching. diff --git a/playground/config/initializers/content_security_policy.rb b/playground/config/initializers/content_security_policy.rb index b3076b38..35ab3fd6 100644 --- a/playground/config/initializers/content_security_policy.rb +++ b/playground/config/initializers/content_security_policy.rb @@ -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. diff --git a/playground/config/initializers/filter_parameter_logging.rb b/playground/config/initializers/filter_parameter_logging.rb index c2d89e28..b55ebc97 100644 --- a/playground/config/initializers/filter_parameter_logging.rb +++ b/playground/config/initializers/filter_parameter_logging.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. -# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file. -# Use this to limit dissemination of sensitive information. -# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors. -Rails.application.config.filter_parameters += [ - :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn +# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the +# log file. Use this to limit dissemination of sensitive information. See the +# ActiveSupport::ParameterFilter documentation for supported notations and behaviors. +Rails.application.config.filter_parameters += %i[ + passw secret token _key crypt salt certificate otp ssn ] diff --git a/playground/config/initializers/inflections.rb b/playground/config/initializers/inflections.rb index dd5ca167..bd78988f 100644 --- a/playground/config/initializers/inflections.rb +++ b/playground/config/initializers/inflections.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/playground/config/initializers/permissions_policy.rb b/playground/config/initializers/permissions_policy.rb index 7db3b957..e8d0b2ae 100644 --- a/playground/config/initializers/permissions_policy.rb +++ b/playground/config/initializers/permissions_policy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Define an application-wide HTTP permissions policy. For further diff --git a/playground/config/puma.rb b/playground/config/puma.rb index afa809b4..7ed41574 100644 --- a/playground/config/puma.rb +++ b/playground/config/puma.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This configuration file will be evaluated by Puma. The top-level methods that # are invoked here are part of Puma's configuration DSL. For more information # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html. @@ -7,29 +9,29 @@ # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum # and maximum; this matches the default thread size of Active Record. -max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } -min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } +max_threads_count = ENV.fetch('RAILS_MAX_THREADS', 5) +min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count } threads min_threads_count, max_threads_count # Specifies that the worker count should equal the number of processors in production. -if ENV["RAILS_ENV"] == "production" - require "concurrent-ruby" - worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count }) +if ENV['RAILS_ENV'] == 'production' + require 'concurrent-ruby' + worker_count = Integer(ENV.fetch('WEB_CONCURRENCY') { Concurrent.physical_processor_count }) workers worker_count if worker_count > 1 end # Specifies the `worker_timeout` threshold that Puma will use to wait before # terminating a worker in development environments. -worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development" +worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development' # Specifies the `port` that Puma will listen on to receive requests; default is 3000. -port ENV.fetch("PORT") { 3000 } +port ENV.fetch('PORT', 3000) # Specifies the `environment` that Puma will run in. -environment ENV.fetch("RAILS_ENV") { "development" } +environment ENV.fetch('RAILS_ENV', 'development') # Specifies the `pidfile` that Puma will use. -pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" } +pidfile ENV.fetch('PIDFILE', 'tmp/pids/server.pid') # Allow puma to be restarted by `bin/rails restart` command. plugin :tmp_restart