BSL204 — Invalid character¶
Summary¶
Invalid character
Identifiers¶
| Field | Value |
|---|---|
| Rule code | BSL204 |
| Compatible alias | InvalidCharacterInFile |
| Severity | WARNING |
| Enabled by default | Yes |
| Implemented | Yes |
| Tags | correctness, encoding |
Behavior¶
- The public identifier
BSL204and aliasInvalidCharacterInFileare stable. - The rule reports the cases documented on this page.
- Suppressions and project configuration are applied before publication.
- The rule requires neither an external analyzer nor network access.
Configuration and suppression¶
BSL### is the primary stable identifier. The compatible alias is accepted
in select, ignore, and compatible block suppression comments.
All three suppression families support both a current line and a range. When an opening comment follows code, it affects only that line. Use any one form:
noqa:
bsl-disable:
- compatible
BSLLSform:
When the same opening comment is on a line by itself, it starts a range. Close it with the matching marker from the same family:
// noqa: BSL204
// code without this diagnostic
// noqa-enable: BSL204
// bsl-disable: BSL204
// code without this diagnostic
// bsl-enable: BSL204
// BSLLS:InvalidCharacterInFile-off
// code without this diagnostic
// BSLLS:InvalidCharacterInFile-on
To disable the rule until the end of the file, omit the closing
noqa-enable, bsl-enable, or BSLLS:…-on marker.
Opening and closing markers must belong to the same family.
Description¶
In the texts of modules (including comments) it is not allowed to use inextricable spaces and the minus sign "-" in other encodings (short, long dash, soft hyphen, etc.).
Such characters often appear in the text of the modules when copying from office documents and lead to a number of difficulties in the development.
Example:
- the search for fragments of text that includes “wrong” minuses and spaces does not work
- hints of types of parameters of procedures and functions in the configurator and extended verification in 1C: EDT are incorrectly displayed
- specifying a “wrong” minus in expressions will result in a syntax error
Diagnostics detects the following invalid characters
- En Dash
- Figure Dash
- Em Dash
- Horizontal Bar
- "Wrong" Minus
- Soft Hyphen
- Non-breaking Space