Skip to content
Open
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
17 changes: 11 additions & 6 deletions content/docs/analyzers/LinterCop/LC0086.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,18 @@ Valid `PageStyle` values: `None`, `Standard`, `StandardAccent`, `Strong`, `Stron

### Exception

The rule suppresses the diagnostic when the string literal appears in a context where it represents data or user-facing text rather than a style value:

- **Caption properties**: `Caption = 'Standard'` is user-facing text
- **Unlocked labels**: `Label 'Unfavorable'` without `Locked = true` is translatable text
- **StyleExpr property values**: `StyleExpr = 'Standard'` already uses the string in the correct property
The rule applies one fixed set of contexts to every `PageStyle` value, so you can tell from the code alone whether a literal is reported. It does not report a string literal that represents data or user-facing text rather than a style value:

- **Method and attribute arguments**: any call, built-in or your own, such as `SetRange(Code, 'None')`, `StrSubstNo('%1', 'Standard')` or `Assert.AreEqual('Strong', ...)`, and attribute arguments such as an event name in `[EventSubscriber(...)]`
- **Comparisons**: operands of `=`, `<>`, `<`, `<=`, `>`, `>=` and elements of an `in [...]` list, also in parentheses, as part of a range, or as a branch of a `? :` expression
- **Case labels**: `'None':` or `'Attention'..'Unfavorable':` (a literal in the statement after the label is still reported)
- **Property values**: `Caption = 'Standard'`, `Description = 'Standard'`, and also `StyleExpr = 'Standard'`, which already uses the string in the correct property
- **Unlocked labels and report labels**: `Label 'Unfavorable'` or `StandardType = 'Standard';` in a report's `labels` section without `Locked = true` is translatable text
- **Multilanguage text**: `TextConst ENU = 'Standard'` and the legacy `label(StandardType; ENU = 'Standard')` report label, which have no `Locked` option
- **Enum and enum value definitions**: string literals in enum contexts are identifiers
- **Table field assignments** and **data-access method arguments**: writes to data on `Record`, `RecordRef`, `FieldRef`, `Query`, and similar types
- **Table field assignments**: `Customer.Name := 'Standard'` writes data

Assignments to other variables (including array elements and both branches of a `? :` expression), `exit('...')`, and locked labels or report labels are reported. A style value passed to a helper method as an argument, such as `SetStyle('Unfavorable')`, is not reported.

In rare cases, a PascalCase string literal genuinely represents data — for example, a locked label `'Standard'` used as a configuration value. Use a pragma directive to suppress the diagnostic:

Expand Down