Fix Rails/RakeEnvironment
cop (#28782)
This commit is contained in:
parent
30b193b856
commit
127503eb2c
10
.rubocop.yml
10
.rubocop.yml
@ -109,6 +109,16 @@ Rails/LexicallyScopedActionFilter:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/auth/*'
|
- 'app/controllers/auth/*'
|
||||||
|
|
||||||
|
# Reason: These tasks are doing local work which do not need full env loaded
|
||||||
|
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsrakeenvironment
|
||||||
|
Rails/RakeEnvironment:
|
||||||
|
Exclude:
|
||||||
|
- 'lib/tasks/auto_annotate_models.rake'
|
||||||
|
- 'lib/tasks/emojis.rake'
|
||||||
|
- 'lib/tasks/mastodon.rake'
|
||||||
|
- 'lib/tasks/repo.rake'
|
||||||
|
- 'lib/tasks/statistics.rake'
|
||||||
|
|
||||||
# Reason: There are appropriate times to use these features
|
# Reason: There are appropriate times to use these features
|
||||||
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsskipsmodelvalidations
|
# https://docs.rubocop.org/rubocop-rails/cops_rails.html#railsskipsmodelvalidations
|
||||||
Rails/SkipsModelValidations:
|
Rails/SkipsModelValidations:
|
||||||
|
@ -61,18 +61,6 @@ Rails/OutputSafety:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'config/initializers/simple_form.rb'
|
- 'config/initializers/simple_form.rb'
|
||||||
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: Include.
|
|
||||||
# Include: **/Rakefile, **/*.rake
|
|
||||||
Rails/RakeEnvironment:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/tasks/auto_annotate_models.rake'
|
|
||||||
- 'lib/tasks/db.rake'
|
|
||||||
- 'lib/tasks/emojis.rake'
|
|
||||||
- 'lib/tasks/mastodon.rake'
|
|
||||||
- 'lib/tasks/repo.rake'
|
|
||||||
- 'lib/tasks/statistics.rake'
|
|
||||||
|
|
||||||
# Configuration parameters: Include.
|
# Configuration parameters: Include.
|
||||||
# Include: app/models/**/*.rb
|
# Include: app/models/**/*.rb
|
||||||
Rails/UniqueValidationWithoutIndex:
|
Rails/UniqueValidationWithoutIndex:
|
||||||
|
@ -15,7 +15,7 @@ namespace :db do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
task :pre_migration_check do
|
task pre_migration_check: :environment do
|
||||||
version = ActiveRecord::Base.connection.select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i
|
version = ActiveRecord::Base.connection.select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i
|
||||||
abort 'This version of Mastodon requires PostgreSQL 9.5 or newer. Please update PostgreSQL before updating Mastodon' if version < 90_500
|
abort 'This version of Mastodon requires PostgreSQL 9.5 or newer. Please update PostgreSQL before updating Mastodon' if version < 90_500
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user