Module: I18nLinter::Rules
- Defined in:
- lib/i18n_linter/rules.rb,
lib/i18n_linter/rules/puts.rb,
lib/i18n_linter/rules/query.rb,
lib/i18n_linter/rules/scope.rb,
lib/i18n_linter/rules/words.rb,
lib/i18n_linter/rules/logger.rb,
lib/i18n_linter/rules/reg_exp.rb,
lib/i18n_linter/rules/constant.rb,
lib/i18n_linter/rules/strftime.rb,
lib/i18n_linter/rules/mime_type.rb,
lib/i18n_linter/rules/class_name.rb,
lib/i18n_linter/rules/underscore.rb,
lib/i18n_linter/rules/http_headers.rb,
lib/i18n_linter/rules/middle_space.rb,
lib/i18n_linter/rules/environment_variable.rb
Defined Under Namespace
Classes: ClassName, Constant, EnvironmentVariable, HttpHeaders, Logger, MiddleSpace, MimeType, Puts, Query, RegExp, Scope, Strftime, Underscore, Words
Constant Summary
collapse
- POSITIVE_RULES =
%w[MiddleSpace Words].freeze
- NEGATIVE_RULES =
Rules that filter the strings found
%w[
ClassName Constant EnvironmentVariable HttpHeaders
Logger MimeType Puts Query RegExp Scope Strftime Underscore
].freeze
Class Method Summary
collapse
Class Method Details
.check_negative_rules(config, tokens) ⇒ Object
21
22
23
|
# File 'lib/i18n_linter/rules.rb', line 21
def check_negative_rules(config, tokens)
config.enabled_negative_rules.any? { |rule| Rules.check_rule(rule, tokens) }
end
|
.check_positive_rules(config, string) ⇒ Object
17
18
19
|
# File 'lib/i18n_linter/rules.rb', line 17
def check_positive_rules(config, string)
config.enabled_positive_rules.any? { |rule| Rules.check_rule(rule, string) }
end
|
.check_rule(rule, string_or_tokens) ⇒ Object
13
14
15
|
# File 'lib/i18n_linter/rules.rb', line 13
def check_rule(rule, string_or_tokens)
Kernel.const_get("I18nLinter::Rules::#{rule}").new.check(string_or_tokens)
end
|
.check_string_rules(config, string) ⇒ Object
25
26
27
|
# File 'lib/i18n_linter/rules.rb', line 25
def check_string_rules(config, string)
check_positive_rules(config, string)
end
|