Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ast_matchers for default_i18n_subject matcher in config template #539

Merged
merged 2 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require 'i18n/tasks/scanners/ast_matchers/base_matcher'
require 'i18n/tasks/scanners/results/occurrence'

module I18n::Tasks::Scanners::AstMatchers
Expand Down
1 change: 1 addition & 0 deletions lib/i18n/tasks/scanners/ruby_ast_scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'i18n/tasks/scanners/file_scanner'
require 'i18n/tasks/scanners/relative_keys'
require 'i18n/tasks/scanners/ruby_ast_call_finder'
require 'i18n/tasks/scanners/ast_matchers/default_i18n_subject_matcher'
require 'i18n/tasks/scanners/ast_matchers/message_receivers_matcher'
require 'i18n/tasks/scanners/ast_matchers/rails_model_matcher'
require 'parser/current'
Expand Down
1 change: 0 additions & 1 deletion spec/used_keys_erb_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require 'spec_helper'
require 'i18n/tasks/scanners/ast_matchers/rails_model_matcher'

RSpec.describe 'UsedKeysErb' do
let!(:task) { I18n::Tasks::BaseTask.new }
Expand Down
2 changes: 0 additions & 2 deletions spec/used_keys_ruby_spec.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

require 'spec_helper'
require 'i18n/tasks/scanners/ast_matchers/rails_model_matcher'
require 'i18n/tasks/scanners/ast_matchers/default_i18n_subject_matcher'

RSpec.describe 'UsedKeysRuby' do
let!(:task) { I18n::Tasks::BaseTask.new }
Expand Down
5 changes: 3 additions & 2 deletions templates/config/i18n-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,9 @@ search:
## Matches ActionMailer's default_i18n_subject method
##
## To implement your own, please see `I18n::Tasks::Scanners::AstMatchers::BaseMatcher`.
# <%# I18n::Tasks.add_ast_matcher('I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher') %>
# <%# I18n::Tasks.add_ast_matcher('I18n::Tasks::Scanners::AstMatchers::DefaultI18nSubjectMatcher') %>
# ast_matchers:
# - 'I18n::Tasks::Scanners::AstMatchers::RailsModelMatcher'
# - 'I18n::Tasks::Scanners::AstMatchers::DefaultI18nSubjectMatcher'

## Multiple scanners can be used. Their results are merged.
## The options specified above are passed down to each scanner. Per-scanner options can be specified as well.
Expand Down