Linting¶
The [lint] section controls which diagnostics ubCode reports.
Use it to suppress noisy warnings globally,
override suppression for specific codes in the LSP,
or target ignores to particular files or message patterns.
Minimal example¶
[lint]
ignore = ["block.title_line"]
[lint.per-file-ignores]
"tests/**/*.rst" = ["needs.dead_link"]
Core options¶
- ignore
Type:
array(default:[])List of linting error codes to ignore globally across the project.
- lsp_select
Type:
array(default:[])List of linting codes to specifically enable in Language Server Protocol (LSP) file diagnostics. This setting overrides the ignore list, allowing you to see specific errors in your editor even if they’re globally ignored.
[lint]
# List of linting codes to ignore
ignore = ["block.title_line"]
# A list of linting codes to select in LSP file diagnostics
# This overrides the ignore list.
lsp_select = ["block.title_line"]
per-file-ignores¶
Type: object (default: {})
A mapping of glob patterns to lists of diagnostic codes. When a diagnostic’s source file matches a pattern, and the diagnostic code is in the associated list, the diagnostic is suppressed.
Paths are specified in POSIX format (forward slashes)
and are relative to the configuration file directory,
ensuring cross-platform compatibility.
During configuration resolution,
patterns are absolutised relative to the directory of the config file
that defines them.
This means patterns from an extend-ed parent config
are correctly resolved relative to the parent’s location,
not the child’s.
Standard glob syntax is supported (*, **, ?, [...]).
Invalid glob patterns are reported as configuration diagnostics and skipped.
A diagnostic with multiple file-based source locations is suppressed if any of its file locations matches at least one rule for the code.
[lint.per-file-ignores]
# Ignore dead links and field validation errors in test fixtures
"tests/**/*.rst" = ["needs.dead_link", "needs.invalid_field_value"]
# Ignore schema violations in legacy documentation
"legacy/**" = ["needs.schema_definition_violation"]
# Ignore duplicate needs in a specific file
"docs/generated/index.rst" = ["needs.duplicate"]
message-ignores¶
Type: array of objects (default: [])
A list of rules for suppressing diagnostics whose message contains a given substring. Each rule is an object with:
codes(optional): a list of diagnostic codes this rule applies to. If omitted or empty, the rule applies to all diagnostic codes.contains: a case-insensitive substring to match against the diagnostic message. If omitted or empty, the rule matches all messages for the specified codes (or all diagnostics ifcodesis also omitted).
This is useful for suppressing specific classes of validation errors, for example diagnostics about a known deprecated field.
# Suppress all diagnostics mentioning "deprecated_field"
[[lint.message-ignores]]
contains = "deprecated_field"
# Suppress only field validation errors mentioning a specific pattern
[[lint.message-ignores]]
codes = ["needs.invalid_field_value"]
contains = "legacy_option"
Note
When using extend to inherit from a parent config,
per-file-ignores and message-ignores use replace semantics:
if the child config sets the field,
it completely replaces the parent’s value (rather than merging additively).
This is consistent with the behaviour of ignore and lsp_select.
To combine parent and child rules,
repeat the parent’s rules in the child config.
Deprecated since version 0.18.0: The rst_lint configuration section has been deprecated.
Use lint instead for all linting configuration.