diff --git a/.env.test b/.env.test
index c0a492d..dc7a407 100644
--- a/.env.test
+++ b/.env.test
@@ -5,7 +5,7 @@ PUMA_MIN_THREADS=2
PUMA_MAX_THREADS=5
WEB_CONCURRENCY=0
-DATABASE_HOST=postgres
+DATABASE_HOST=database
DATABASE_NAME=shizoid
DATABASE_PASSWORD=WoZ7w2e3
DATABASE_PORT=5432
@@ -13,7 +13,7 @@ DATABASE_USERNAME=shizoid
DB_POOL_SIZE=40
SIDEKIQ_CONCURRENCY=25
-REDIS_HOST=redis
+REDIS_HOST=cache
REDIS_PORT=6379
REDIS_SIDEKIQ_DB=1
REDIS_CONTEXT_DB=2
diff --git a/.github/workflows/shizoid.yml b/.github/workflows/shizoid.yml
index 01a353f..100d4bf 100644
--- a/.github/workflows/shizoid.yml
+++ b/.github/workflows/shizoid.yml
@@ -7,7 +7,7 @@ jobs:
name: Perform specs
runs-on: ubuntu-latest
services:
- postgres:
+ database:
image: postgres:alpine
env:
POSTGRES_USER: shizoid
@@ -20,7 +20,7 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
- redis:
+ cache:
image: redis:alpine
ports:
- 6379:6379
@@ -31,7 +31,7 @@ jobs:
- name: 'Setup Ruby'
uses: ruby/setup-ruby@v1
with:
- ruby-version: 3.0
+ ruby-version: 3.3.0
- name: "Install required system packages"
run: sudo apt-get update -y && sudo apt-get install openssh-client rsync libpq-dev cmake -y
- name: "Bundle install"
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/Gemfile b/Gemfile
index 01f9032..fe92544 100644
--- a/Gemfile
+++ b/Gemfile
@@ -24,8 +24,10 @@ group :development, :test do
gem 'factory_bot_rails'
gem 'ffaker'
gem 'guard'
- gem 'guard-rake'
- gem 'guard-rspec'
+ gem 'guard-bundler', require: false
+ gem 'guard-rake', require: false
+ gem 'guard-rspec', require: false
+ gem 'guard-rubocop', require: false
gem 'listen'
gem 'rack-test'
gem 'rspec'
diff --git a/Gemfile.lock b/Gemfile.lock
index 997f50e..fed4bd9 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -153,6 +153,10 @@ GEM
pry (>= 0.13.0)
shellany (~> 0.0)
thor (>= 0.18.1)
+ guard-bundler (3.0.1)
+ bundler (>= 2.1, < 3)
+ guard (~> 2.2)
+ guard-compat (~> 1.1)
guard-compat (1.2.1)
guard-rake (1.0.0)
guard
@@ -161,6 +165,9 @@ GEM
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0, < 4.0)
+ guard-rubocop (1.5.0)
+ guard (~> 2.0)
+ rubocop (< 2.0)
hashdiff (1.0.1)
i18n (1.10.0)
concurrent-ruby (~> 1.0)
@@ -168,6 +175,8 @@ GEM
io-console (0.5.11)
irb (1.4.1)
reline (>= 0.3.0)
+ json (2.7.1)
+ language_server-protocol (3.17.0.3)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
@@ -205,9 +214,10 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
- parallel (1.22.1)
- parser (3.1.2.0)
+ parallel (1.24.0)
+ parser (3.3.0.4)
ast (~> 2.4.1)
+ racc
pg (1.3.5)
pry (0.14.1)
coderay (~> 1.1)
@@ -252,10 +262,10 @@ GEM
rb-inotify (0.10.1)
ffi (~> 1.0)
redis (4.6.0)
- regexp_parser (2.5.0)
+ regexp_parser (2.9.0)
reline (0.3.1)
io-console (~> 0.5)
- rexml (3.2.5)
+ rexml (3.2.6)
rspec (3.11.0)
rspec-core (~> 3.11.0)
rspec-expectations (~> 3.11.0)
@@ -280,17 +290,19 @@ GEM
rspec-core (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0)
rspec-support (3.11.0)
- rubocop (1.30.1)
+ rubocop (1.60.1)
+ json (~> 2.3)
+ language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
- parser (>= 3.1.0.0)
+ parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
- rubocop-ast (>= 1.18.0, < 2.0)
+ rubocop-ast (>= 1.30.0, < 2.0)
ruby-progressbar (~> 1.7)
- unicode-display_width (>= 1.4.0, < 3.0)
- rubocop-ast (1.18.0)
- parser (>= 3.1.1.0)
+ unicode-display_width (>= 2.4.0, < 3.0)
+ rubocop-ast (1.30.0)
+ parser (>= 3.2.1.0)
rubocop-performance (1.14.1)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
@@ -300,7 +312,7 @@ GEM
rubocop (>= 1.7.0, < 2.0)
rubocop-rspec (2.11.1)
rubocop (~> 1.19)
- ruby-progressbar (1.11.0)
+ ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
sentry-rails (5.3.1)
railties (>= 5.0)
@@ -339,7 +351,7 @@ GEM
timeout (0.3.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
- unicode-display_width (2.1.0)
+ unicode-display_width (2.5.0)
virtus (2.0.0)
axiom-types (~> 0.1)
coercible (~> 1.0)
@@ -364,8 +376,10 @@ DEPENDENCIES
faraday
ffaker
guard
+ guard-bundler
guard-rake
guard-rspec
+ guard-rubocop
listen
pg
puma
@@ -393,6 +407,3 @@ DEPENDENCIES
RUBY VERSION
ruby 3.3.0p0
-
-BUNDLED WITH
- 2.3.7
diff --git a/Guardfile b/Guardfile
index c11ca6a..0c1cf40 100644
--- a/Guardfile
+++ b/Guardfile
@@ -1,5 +1,15 @@
# frozen_string_literal: true
+guard :bundler do
+ watch('Gemfile')
+ watch('Gemfile.lock')
+end
+
+guard :rubocop do
+ watch(%r{.+\.rb$})
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
+end
+
guard :rspec, cmd: 'bundle exec rspec' do
require 'guard/rspec/dsl'
dsl = Guard::RSpec::Dsl.new(self)
@@ -17,8 +27,6 @@ guard :rspec, cmd: 'bundle exec rspec' do
dsl.watch_spec_files_for(rails.views)
watch(rails.controllers) { |m| [rspec.spec.call("controllers/#{m[1]}_controller")] }
- watch(rails.controllers) { |m| [rspec.spec.call("request/#{m[1]}")] }
-
watch(rails.spec_helper) { rspec.spec_dir }
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
end
diff --git a/app/models/chat.rb b/app/models/chat.rb
index ea78c80..c5c9872 100644
--- a/app/models/chat.rb
+++ b/app/models/chat.rb
@@ -11,8 +11,6 @@ class Chat < ApplicationRecord
scope :not_personal, -> { where.not(kind: 'private') }
scope :with_winners, -> { where.not(winner: nil) }
- enum covid_region: CovidStat.regions
-
def winner_enabled?
winner.present?
end
@@ -51,10 +49,6 @@ def disable!
update!(active_at: nil)
end
- def casbanhammer?
- casbanhammer_at.present?
- end
-
def self.learn(message)
chat_payload = message.chat
chat = Chat.find_or_initialize_by(telegram_id: chat_payload.id)
@@ -69,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/covid_stat.rb b/app/models/covid_stat.rb
deleted file mode 100644
index 7d4b35f..0000000
--- a/app/models/covid_stat.rb
+++ /dev/null
@@ -1,88 +0,0 @@
-# frozen_string_literal: true
-
-class CovidStat < ApplicationRecord
- enum region: {
- ALL: 0,
- AD: 2, ALT: 3, AMU: 4, ARK: 5, AST: 6, BA: 7, BEL: 8, BRY: 9, BU: 10, CE: 11, CHE: 12, CHU: 13, CR: 14, CU: 15, DA: 16,
- GA: 17, IN: 18, IRK: 19, IVA: 20, KAM: 21, KB: 22, KC: 23, KDA: 24, KEM: 25, KGD: 26, KGN: 27, KHA: 28, KHM: 29, KIR: 30,
- KK: 31, KL: 32, KLU: 33, KO: 34, KOS: 35, KR: 36, KRS: 37, KYA: 38, LEN: 39, LIP: 40, MAG: 41, ME: 42, MO: 43, MOS: 44,
- MOW: 45, MUR: 46, NEN: 47, NGR: 48, NIZ: 49, NVS: 50, OMS: 51, ORE: 52, ORL: 53, PER: 54, PNZ: 55, PRI: 56, PSK: 57,
- ROS: 58, RYA: 59, SA: 60, SAK: 61, SAM: 62, SAR: 63, SE: 64, SMO: 65, SPE: 66, STA: 67, SVE: 68, TAM: 69, TOM: 70, TT: 71,
- TUL: 72, TVE: 73, TY: 74, TYU: 75, UD: 76, ULY: 77, VGG: 78, VLA: 79, VLG: 80, VOR: 81, YAN: 82, YAR: 83, YEV: 84, ZAB: 85
- }
-
- VIRTUAL_REGIONS = ['ALL'].freeze
- FETCHABLE_REGIONS = (regions.keys - VIRTUAL_REGIONS).freeze
- STATISTICS_ATTRIBUTES = %i[sick healed died].freeze
-
- validates :region, inclusion: { in: FETCHABLE_REGIONS }
-
- class << self
- def day_stats(region: 'ALL', date: nil, return_i18n: false)
- date ||= CovidStat.order(date: :desc).first.date
-
- select_params = STATISTICS_ATTRIBUTES.map { |a| "SUM(#{a}) as #{a}" }.join(',')
- current_stats, previous_stats = [date, date - 1.day].map do |d|
- query = { date: d }
- query[:region] = region if region != 'ALL'
- CovidStat.where(query).select(select_params)
- end.flatten
-
- results = { date: date, region: region, current: current_stats }
- results[:delta] = STATISTICS_ATTRIBUTES.map do |a|
- previous_param = previous_stats.send(a)
- current_param = current_stats.send(a)
-
- result = if current_param.nil? || previous_param.nil?
- '?'
- else
- current_param - previous_param
- end
- [a, result]
- end.to_h
- if return_i18n
- printable_results = STATISTICS_ATTRIBUTES.map do |a|
- current = results[:current].send(a) || '?'
- delta = results[:delta][a]
- delta = if delta.present?
- delta.to_i.positive? ? "+#{delta}" : delta.to_s
- else
- '?'
- end
- [a, "#{current} (#{delta})"]
- end.to_h
-
- I18n.t('covid_stat.stats_html', region: I18n.t("covid_stat.regions.#{region}"),
- date: date,
- sick: printable_results[:sick],
- healed: printable_results[:healed],
- died: printable_results[:died])
- else
- results
- end
- end
-
- def needs_update?
- sample_region = FETCHABLE_REGIONS.sample
- remote_max_date = StopCovidService.get_data(sample_region).map { |r| r[:date] }.max
- local_max_date = CovidStat.where(region: sample_region).maximum(:date)
- return true if local_max_date.blank?
-
- remote_max_date > local_max_date
- end
-
- def update_all
- FETCHABLE_REGIONS.each { |r| CovidRegionUpdaterWorker.perform_async(r) }
- end
-
- def update(region_id)
- StopCovidService.get_data(region_id).map do |r|
- record_key = { date: r[:date], region: region_id }
- stat_record = CovidStat.find_or_initialize_by(record_key)
- stat_record.update(r.except(:date, :region))
- stat_record.save!
- stat_record
- end
- end
- end
-end
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 ab8329b..4b9132b 100644
--- a/app/models/participation.rb
+++ b/app/models/participation.rb
@@ -6,15 +6,6 @@ class Participation < ApplicationRecord
scope :scored, -> { where.not(score: 0) }
- def ban
- Rails.application.secrets[:telegram][:owners].each do |owner_id|
- respose = "CASBAN #{user.to_link} at #{chat.title}"
- # SendPayloadWorker.perform_async(:ban_chat_member, revoke_messages: true, chat_id: chat.telegram_id, user_id: user.id)
- SendPayloadWorker.perform_async('send_message', 'chat_id' => owner_id, 'parse_mode' => 'html', 'text' => respose)
- end
- update!(left: true)
- end
-
def learn(message)
self.experience += rand(3) if active_at.nil? || 5.minutes.ago > active_at
self.active_at = Time.current
@@ -32,22 +23,12 @@ class << self
# (level * (level - 1) / 2.to_f) * 100
# end
- def ban_all
- ban_list = Participation.joins(:chat, :user)
- .where(participations: { left: false })
- .where.not(chats: { casbanhammer_at: nil })
- .where.not(users: { casbanned_at: nil })
-
- ban_list.each(&:ban)
- ban_list
- end
-
def learn(message)
chat = Chat.find_by(telegram_id: message&.chat&.id)
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/user.rb b/app/models/user.rb
index 4696979..c3e9d4b 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -4,8 +4,6 @@ class User < ApplicationRecord
has_many :participations, dependent: :destroy
has_many :chats, through: :participations
- scope :casbanned, -> { where.not(casbanned_at: nil) }
-
def to_s
username || first_name || last_name
end
@@ -14,31 +12,10 @@ def to_link
"#{self}"
end
- def casban!
- update!(casbanned_at: Time.current)
- end
-
- def casbanned?
- casbanned_at.present?
- end
-
def self.learn(tg_user)
user = User.find_by(id: tg_user.id) || User.new(id: tg_user.id)
user.update(tg_user.to_h.slice(:username, :first_name, :last_name, :is_bot))
user.save!
user
end
-
- def update_casban
- return if casbanchecked_at.present? && casbanchecked_at < 1.week.since
-
- banned = CasService.banned?(id)
- return if banned.nil?
-
- self.casbanchecked_at = Time.current
- self.casbanned_at = banned ? Time.current : nil
-
- save!
- self
- 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.rb b/app/processors/message_processor.rb
index 0778cf7..b702165 100644
--- a/app/processors/message_processor.rb
+++ b/app/processors/message_processor.rb
@@ -1,11 +1,9 @@
# frozen_string_literal: true
module MessageProcessor
- AVAILABLE_PROCESSORS = %w[CasBanner
- Me
+ AVAILABLE_PROCESSORS = %w[Me
Say
BinaryDice
- CovidStats
CoolStory
Databank
Eightball
diff --git a/app/processors/message_processor/cas_banner.rb b/app/processors/message_processor/cas_banner.rb
deleted file mode 100644
index af7ad1e..0000000
--- a/app/processors/message_processor/cas_banner.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-# frozen_string_literal: true
-
-module MessageProcessor
- class CasBanner
- include Processor
- include CommandParameters
-
- def responds?
- super && command == 'cas'
- end
-
- def process!
- response = case first_parameter
- when 'enable', 'on'
- enable
- when 'disable', 'off'
- disable
- else
- show
- end
-
- { send_message: { chat_id: chat.telegram_id,
- reply_to_message_id: message.message_id,
- parse_mode: :markdown,
- text: response } }
- end
-
- private
-
- def enable
- chat.update!(casbanhammer_at: Time.current)
- ok
- end
-
- def disable
- chat.update!(casbanhammer_at: nil)
- ok
- end
-
- def show
- I18n.t('.cas_banner', active: I18n.t(chat.casbanhammer?.to_s),
- count: chat.participations.joins(:user).where.not(users: { casbanned_at: nil }).size,
- overall: User.casbanned.size)
- end
-
- def background_task
- user.update_casban
-
- new_chat_members.map { |m| User.learn(m).update_casban } if new_chat_members.present?
-
- Participation.ban_all
- end
- end
-end
diff --git a/app/processors/message_processor/covid_stats.rb b/app/processors/message_processor/covid_stats.rb
deleted file mode 100644
index 2c22500..0000000
--- a/app/processors/message_processor/covid_stats.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-# frozen_string_literal: true
-
-module MessageProcessor
- class CovidStats
- include Processor
- include CommandParameters
-
- def responds?
- super && command == 'covid_stats'
- end
-
- def process!
- response = case first_parameter
- when 'enable', 'on'
- enable
- when 'disable', 'off'
- disable
- when 'available'
- available_regions
- else
- show
- end
-
- { send_message: { chat_id: chat.telegram_id,
- reply_to_message_id: message.message_id,
- parse_mode: :html,
- text: response } }
- end
-
- private
-
- def available_regions
- list = I18n.t('covid_stat.regions').map do |key, name|
- I18n.t('covid_stat.region_item_html', key: key.to_s.rjust(4), name: name)
- end
- I18n.t('covid_stat.region_list_html', items: list.join("\n"))
- end
-
- def show
- region = (first_parameter || chat.covid_region || 'ALL').to_s.upcase
- return nok unless region.in? CovidStat.regions.keys
-
- CovidStat.day_stats(region: region, return_i18n: true)
- end
-
- def enable
- param = second_parameter.to_s.upcase
- param = 'ALL' if param.blank?
- return nok unless param.in? CovidStat.regions.keys
-
- chat.update!(covid_region: param)
- ok
- end
-
- def disable
- chat.update!(covid_region: nil)
- ok
- end
- 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/status.rb b/app/processors/message_processor/status.rb
index 65edf34..2efc510 100644
--- a/app/processors/message_processor/status.rb
+++ b/app/processors/message_processor/status.rb
@@ -23,7 +23,6 @@ def response
gab: chat.random,
pairs: chat.pairs.size,
databanks: I18n.t(chat.data_bank_ids.present?.to_s),
- cas_banner: I18n.t(chat.casbanhammer?.to_s),
winner: chat.winner || I18n.t('.winner.disabled'))
end
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/services/cas_service.rb b/app/services/cas_service.rb
deleted file mode 100644
index a04ddcb..0000000
--- a/app/services/cas_service.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-# frozen_string_literal: true
-
-module CasService
- class << self
- def banned?(telegram_id)
- body = Faraday.get(url(telegram_id)).body
- value = JSON.parse(body)
- ActiveModel::Type::Boolean.new.cast(value['ok'])
- rescue StandardError
- SentryService.capture_exception(exception)
- nil
- end
-
- private
-
- def url(telegram_id)
- "#{Rails.configuration.secrets[:cas_url]}/check?user_id=#{telegram_id}"
- end
- end
-end
diff --git a/app/services/stop_covid_service.rb b/app/services/stop_covid_service.rb
deleted file mode 100644
index 00acff0..0000000
--- a/app/services/stop_covid_service.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-# frozen_string_literal: true
-
-module StopCovidService
- class << self
- ALLOWED_PARAMS = %i[date sick healed died first second].freeze
-
- def get_data(region_id)
- body = Faraday.get(url(region_id)).body
- json = JSON.parse(body).map(&:symbolize_keys)
- json.map do |record|
- new_date = Date.parse(record[:date])
- record.slice(*ALLOWED_PARAMS).except(:date).merge(date: new_date)
- end
- end
-
- private
-
- def url(region_id)
- "#{Rails.configuration.secrets[:stop_covid_url]}/covid_data.json?do=region_stats&code=RU-#{region_id.upcase}"
- end
- end
-end
diff --git a/app/workers/covid_region_updater_worker.rb b/app/workers/covid_region_updater_worker.rb
deleted file mode 100644
index a74664c..0000000
--- a/app/workers/covid_region_updater_worker.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class CovidRegionUpdaterWorker
- include Sidekiq::Worker
-
- sidekiq_options queue: 'updating'
- sidekiq_options retry: false
-
- def perform(region_id)
- CovidStat.update(region_id)
- end
-end
diff --git a/app/workers/covid_sender_worker.rb b/app/workers/covid_sender_worker.rb
deleted file mode 100644
index 51b86ff..0000000
--- a/app/workers/covid_sender_worker.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-class CovidSenderWorker
- include Sidekiq::Worker
-
- sidekiq_options retry: false
-
- def perform
- dates = CovidStat.group(:region).maximum(:date)
- dates['ALL'] = dates.values.max
- Chat.active.where.not(covid_region: nil).each do |c|
- next if c.covid_last_notification.present? && c.covid_last_notification >= dates[c.covid_region]
-
- c.update!(covid_last_notification: dates[c.covid_region])
- parameters = { text: CovidStat.day_stats(region: c.covid_region, return_i18n: true),
- parse_mode: :html,
- chat_id: c.telegram_id }
- SendPayloadWorker.perform_async(:send_message, parameters)
- end
- end
-end
diff --git a/app/workers/covid_updater_worker.rb b/app/workers/covid_updater_worker.rb
deleted file mode 100644
index 5e14100..0000000
--- a/app/workers/covid_updater_worker.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# frozen_string_literal: true
-
-class CovidUpdaterWorker
- include Sidekiq::Worker
-
- sidekiq_options queue: 'updating'
- sidekiq_options retry: false
-
- def perform
- CovidStat.update_all if CovidStat.needs_update?
- end
-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 `