Class: RuboCop::Cop::LcpRuby::NoHardcodedI18nString
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::LcpRuby::NoHardcodedI18nString
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/lcp_ruby/no_hardcoded_i18n_string.rb
Overview
Flags hardcoded user-visible strings that should go through ‘I18n.t(“lcp_ruby.<ns>.<key>”, default: “…”)` per CLAUDE.md’s i18n principle. Only the call shapes enumerated below are checked —this is intentionally narrower than a repo-wide cleanup.
Also flags ‘I18n.t(“lcp_ruby.…”)` / `t(“lcp_ruby.…”)` calls that sit inside one of those user-visible shapes but omit `default:`.
Constant Summary collapse
- MSG =
"Hardcoded user-visible string %<kind>s. Wrap in " \ 'I18n.t("lcp_ruby.TODO_KEY", default: "...") per CLAUDE.md. ' \ "Set TODO_KEY to a real namespace path before committing."
- MSG_NO_DEFAULT =
'I18n.t("%<key>s") %<kind>s without `default:`. ' \ "Per CLAUDE.md every user-visible translation lookup must " \ 'include `default: "Humanized fallback"`.'
- SNAKE_CASE =
/\A[a-z][a-z0-9_]*\z/.freeze
- RESULT_RECEIVER_RE =
/Result\z/.freeze
Instance Method Summary collapse
-
#on_send(node) ⇒ Object
Kick in for: redirect_to(_, notice: “x”), render plain: “x”, flash = “x”, pluralize(n, “noun”), and similar.
Instance Method Details
#on_send(node) ⇒ Object
Kick in for: redirect_to(_, notice: “x”), render plain: “x”, flash = “x”, pluralize(n, “noun”), and similar.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rubocop/cop/lcp_ruby/no_hardcoded_i18n_string.rb', line 32 def on_send(node) check_redirect(node) check_render(node) check_pluralize(node) (node) check_failure_call(node) (node) check_form_helper_placeholder(node) check_flash_indexer_assignment(node) end |