diff --git a/.rubocop.yml b/.rubocop.yml index b7f7ab9..05ea57b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -14,6 +14,18 @@ AllCops: Documentation: Enabled: false +Style/StringLiterals: + Exclude: + - 'config/application.rb' + - 'config/boot.rb' + - 'config/environments/*' + - 'config/environment.rb' + - 'config/initializers/backtrace_silencers.rb' + - 'config.ru' + +RSpec/NestedGroups: + Max: 4 + Metrics/LineLength: Max: 130 @@ -29,13 +41,5 @@ Metrics/BlockLength: - post - delete -Style/NumericPredicate: - Exclude: - - spec/**/* - -Style/HashSyntax: - Enabled: true - EnforcedStyle: ruby19 - Metrics/AbcSize: Max: 30 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c91ccd1..df5b769 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,149 +1,36 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2021-10-23 16:16:34 UTC using RuboCop version 1.22.2. +# on 2024-01-20 09:54:15 UTC using RuboCop version 1.60.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: with_first_argument, with_fixed_indentation -Layout/ArgumentAlignment: - Exclude: - - 'spec/processors/message_processor/eightball_spec.rb' - # Offense count: 1 -# Cop supports --auto-correct. -Layout/EmptyLineAfterGuardClause: +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max. +Metrics/AbcSize: Exclude: - 'app/models/pair.rb' -# Offense count: 4 -# Cop supports --auto-correct. -Layout/EmptyLines: - Exclude: - - 'config/application.rb' - - 'config/environments/development.rb' - - 'spec/models/pair_spec.rb' - -# Offense count: 3 -# Cop supports --auto-correct. -# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. -Layout/ExtraSpacing: - Exclude: - - 'config/environments/production.rb' - - 'db/migrate/20170816162384_create_singles.rb' - - 'db/migrate/20210925130635_remove_urls_and_singles.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -Layout/LeadingEmptyLines: - Exclude: - - 'spec/rails_helper.rb' - -# Offense count: 4 -# Cop supports --auto-correct. -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Layout/LineLength: - Max: 133 - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. -# SupportedStylesForExponentOperator: space, no_space -Layout/SpaceAroundOperators: - Exclude: - - 'config/environments/production.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. -# SupportedStyles: space, no_space -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceBeforeBlockBraces: - Exclude: - - 'spec/models/pair_spec.rb' - -# Offense count: 10 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. -# SupportedStyles: space, no_space, compact -# SupportedStylesForEmptyBrackets: space, no_space -Layout/SpaceInsideArrayLiteralBrackets: - Exclude: - - 'config/environments/production.rb' - - 'db/migrate/20170815155843_create_pairs.rb' - - 'db/migrate/20170816162384_create_singles.rb' - - 'db/migrate/20171104065321_create_data_banks.rb' - -# Offense count: 6 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. -# SupportedStyles: space, no_space -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceInsideBlockBraces: - Exclude: - - 'lib/tasks/databank.rake' - - 'spec/models/pair_spec.rb' - - 'spec/processors/message_processor/me_spec.rb' - # Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. -# SupportedStyles: space, no_space, compact -# SupportedStylesForEmptyBraces: space, no_space -Layout/SpaceInsideHashLiteralBraces: - Exclude: - - 'app/models/word.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: space, compact, no_space -Layout/SpaceInsideParens: - Exclude: - - 'db/migrate/20171028053628_remove_one_world_sentences.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: final_newline, final_blank_line -Layout/TrailingEmptyLines: - Exclude: - - 'config/application.rb' - -# Offense count: 3 -# Cop supports --auto-correct. -# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. -Lint/UnusedBlockArgument: +# Configuration parameters: CountComments, Max, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode. +# AllowedMethods: refine +Metrics/BlockLength: Exclude: - - 'lib/tasks/databank.rake' - -# Offense count: 1 -# Configuration parameters: IgnoredMethods, CountRepeatedAttributes. -Metrics/AbcSize: - Max: 36 + - 'lib/tasks/database.rake' # Offense count: 3 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. -Metrics/BlockLength: - Max: 127 - -# Offense count: 2 -# Configuration parameters: IgnoredMethods. +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/CyclomaticComplexity: Max: 9 -# Offense count: 6 -# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# Offense count: 13 +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. Metrics/MethodLength: Max: 23 -# Offense count: 1 -# Configuration parameters: IgnoredMethods. +# Offense count: 2 +# Configuration parameters: AllowedMethods, AllowedPatterns. Metrics/PerceivedComplexity: Max: 9 @@ -152,22 +39,13 @@ Naming/AccessorMethodName: Exclude: - 'spec/support/web_mocks/telegram.rb' -# Offense count: 5 -# Cop supports --auto-correct. -# Configuration parameters: SkipBlocks, EnforcedStyle. -# SupportedStyles: described_class, explicit -RSpec/DescribedClass: - Exclude: - - 'spec/models/pair_spec.rb' - - 'spec/models/word_spec.rb' - # Offense count: 4 # Configuration parameters: CountAsOne. RSpec/ExampleLength: - Max: 9 + Max: 11 # Offense count: 7 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). # Configuration parameters: Include. # Include: spec/factories.rb, spec/factories/**/*.rb, features/support/factories/**/*.rb RSpec/FactoryBot/FactoryClassName: @@ -180,14 +58,12 @@ RSpec/FactoryBot/FactoryClassName: - 'spec/factories/telegram/user.rb' - 'spec/factories/user.rb' -# Offense count: 4 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: is_expected, should -RSpec/ImplicitExpect: +# Offense count: 1 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. +# Include: **/*_spec*rb*, **/spec/**/* +RSpec/FilePath: Exclude: - - 'spec/models/pair_spec.rb' - - 'spec/models/user_spec.rb' + - 'spec/processors/concerns/processor_spec.rb' # Offense count: 7 RSpec/MessageChain: @@ -202,19 +78,13 @@ RSpec/MessageChain: RSpec/MultipleExpectations: Max: 3 -# Offense count: 46 +# Offense count: 75 # Configuration parameters: AllowSubject. RSpec/MultipleMemoizedHelpers: Max: 13 -# Offense count: 4 -RSpec/RepeatedExample: - Exclude: - - 'spec/processors/message_processor/start_spec.rb' - - 'spec/processors/message_processor/stop_spec.rb' - # Offense count: 7 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). RSpec/SingleArgumentMessageChain: Exclude: - 'spec/controllers/webhooks_controller_spec.rb' @@ -228,21 +98,6 @@ RSpec/StubbedMock: Exclude: - 'spec/processors/update_processor_spec.rb' -# Offense count: 3 -# Cop supports --auto-correct. -# Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent. -Rails/Blank: - Exclude: - - 'lib/tasks/databank.rake' - -# Offense count: 2 -# Configuration parameters: Database, Include. -# SupportedDatabases: mysql, postgresql -# Include: db/migrate/*.rb -Rails/BulkChangeTable: - Exclude: - - 'db/migrate/20180203063658_add_dates_to_chat.rb' - # Offense count: 9 # Configuration parameters: Include. # Include: db/migrate/*.rb @@ -258,27 +113,18 @@ Rails/CreateTableWithTimestamps: - 'db/migrate/20170817161038_create_winners.rb' - 'db/migrate/20171104065321_create_data_banks.rb' -# Offense count: 4 -# Configuration parameters: EnforcedStyle, AllowToTime. -# SupportedStyles: strict, flexible -Rails/Date: - Exclude: - - 'app/models/winner.rb' - - 'app/processors/message_processor/eightball.rb' - -# Offense count: 4 +# Offense count: 3 # Configuration parameters: EnforcedStyle. # SupportedStyles: slashes, arguments Rails/FilePath: Exclude: - - 'config/environments/development.rb' - 'config/initializers/locale.rb' - 'lib/tasks/database.rake' - 'spec/rails_helper.rb' # Offense count: 1 # Configuration parameters: Include. -# Include: db/migrate/*.rb +# Include: db/**/*.rb Rails/ReversibleMigration: Exclude: - 'db/migrate/20180211095834_fix_chat_timestamps.rb' @@ -292,103 +138,28 @@ Rails/SkipsModelValidations: - 'app/models/word.rb' - 'db/migrate/20170917105603_persist_chat_i_ds.rb' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: strict, flexible -Rails/TimeZone: - Exclude: - - 'db/migrate/20180203063658_add_dates_to_chat.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: always, conditionals -Style/AndOr: - Exclude: - - 'lib/tasks/database.rake' - -# Offense count: 5 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: compact, expanded -Style/EmptyMethod: - Exclude: - - 'app/processors/message_processor/databank.rb' - - 'app/workers/covid_worker.rb' - # Offense count: 1 -# Cop supports --auto-correct. +# This cop supports unsafe autocorrection (--autocorrect-all). Style/GlobalStdStream: Exclude: - 'config/environments/production.rb' -# Offense count: 1 -# Configuration parameters: MinBranchesCount. -Style/HashLikeCase: +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, AllowInnerSlashes. +# SupportedStyles: slashes, percent_r, mixed +Style/RegexpLiteral: Exclude: - - 'lib/tasks/database.rake' + - 'Guardfile' # Offense count: 2 -# Cop supports --auto-correct. -Style/KeywordParametersOrder: - Exclude: - - 'app/models/pair.rb' - -# Offense count: 1 -# Cop supports --auto-correct. -Style/Not: - Exclude: - - 'lib/tasks/database.rake' - -# Offense count: 3 -# Cop supports --auto-correct. +# This cop supports unsafe autocorrection (--autocorrect-all). Style/SlicingWithRange: Exclude: - - 'spec/processors/message_processor/base_processor_spec.rb' - 'spec/processors/message_processor/me_spec.rb' - 'spec/processors/message_processor/say_spec.rb' # Offense count: 1 -# Cop supports --auto-correct. -# Configuration parameters: Mode. -Style/StringConcatenation: - Exclude: - - 'lib/tasks/database.rake' - -# Offense count: 5 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. -# SupportedStyles: single_quotes, double_quotes -Style/StringLiterals: - Exclude: - - 'config.ru' - - 'config/environments/production.rb' - - 'config/initializers/backtrace_silencers.rb' - - 'lib/tasks/databank.rake' - - 'spec/factories/telegram/message.rb' - -# Offense count: 7 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, MinSize. -# SupportedStyles: percent, brackets -Style/SymbolArray: - Exclude: - - 'config/initializers/filter_parameter_logging.rb' - - 'db/migrate/20170815155843_create_pairs.rb' - - 'db/migrate/20170816162384_create_singles.rb' - - 'db/migrate/20171104065321_create_data_banks.rb' - - 'lib/tasks/databank.rake' - -# Offense count: 1 -# Cop supports --auto-correct. +# This cop supports safe autocorrection (--autocorrect). Style/WhileUntilDo: Exclude: - 'app/models/pair.rb' - -# Offense count: 4 -# Cop supports --auto-correct. -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. -# URISchemes: http, https -Layout/LineLength: - Max: 133 diff --git a/app/models/chat.rb b/app/models/chat.rb index 65a77ba..c5c9872 100644 --- a/app/models/chat.rb +++ b/app/models/chat.rb @@ -63,7 +63,7 @@ def answer_randomly?(additional = 0) end def generate_reply(words) - Pair.build_sentence(chat: self, words: words) || Pair.build_sentence(chat: self, words_ids: context) + Pair.build_sentence(chat: self, words:) || Pair.build_sentence(chat: self, words_ids: context) end def generate_story diff --git a/app/models/data_bank.rb b/app/models/data_bank.rb index 337db59..0fabd27 100644 --- a/app/models/data_bank.rb +++ b/app/models/data_bank.rb @@ -5,10 +5,10 @@ class DataBank < ApplicationRecord class << self def update(filename:, id: nil, name: nil) - databank = Databank.find_by(id: id) || Databank.create(name: name) + databank = Databank.find_by(id:) || Databank.create(name:) databank.pairs.destroy words = File.read(filename, 'r').split(' ') - Pair.learn(chat_id: nil, data_bank_id: databank.id, words: words) + Pair.learn(chat_id: nil, data_bank_id: databank.id, words:) end end end diff --git a/app/models/pair.rb b/app/models/pair.rb index 2ebf3d7..ea5c11a 100644 --- a/app/models/pair.rb +++ b/app/models/pair.rb @@ -18,10 +18,10 @@ def check_chat_and_bank end class << self - def learn(chat: nil, data_bank: nil, words:) + def learn(words:, chat: nil, data_bank: nil) raise 'Chat OR Databank must be specified' if chat.nil? == data_bank.nil? - Word.learn(words) + Word.learn(words) words_array = [nil] words.each do |word| words_array << word @@ -37,8 +37,8 @@ def learn(chat: nil, data_bank: nil, words:) next end words_ids.shift - pair_params = { chat: chat, - data_bank: data_bank, + pair_params = { chat:, + data_bank:, first_id: trigram.first, second_id: trigram.second } pair = Pair.includes(:replies).find_or_create_by!(pair_params) @@ -52,13 +52,13 @@ def build_sentence(chat: self.chat, words: nil, words_ids: nil) words_ids = Word.to_ids(words) if words.present? sentence = [] safety_counter = 50 - pair_params = { chat: chat, first_id: nil, second_id: words_ids } + pair_params = { chat:, first_id: nil, second_id: words_ids } while (pair = fetch_pair(pair_params)) && (sentence.size < safety_counter) do replies = pair.replies.order(count: :desc) replies_pool = 3 + replies.size / 2 reply = replies.limit(replies_pool).sample - pair_params = { chat: chat, first_id: pair.second_id, second_id: reply&.word_id } + pair_params = { chat:, first_id: pair.second_id, second_id: reply&.word_id } sentence << pair.second_id if sentence.empty? reply&.word_id.nil? ? break : sentence << reply.word_id end diff --git a/app/models/participation.rb b/app/models/participation.rb index da8d3c1..4b9132b 100644 --- a/app/models/participation.rb +++ b/app/models/participation.rb @@ -28,7 +28,7 @@ def learn(message) user = User.find_by(id: message&.from&.id) return if chat.nil? || user.nil? - Participation.find_or_create_by(chat: chat, user: user).learn(message) + Participation.find_or_create_by(chat:, user:).learn(message) end end end diff --git a/app/models/word.rb b/app/models/word.rb index 457b1a5..ac6290e 100644 --- a/app/models/word.rb +++ b/app/models/word.rb @@ -19,7 +19,7 @@ def learn(words) new_words = words - Word.where(word: words).pluck(:word) return nil if new_words.blank? - words_array = new_words.uniq.map { |word| { word: word} } + words_array = new_words.uniq.map { |word| { word: } } Word.insert_all(words_array) end end diff --git a/app/processors/concerns/processor.rb b/app/processors/concerns/processor.rb index 3aa96d4..fc17592 100644 --- a/app/processors/concerns/processor.rb +++ b/app/processors/concerns/processor.rb @@ -69,6 +69,6 @@ def user end def participation - @participation ||= Participation.find_by!(chat: chat, user: user) + @participation ||= Participation.find_by!(chat:, user:) end end diff --git a/app/processors/message_processor/databank.rb b/app/processors/message_processor/databank.rb index 5958bfe..97a86d1 100644 --- a/app/processors/message_processor/databank.rb +++ b/app/processors/message_processor/databank.rb @@ -52,9 +52,9 @@ def disable def show databanks = DataBank.pluck(:id, :name).to_h - list = databanks.map { |id, name| I18n.t('.databank.list_line_html', id: id, name: name) }.join("\n") + list = databanks.map { |id, name| I18n.t('.databank.list_line_html', id:, name:) }.join("\n") active = chat.data_bank_ids.present? ? chat.data_bank_ids.to_sentence : I18n.t('false') - I18n.t('.databank.list_html', list: list, active: active) + I18n.t('.databank.list_html', list:, active:) end end end diff --git a/app/processors/message_processor/eightball.rb b/app/processors/message_processor/eightball.rb index 70fab8f..69fb28c 100644 --- a/app/processors/message_processor/eightball.rb +++ b/app/processors/message_processor/eightball.rb @@ -32,7 +32,7 @@ def generate_prediction return I18n.t('eightball.empty').sample if command_parameters.blank? answers = I18n.t('.eightball.replies') - digest = Digest::SHA1.hexdigest(command_parameters).to_i(16) - Date.today.to_time.to_i.div(100) - user.id + digest = Digest::SHA1.hexdigest(command_parameters).to_i(16) - Time.zone.today.to_time.to_i.div(100) - user.id answer_id = digest.divmod(answers.count)[1] answers[answer_id] end diff --git a/app/processors/message_processor/winner.rb b/app/processors/message_processor/winner.rb index 6e6bfb4..48be2c3 100644 --- a/app/processors/message_processor/winner.rb +++ b/app/processors/message_processor/winner.rb @@ -39,7 +39,7 @@ def current_stats I18n.t('winner.top_line_html', position: i + 1, user: p.user.to_s, score: p.score) if p.user.present? end.compact.join("\n") - I18n.t('winner.current_html', top: top) + I18n.t('winner.current_html', top:) end def previous_winner @@ -56,7 +56,7 @@ def previous_winner .map { |(user, wins), idx| I18n.t('winner.top_line_html', position: idx + 1, user: user.to_s, score: wins) } .join("\n") - I18n.t('winner.winner_html', top: top, name: chat.winner, user: winner) + I18n.t('winner.winner_html', top:, name: chat.winner, user: winner) else I18n.t('winner.no_one') end diff --git a/app/workers/pair_update_worker.rb b/app/workers/pair_update_worker.rb index fbba695..64c3327 100644 --- a/app/workers/pair_update_worker.rb +++ b/app/workers/pair_update_worker.rb @@ -7,6 +7,6 @@ class PairUpdateWorker def perform(chat_id, text) chat = Chat.find(chat_id) - Pair.learn(chat: chat, words: text.split) + Pair.learn(chat:, words: text.split) end end diff --git a/app/workers/winner_gamble_worker.rb b/app/workers/winner_gamble_worker.rb index 50b7a8d..cd23fe8 100644 --- a/app/workers/winner_gamble_worker.rb +++ b/app/workers/winner_gamble_worker.rb @@ -18,7 +18,7 @@ def perform(chat_id) .map { |(user, wins), idx| I18n.t('winner.top_line_html', position: idx + 1, user: user.to_s, score: wins) } .join("\n") - parameters = { text: I18n.t('winner.winner_html', top: top, name: chat.winner, user: winner.to_link), + parameters = { text: I18n.t('winner.winner_html', top:, name: chat.winner, user: winner.to_link), parse_mode: :html, disable_notification: true, chat_id: chat.telegram_id } diff --git a/config/application.rb b/config/application.rb index 92468eb..056cf9a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -34,7 +34,6 @@ class Application < Rails::Application # config.time_zone = "Central Time (US & Canada)" # config.eager_load_paths << Rails.root.join("extras") - # Only loads a smaller set of middleware suitable for API only apps. # Middleware like session, flash, cookies can be added back manually. # Skip views, helpers and assets when generating a new resource. diff --git a/config/boot.rb b/config/boot.rb index 2ecfc50..ad622f6 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. diff --git a/config/environment.rb b/config/environment.rb index cac5315..7df99e8 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Load the Rails application. require_relative "application" diff --git a/config/environments/development.rb b/config/environments/development.rb index 5bb4432..0a0c1c1 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/integer/time" Rails.application.configure do @@ -45,7 +47,6 @@ # Highlight code that triggered database queries in logs. config.active_record.verbose_query_logs = true - # Raises error for missing translations. # config.i18n.raise_on_missing_translations = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 98e3fb2..8de44ea 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/integer/time" Rails.application.configure do @@ -13,7 +15,7 @@ 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 # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). @@ -38,7 +40,7 @@ config.log_level = :info # 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 diff --git a/config/environments/test.rb b/config/environments/test.rb index 0eb0fe6..d96f2ab 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "active_support/core_ext/integer/time" # The test environment is used exclusively to run your application's diff --git a/config/initializers/cors.rb b/config/initializers/cors.rb index e5a82f1..62875c1 100644 --- a/config/initializers/cors.rb +++ b/config/initializers/cors.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Avoid CORS issues when API is called from the frontend app. diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4b34a03..e214a4c 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,6 +1,6 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. -Rails.application.config.filter_parameters += [ - :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn -] +Rails.application.config.filter_parameters += %i[passw secret token _key crypt salt certificate otp ssn] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 3860f65..9e049dc 100644 --- a/config/initializers/inflections.rb +++ b/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/config/initializers/new_framework_defaults_6_1.rb b/config/initializers/new_framework_defaults_6_1.rb deleted file mode 100644 index a128fd3..0000000 --- a/config/initializers/new_framework_defaults_6_1.rb +++ /dev/null @@ -1,64 +0,0 @@ -# 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. -# -# Once upgraded flip defaults one by one to migrate to the new default. -# -# Read the Guide for Upgrading Ruby on Rails for more info on each option. - -# Support for inversing belongs_to -> has_many Active Record associations. -# Rails.application.config.active_record.has_many_inversing = true - -# Track Active Storage variants in the database. -# Rails.application.config.active_storage.track_variants = true - -# Apply random variation to the delay when retrying failed jobs. -# Rails.application.config.active_job.retry_jitter = 0.15 - -# Stop executing `after_enqueue`/`after_perform` callbacks if -# `before_enqueue`/`before_perform` respectively halts with `throw :abort`. -# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true - -# Specify cookies SameSite protection level: either :none, :lax, or :strict. -# -# This change is not backwards compatible with earlier Rails versions. -# It's best enabled when your entire app is migrated and stable on 6.1. -# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax - -# Generate CSRF tokens that are encoded in URL-safe Base64. -# -# This change is not backwards compatible with earlier Rails versions. -# It's best enabled when your entire app is migrated and stable on 6.1. -# Rails.application.config.action_controller.urlsafe_csrf_tokens = true - -# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an -# UTC offset or a UTC time. -# ActiveSupport.utc_to_local_returns_utc_offset_times = true - -# Change the default HTTP status code to `308` when redirecting non-GET/HEAD -# requests to HTTPS in `ActionDispatch::SSL` middleware. -# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308 - -# Use new connection handling API. For most applications this won't have any -# effect. For applications using multiple databases, this new API provides -# support for granular connection swapping. -# Rails.application.config.active_record.legacy_connection_handling = false - -# Make `form_with` generate non-remote forms by default. -# Rails.application.config.action_view.form_with_generates_remote_forms = false - -# Set the default queue name for the analysis job to the queue adapter default. -# Rails.application.config.active_storage.queues.analysis = nil - -# Set the default queue name for the purge job to the queue adapter default. -# Rails.application.config.active_storage.queues.purge = nil - -# Set the default queue name for the incineration job to the queue adapter default. -# Rails.application.config.action_mailbox.queues.incineration = nil - -# Set the default queue name for the routing job to the queue adapter default. -# Rails.application.config.action_mailbox.queues.routing = nil - -# Set the default queue name for the mail deliver job to the queue adapter default. -# Rails.application.config.action_mailer.deliver_later_queue_name = nil diff --git a/config/initializers/new_framework_defaults_7_0.rb b/config/initializers/new_framework_defaults_7_0.rb deleted file mode 100644 index a579326..0000000 --- a/config/initializers/new_framework_defaults_7_0.rb +++ /dev/null @@ -1,117 +0,0 @@ -# Be sure to restart your server when you modify this file. -# -# This file eases your Rails 7.0 framework defaults upgrade. -# -# Uncomment each configuration one by one to switch to the new default. -# Once your application is ready to run with all new defaults, you can remove -# this file and set the `config.load_defaults` to `7.0`. -# -# Read the Guide for Upgrading Ruby on Rails for more info on each option. -# https://guides.rubyonrails.org/upgrading_ruby_on_rails.html - -# `button_to` view helper will render `