From 3ae931074b4cc970d891dda09b7c7fa6da063bfd Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 10 Oct 2023 22:50:10 -0400 Subject: [PATCH] Fix new linting violations --- config/application.rb | 2 +- config/environments/production.rb | 8 +++---- config/environments/test.rb | 2 +- .../initializers/filter_parameter_logging.rb | 4 ++-- ..._to_active_storage_blobs.active_storage.rb | 2 +- ..._storage_variant_records.active_storage.rb | 21 ++++++++++--------- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/config/application.rb b/config/application.rb index 83de621..67a738a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -14,7 +14,7 @@ module FamilyBudget # Please, add to the `ignore` list any other `lib` subdirectories that do # not contain `.rb` files, or that should not be reloaded or eager loaded. # Common ones are `templates`, `generators`, or `middleware`, for example. - config.autoload_lib(ignore: %w(assets tasks)) + config.autoload_lib(ignore: %w[assets tasks]) # Configuration for the application, engines, and railties goes here. # diff --git a/config/environments/production.rb b/config/environments/production.rb index f8dc13b..5143bc9 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -13,7 +13,7 @@ Rails.application.configure do config.eager_load = true # Full error reports are disabled and caching is turned on. - config.consider_all_requests_local = false + 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 @@ -52,12 +52,12 @@ Rails.application.configure do config.force_ssl = true # Log to STDOUT by default - config.logger = ActiveSupport::Logger.new(STDOUT) - .tap { |logger| logger.formatter = ::Logger::Formatter.new } + 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 ] + config.log_tags = [:request_id] # Info include generic and useful information about system operation, but avoids logging too much # information to avoid inadvertent exposure of personally identifiable information (PII). If you diff --git a/config/environments/test.rb b/config/environments/test.rb index 0dda9f9..bcb1feb 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -24,7 +24,7 @@ Rails.application.configure do } # Show full error reports and disable caching. - config.consider_all_requests_local = true + config.consider_all_requests_local = true config.action_controller.perform_caching = false config.cache_store = :null_store diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 41551f6..c2d89e2 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,7 +1,7 @@ # 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. +# 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 diff --git a/db/migrate/20231011024746_add_service_name_to_active_storage_blobs.active_storage.rb b/db/migrate/20231011024746_add_service_name_to_active_storage_blobs.active_storage.rb index a15c6ce..0267f12 100644 --- a/db/migrate/20231011024746_add_service_name_to_active_storage_blobs.active_storage.rb +++ b/db/migrate/20231011024746_add_service_name_to_active_storage_blobs.active_storage.rb @@ -6,7 +6,7 @@ class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0] unless column_exists?(:active_storage_blobs, :service_name) add_column :active_storage_blobs, :service_name, :string - if configured_service = ActiveStorage::Blob.service.name + if (configured_service = ActiveStorage::Blob.service.name) ActiveStorage::Blob.unscoped.update_all(service_name: configured_service) end diff --git a/db/migrate/20231011024747_create_active_storage_variant_records.active_storage.rb b/db/migrate/20231011024747_create_active_storage_variant_records.active_storage.rb index 94ac83a..95fd27f 100644 --- a/db/migrate/20231011024747_create_active_storage_variant_records.active_storage.rb +++ b/db/migrate/20231011024747_create_active_storage_variant_records.active_storage.rb @@ -8,20 +8,21 @@ class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0] t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type t.string :variation_digest, null: false - t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true + t.index %i[blob_id variation_digest], name: "index_active_storage_variant_records_uniqueness", unique: true t.foreign_key :active_storage_blobs, column: :blob_id end end private - def primary_key_type - config = Rails.configuration.generators - config.options[config.orm][:primary_key_type] || :primary_key - end - def blobs_primary_key_type - pkey_name = connection.primary_key(:active_storage_blobs) - pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name } - pkey_column.bigint? ? :bigint : pkey_column.type - end + def primary_key_type + config = Rails.configuration.generators + config.options[config.orm][:primary_key_type] || :primary_key + end + + def blobs_primary_key_type + pkey_name = connection.primary_key(:active_storage_blobs) + pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name } + pkey_column.bigint? ? :bigint : pkey_column.type + end end