Replace deprecated `STATS_DIRECTORIES` with `Rails::CodeStatistics.register_directory` approach (#33445)

This commit is contained in:
Matt Jankowski 2025-01-03 16:52:16 -05:00 committed by GitHub
parent 02fe176fd4
commit af7d6e59af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 21 deletions

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
[
%w(AppLibs app/lib),
%w(Policies app/policies),
%w(Presenters app/presenters),
%w(Serializers app/serializers),
%w(Services app/services),
%w(Validators app/validators),
%w(Workers app/workers),
].each do |name, directory|
Rails::CodeStatistics.register_directory(name.titleize, directory)
end

View File

@ -1,21 +0,0 @@
# frozen_string_literal: true
task stats: 'mastodon:stats'
namespace :mastodon do
desc 'Report code statistics (KLOCs, etc)'
task :stats do
require 'rails/code_statistics'
[
['App Libraries', 'app/lib'],
%w(Presenters app/presenters),
%w(Policies app/policies),
%w(Serializers app/serializers),
%w(Services app/services),
%w(Validators app/validators),
%w(Workers app/workers),
].each do |name, dir|
STATS_DIRECTORIES << [name, dir]
end
end
end