|
3 | 3 | module RuboCop
|
4 | 4 | module Cop
|
5 | 5 | module Style
|
6 |
| - # Use a consistent style for named format string tokens. |
| 6 | + # Use a consistent style for tokens within a format string. |
7 | 7 | #
|
8 |
| - # NOTE: `unannotated` style cop only works for strings |
9 |
| - # which are passed as arguments to those methods: |
10 |
| - # `printf`, `sprintf`, `format`, `%`. |
11 |
| - # The reason is that _unannotated_ format is very similar |
12 |
| - # to encoded URLs or Date/Time formatting strings. |
| 8 | + # All strings are evaluated. In some cases, this may be undesirable, |
| 9 | + # as they could be used as arguments to a method that does not consider |
| 10 | + # them to be tokens, but rather other identifiers or just part of the string. |
| 11 | + # In these cases, `AllowedMethods` or `AllowedPatterns` can be used to mark the |
| 12 | + # method as allowed, thereby avoiding an offense from the cop. |
13 | 13 | #
|
14 |
| - # This cop's allowed methods can be customized with `AllowedMethods`. |
15 | 14 | # By default, there are no allowed methods.
|
16 | 15 | #
|
| 16 | + # NOTE: Tokens in the `unannotated` style (eg. `%s`) are only considered if used |
| 17 | + # in the format string argument to the methods `printf`, `sprintf`, `format` and |
| 18 | + # `%`. This is done in order to prevent false positives, because this format is |
| 19 | + # very similar to encoded URLs or Date/Time formatting strings. |
| 20 | + # |
17 | 21 | # @example EnforcedStyle: annotated (default)
|
18 | 22 | #
|
19 | 23 | # # bad
|
|
0 commit comments