Linting¶
Every key, with its type and default: [lint] and [rst_lint].
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"]
Code matching and .* wildcards¶
Everywhere a list of diagnostic codes is configured —
ignore, lsp_select, the code lists of per-file-ignores,
and the codes scope of message-ignores —
an entry matches a diagnostic in one of two ways:
Exactly:
"needs.dead_link"matches only theneeds.dead_linkcode.As a family wildcard: a trailing
.*matches a whole dot-namespaced family —"toctree.*"matches everytoctree.<subcode>diagnostic, and also the bare family code itself (so"config.*"covers both the fine-grainedconfig.<subcode>diagnostics and the plainconfigones).
[lint]
# Suppress the whole std family — the dangling references
# (std.ref, std.doc, std.term) and the project-wide duplicates
# (std.duplicate_target, std.duplicate_label, std.duplicate_term)
# — plus one exact code.
ignore = ["std.*", "block.title_line"]
No other glob positions are supported:
entries like "*.ref", "con*", or a bare "*"
are treated as plain literals and match no real code.
A bare family name is not an umbrella:
ignore = ["config"] matches only a diagnostic whose code is exactly
config — it does not reach config.unknown_extension and its
siblings. To suppress a whole family, use the .* wildcard.
Configuration diagnostics (config and config.*)¶
Problems found while resolving ubproject.toml itself are reported
against the configuration file. The checks with a fine-grained code are
individually suppressible:
config.unknown_extension— a[parse].extensionsentry that looks like a typo of a known port name.config.unknown_extension_option— a key other thanactiveinside a[parse.extensions]entry table. The entry still switches its port; the key itself is ignored.config.extension_always_on— a[parse].extensionsentry switching off something built into ubCode (sphinx_needs), which stays active.config.extension_unsupported— a[parse].extensionsentry switching on an extension ubCode does not support (thesphinx.ext.autodocfamily,sphinx.ext.graphviz); it runs only undersphinx-build.config.extension_unimplemented— a[parse.parsers.<name>].extensionsentry naming a MyST extension ubCode has not implemented yet; the entry is ignored and the syntax renders as written.config.unknown_md_extension— a[parse.parsers.<name>].extensionsentry naming something MyST-Parser does not recognise either. Deliberately a separate code fromconfig.unknown_extensionabove, which is the Sphinx-port typo check, so oneignoreentry cannot silence both.config.extension_renamed— a[parse].extensionsentry spelling an extension by its old name (sphinxcontrib.test_reports), which is read as the current one (sphinx_test_reports). Information, not a warning: the entry works. A separate code fromconfig.extension_deprecatedbelow, which is the MyST vocabulary’s.config.extension_deprecated— a[parse.parsers.<name>].extensionsentry naming a MyST extension whose upstream has deprecated it (attrs_image, superseded byattrs_inline). The extension still works; the message names the replacement. Reported once per project, at configuration load, assphinx-buildreports it once per build.config.invalid_extlink_template— a[parse.extlinks]entry with an invalid%stemplate.config.extlink_shadows_builtin— a[parse.extlinks]role name that would shadow a built-in role.config.extlinks_data_inert— a populated[parse.extlinks]table whose port is switched off in[parse].extensions, so none of its roles is registered. Most often an inherited= falsemeeting a child’s own table.config.unknown_default_role— a[parse].default_rolenaming an unknown role.config.legacy_anchor_redirects_own_style— a [build.html] legacy_anchor_redirects entry naming the project’s own[parse] id_style, which generates nothing.config.conflicting_content_model— a[parse.extend_directives]entry named like a built-in directive with a different body mode; the entry is not used. (A[[needs.types]]entry named like a built-in takes the name instead — the next code.)config.conflicting_directive_registration— a directive name claimed by two sources, reported once for each entry the rule overrides or leaves unused. A directive name has one owner, by rank: a switched-on sphinx-test-reports directive over a[[needs.types]]entry; a[[needs.types]]entry over a built-in directive and over a[parse.extend_directives]entry; a[parse.extend_directives]entry for a name no built-in holds; and, last, a switched-off sphinx-test-reports directive, which keeps only a name nothing else claims. Two entries of one kind whose names differ only in case are one name, and are reported too. So is a[parse.extend_directives]entry namedneed:<x>(in any case) that no need type has: theneed:prefix is kept for need types, so the entry is not used. The message states which entry is used — and, for a need type named like a domain directive ubCode knows (thestddomain’s, such asenvvarandoption, andclass), that a Sphinx build keeps the domain’s directive. A name ubCode does not model (function,module, …) is simply the type’s here, with no finding, where Sphinx’spydomain keeps it. A directive a newer ubCode release added to an extension is not a built-in for this rule: the project’s entry keeps the name. When[parse] extensionsenables that extension explicitly, each such entry is reported under this code, as a warning; when the extension is on only by default, under the next code, as information. A need type named like the directive of any extension port is reported the same way, and not at all while that port is switched off. A need type whosedirective_nameis set (for the type or under[needs]) is not reported: the setting says the clash is intended (When a type’s directive is another directive’s name).config.port_directive_name_kept— information, not a warning: a need type,[parse.directive_presets]entry,[parse.extend_directives]entry,[parse.directive_templates]entry or[parse] ignore_directivesentry named like a directive a newer ubCode release added to an extension that is on by default and that[parse] extensionsdoes not name (sphinx-design 0.8.0’saccordion,aside,stepsandstep, and sphinx-subfigure’ssubfigure). The entry keeps the name, as before the release, and that extension’s directive is not available in the project. To use it, rename the entry, or, for anignore_directivesentry, remove it from the list (Accordions, asides and steps, Subfigures). A need type named like the directive of any extension that is on by default (todo, sphinx-design’scard,video, …) is reported here too; set itsdirective_nameto"claim"to keep the name without a finding, or to"yield"to have both, writing the need asneed:<type>(When a type’s directive is another directive’s name).config.string_link_incomplete— a [needs.string_links] rule missing one of its four required keys.config.string_link_regex_invalid— a string-linkregexthat does not compile (including one using look-ahead, look-behind or a backreference, which this engine does not support).config.string_link_template_invalid— a string-linklink_urlorlink_namethat is not a valid template.config.string_link_unknown_field— a string-linkoptionsentry naming a field the project never declared.config.field_shadowed_by_identity— a project declares a field or link namedcontent, on any of [needs.fields], [needs.links],extra_optionsorextra_links.contentis the need’s own body, which no declaration can shadow. The declaration is kept, so nothing that renders today stops rendering — the option can still be set on a directive, and a link’s targets are still validated — but filters, tables, variant conditions, report templates andneeds.jsonall answer the body for that name, so the declared value is invisible to every one of them. Rename the field or link;ignoresilences the warning while you migrate. (idandtype, the other two un-shadowable names, are refused outright and report under the plainconfigcode.)config.need_type— a [needs] types entry that cannot be used as written: an entry that is not a table, or that names no directive; a[needs.types.<directive>]table whosedirectivediffers from its key (the key is used); atitleorprefixthat is missing or not a string (the type is not declared); acolororstylethat is not a string (its default is used); a key a need type does not have (it is ignored); aninheritsthat is not a non-empty string, or afieldsorlinksthat is not a table (it is ignored); a declaration infieldsorlinksthat is not a table (it is ignored), or a key of one that it does not take or that is not of its shape (the key is ignored); alinksdeclaration setting a link type’s display keys (incoming,copy,style, …), which are the link type’s own on every need type (the keys are ignored, the rest of it used); afieldsdeclaration of a field ubCode does not apply yet (constraints,template,pre_template,post_template, a field of Sphinx-Needs’ GitHub services: it is ignored); a directive the array declares more than once (one finding naming every entry; the last is used); and atypesvalue that is neither an array nor a table (no type is declared). The configuration still loads: see What is reported.config.type_inherits— a need type’sinheritsthat names no need type, or is on a cycle (every type on the cycle is reported): it is ignored, and the type has no parent. See Fields per need type.config.type_conflict— a need type’s declaration of a field or link type that cannot be applied: it names no field of its table (a link type or a link type’s back links underfields, a field or a link type’s back links underlinks, a link type nothing declares; underback_links, a name that is no link type), declares a field need types declare alone with another type, items’ type or derivation than the one agreed (or a name no need type gives a type), changes the field’s type, sets a value that cannot be used (of another type, a default oftitle), holds aschemakey the field’s type does not take (a misspelt keyword,minimumon a string, aformatthat is none ofdate-time,date,time,duration,email,uri,uuid, a link type’sminContainswithoutcontains), or sets adefault,predicatesor an addedenumon a derived field. The declaration is ignored as a whole.config.type_widening— a need type’s declaration that widens the declaration before it (the field’s own, or an ancestor’s): a schema keyword relaxed,nullableturned on, or a default (its own, or the one it keeps) that is not valid against its narrowed schema. One finding per reason; the declaration is ignored as a whole, and the type keeps the one before it.config.type_near_name— a field or link type need types declare alone whose name is close to a core field an author sets, a declared field or a link type (aslbesideasil): likely misspelt, it is declared all the same. See Fields per need type.config.field_narrowing— a[needs.fields.<name>]entry specializing a core field (status,tags, …) that does not narrow it: aschemakeyword that relaxes the core field’s (anenumvalue it does not have, a lowerminimum, anotherpattern), aschemaof anothertype,nullable = trueon a field that is not nullable, or aparse_variants/parse_dynamic_functionsthe field does not allow. One finding per reason. Nothing of it is applied: the field keeps the core field’s schema and type (and itsdefaultandpredicatesare read against them), where Sphinx-Needs stops the build.config.derive_invalid— a derived field’sderiverule that cannot be read: aderivethat is not a table, a missing or unknownkind, an unknown role or one the kind does not take, a missing role, a role whose value has the wrong type, a value the field’sschemacannot hold, a filter that is not portable, anovernaming no link type, two rules reading each other’s values, or a rule on a core field; adefaultorpredicatesentry beside a rule;copy = trueon a derived link type, and a link type copied (copy = true) into a derivedlinks. One finding per rule, at its key, naming the kind and the role. The field stays derived and holds its empty value (a rule on a core field is ignored instead), and a key beside a readable rule is ignored.config.derive_sphinx_minimum— the project declares a derived field, which sphinx-needs reads only from the release the notice names: the highest one the project’s rules need (joinorunion: 9.1.0, any other rule: 9.0.0); an earlier sphinx-needs ignoresderivesilently, and 9.0.0 refuses ajoinor aunion. Reported once per project, at the first rule declaring ajoin, else at the first rule of the kindunion, else at the rule of the first derived field by name (or link type, when no field has one). Graded info, not warning, for the reasonconfig.variant_sources_sphinx_unsupportedis: ubCode cannot see which sphinx-needs a project builds with, and a warning would failubc checkon a correctly configured project.ignoresilences it once you have checked.config.schema_unknown_key— a key in a schemas.json rule that neither ubCode nor sphinx-needs accepts, such asselctforselect,propertesforproperties, or a JSON-Schema keyword the rule grammar has no place for. Such a key used to be ignored, which silently changed what the rule meant: a misspelledselectleft the rule with no filter, so it applied to every need, and a misspelled key insidevalidate.localproduced a rule that validated nothing at all. The message names the offending key, the rule and the keys accepted at that position. No rule from the file is applied while any such key remains, which is what sphinx-needs does too — it refuses to build at all.config.schema_missing_validate— a schemas.json rule with novalidatemember.validateis what says what to check, so such a rule enforces nothing at all, which used to happen silently. sphinx-needs requires the member outright. A rule whosevalidateis present but empty is not reported — it asks for nothing and gets nothing, which is a rule doing what it says. No rule from the file is applied while the member is absent.config.schema_invalid_value— a key in a schemas.json rule that both engines accept, whose value sphinx-needs constrains and ubCode found wrong: atypethat is not"object"at aselect, avalidate.localor anallOfelement, or not"array"on a network link block; arequiredthat is not an array of strings; anunevaluatedPropertiesthat is not a boolean; or a network link block that cannot be read at all (not an object, acontainsoritemsthat is not an object, aminContainsormaxContainsthat is not an integer — any integer is accepted, whatever its sign or size, because that is all sphinx-needs requires, and a negative bound is applied when the rule runs rather than refused when it loads). The message names the key, the rule, the value found and the value expected. All fourtypepositions used to be accepted silently. In aselector avalidate.localubCode ignores that value, so the check is for parity and clarity; inside anallOfelement it is compiled verbatim, which is the costly case —"type": "string"makes the element match no need, so the rule enforces nothing.requiredandunevaluatedPropertiesused to be warnings whose constraint was then dropped, so the rule ran without it, and an unreadable network link block was dropped whole in silence. No rule from the file is applied while any such value remains; measured at sphinx-needs 8.4.0,sphinx-buildaborts on each of the values listed here, and this code fires only where it does. Fix the value rather than ignoring the code:ignoresilences the report but the file stays refused, so no rule from it is applied andubc checkthen exits 0 on a project whose schema validation is switched off.config.schema_sphinx_needs_incompatible— a schemas.json construct ubCode honours but sphinx-needs rejects, sosphinx-buildfails on a file ubCode is happy with. In practice this is an extra keyword inside anallOfelement, such as anot. The rule keeps working; onlyignoreit if the project never builds with sphinx-needs.config.codelinks_removed_key— a codelinks project’sanalysetable still setsget_rst = false, the removed marked-RST key (see analyse). It asks for nothing; delete the line, or ignore the code while the file is shared with tools that still read it. Any otherget_rstvalue, and an[analyse.marked_rst]table, are refused and that codelinks project is skipped; the refusals carry no code of their own, so a listed code cannot single them out — but theconfigwildcard hides every configuration diagnostic, the fatal ones included (a known limitation).config.codelinks_coverage_unknown_project,config.codelinks_coverage_invalid_glob,config.codelinks_coverage_invalid_regexandconfig.codelinks_coverage_empty_marker— a [codelinks_coverage] entry that cannot be used: aprojectsname with no[codelinks.projects]table, anexcludeglob or anexclude_namesregular expression that does not compile, or a blankjustification_markersentry. The entry is ignored and the rest of the list kept.config.codelinks_coverage_empty_list— an emptyprojectsorkindslist in[codelinks_coverage], which would count nothing. It is read as unset: every codelinks project, or every unit kind.config.codelinks_coverage_invalid_rust_value— a[codelinks_coverage.rust]value that cannot be used: an emptytarget(the evaluation is then off) orprofile(releaseis used), afeaturesentry that is neitherfeatnorpkg/feat, or acfgsentry that is neithernamenorname="value"; the entry is ignored.config.codelinks_coverage_rust_without_target— a[codelinks_coverage.rust]table that sets keys but notarget, so the Rustcfgevaluation is off and its keys do nothing (see Count the Rust code of one build configuration).config.codelinks_coverage_unknown_field— a[codelinks_coverage] symbol_fieldsname that is not a custom need field holding a string or an array of strings: a core field, a link type, a field no table declares, or one of another type. The name is ignored and the rest of the list kept.config.value_below_minimum— a count below the minimum the configuration schema publishes for it, which an editor using the schema flags as you type: [format_rst]transition_lengthbelow 4 (a shorter line of punctuation is not a transition), one of its indents (literal_indent,blockquote_indent,directive_indent,substitution_indent,definition_list_indent,field_list_indent),simple_table_spaceorparagraph_line_lengthbelow 1, and[needs] id_lengthbelow 1. The value is still used as written; the message names the key, the value, the minimum and what the value does — the formatter refuses a file the setting would change the meaning of,paragraph_line_length = 0wraps after every word as 1 does, andid_length = 0gives every need of a type without an explicit id the same id.config.mount_invalid— a [[source.mounts]] entry whosemount_at,attach_toorentry_docis not a relative document name, or whosefileslist is empty. The mount is dropped.config.mount_unknown_key— a key on a mount entry that ubCode does not model. The key is ignored and the rest of the mount is honoured, so oneubproject.tomlcan be shared with sphinx-mounts.config.mount_at_root— a mount with nomount_at, so it is mounted at the document root where any file it contributes can take the name of a host document.config.mount_dead_option— a mount key its own mode never reads:includeorexcludeon afilesmount (which has no walk to filter), orattach_eachon adirmount, withoutattach_to, or beside a non-defaultentry_doc.config.mount_missing— a declared mount root that is not on disk. The mount contributes nothing this run and the pages it contributed on an earlier run are kept rather than reported as deleted.config.mount_attach— a mount whoseattach_torequest could not be honoured: the host document does not exist,toctree_indexis past the end of it, or the mount produced no document to attach. Not reported for a mount this variant gates off, which has nothing to attach by design.config.mount_gated— a mount whoseifgates it off for this variant, so it contributes no documents. Graded info, not warning: gating is what you asked for, and grading it a warning would failubc checkon every build of every variant that gates anything. It is reported at all — and reported even when nothing in the project references the bundle — because a gated mount is otherwise a silent absence of a whole tree that may live in another repository.config.mount_gated_contested— a gated mount that is not credited with the documents it removed, because at least one of them carries a name the build already uses. Toctree entries naming its pages then reporttoctree.nonexisting_documentrather than the gate. Also graded info: it explains a warning that fires elsewhere rather than being one.config.mount_invalid_condition— a mount whoseifis not a valid condition. The mount is gated off, in every variant, until the condition is rewritten.config.mount_condition_unevaluable— a mount whoseifcould not be evaluated against the variant data, an unknownvar.*key being the common cause. The mount is gated off.config.mount_excludes_root— a mount this variant gates off is the only root supplying[project] root_doc. This one refuses the whole configuration rather than reporting, soignoredoes not reach it: nothing resolves. The same posture asconfig.variant_source_excludes_rootbelow, and for the same reason.config.variant_sources_sphinx_unsupported— a project declares a variant-gating key: [[source.variant_sources]] rules, orifon a [[source.mounts]] entry.sphinx-buildreads either one only through sphinx-mounts at a release that supports it: without that, the two tools see different document sets. Graded info, not warning: it fires on every project that declares either key — ubCode cannot see what is installed on the Sphinx side, so it cannot tell you which case you are in — and grading it a warning would failubc checkon a correctly configured project.ignoresilences it once you have read it.config.variant_source_unknown_key— a key on avariant_sourcesrule that ubCode does not model. Ignored, and the rest of the rule honoured, for the same shared-ubproject.tomlreason asconfig.mount_unknown_key.config.variant_source_invalid— avariant_sourcesrule with an emptyfileslist. The rule is dropped, which is safe: it selected nothing.config.variant_source_invalid_condition— a rule whoseifis not a valid rule condition, or cannot be evaluated against the current variant data (an unknownvar.*key is the usual cause). The rule’s files are excluded — warn-and-exclude, the same contract theifdirective has. Silencing this code does not put the files back; it only hides the reason they are gone.config.variant_data_location— both the shared [variants] table and the legacy[needs] variant_data/variant_data_filekeys set the variant data.[variants]is read whole, and each[needs]key it ignores is reported at that key; the ignored data file is not opened. Remove the[needs]keys — here, or in a configuration this one extends. While a shared base is still on[needs], migrate it, or add this code to the child’signore(which replaces an inherited list — repeat the base’s entries).config.variants_unknown_key— a key under[variants]other thandataanddata_file. Ignored, and the rest of the table read, so oneubproject.tomlcan serve tool versions that read more keys.config.variant_data_invalid— the variant data cannot be used as written: an emptydata_file(orvariant_data_file), a data file that is missing, unreadable, not JSON, or not one object of variant values (a JSONnull, an array of arrays or of objects, a mixed-type array), or a mixed-type array or TOML date-time in the inline table. Reported at the key it concerns (variants.data/variants.data_file, orneeds.variant_data/needs.variant_data_fileon a project still on[needs]). It is a refusal, graded a warning, soubc checkandubc build htmlexit non-zero: fix the data rather than ignore the code. These findings used to report under the plainconfigcode, so a bare"config"entry inignore(or in aper-file-ignoresormessage-ignorescode list) silenced them; it no longer does. To keep them silent, name this code (or"config.*").config.test_reports_unknown_key— a key under [test_reports],[test_reports.build]or[test_reports.build.needs]that ubCode does not read: one finding per table, naming every such key and the supported ones. Ignored, and the rest of the table read, so aubproject.tomlwritten for a newer sphinx-test-reports still loads.config.test_reports_type_declared— a need type[test_reports]would add (testcaseand its siblings) is already a need type of the project that does not narrow it: one of the default types (when the project declares none, or a bare entry names a default type), or another of the section’s types of the same name; and its title, prefix, color or style differs from the section’s. The existing type is used unchanged; the message names both values. A[needs.types.<type>]entry naming the section’s type narrows it instead, with no finding.config.test_reports_link_target_undeclared— aproperty_link_types(orbuild.needs.link_properties) target that is neitherlinksnor a declared link type. Its values are not linked; declare it under[needs.links].config.test_reports_link_properties_differ— bothproperty_link_typesand its deprecated aliasbuild.needs.link_propertiesare set, and they differ.property_link_typesis used.config.test_reports_rename_unsupported— afile,suiteorcaseentry renames its directive. Not supported yet: the directive keeps its default name.config.test_reports_url_pattern—[test_reports.build.needs] url_patternis not a usable source-link pattern (an unknown or positional placeholder, unbalanced braces). The converter refuses it; ubCode reports it, since the build itself makes no source link.config.test_reports_field_type_mismatch— the project declares one of the fields[test_reports]adds with a type the test-report values may not fit, or uses its name for a link type (then the field is not added). The declaration is kept. Not reported for a number (time) or a number or an integer (the source-line field,case_line): their values are numeric strings, which convert.config.test_reports_switched_off—"sphinx_test_reports" = false(or{ active = false }) in[parse.extensions]: the extension’s need types and fields are not added and its directives render as placeholders, unless a need type of the same name owns them. Information, reported once, with or without a[test_reports]section.config.test_reports_extra_option_reserved— anextra_optionsname that cannot be a field, as sphinx-test-reports refuses it: a field a test-report directive sets itself (result,cases,title, …), the fieldfile_option,source_file_optionorsource_line_optionnames, a core field of Sphinx-Needs that no option can set (docname,lineno, …), an empty name or a link type; andvaror a core field that is not a string, such ashide. The name is ignored: it is no field, and, unless a directive has it as an option of its own anyway (status,tags, …), no option of the test-report directives, so a directive that writes it is refused (block.directive_unknown_option) and makes no need (the list).
Two variant_sources problems are hard configuration errors rather than
lint findings, so ignore does not reach them — nothing resolves, so nothing
is linted:
config.variant_source_invalid_glob— a rule glob using{a,b}alternation or climbing out of the project with... Refused rather than skipped: skipping the rule would leave every file it names in the build, including the files its other patterns name.config.variant_source_excludes_root— a rule that is false for the current variant and would remove[project] root_doc. The message names the pattern to narrow.
All other configuration warnings
(for example an unknown needs.global_options key)
report under the plain config code.
[lint]
# Suppress just the typo check…
ignore = ["config.unknown_extension"]
# …or the whole configuration channel:
# ignore = ["config.*"]
Attention
Previously every configuration diagnostic reported under the single
config code, so ignore = ["config"] suppressed the whole channel.
The fine-grained codes are now the real lint codes, and a bare
"config" entry matches only the code-less configuration warnings —
replace it with "config.*" to keep suppressing everything.
Needs-domain diagnostics (needs.*)¶
Most needs.* codes are documented beside the directive or configuration key
they concern.
The sphinx-test-reports directives’ twelve codes —
needs.test_report_option_missing, needs.test_report_option_invalid,
needs.test_report_path_outside_root, needs.test_report_missing,
needs.test_report_unreadable, needs.test_report_json_unsupported,
needs.test_report_suite_not_found, needs.test_report_case_not_found,
needs.test_report_need
(warnings: the directive creates no need,
except :auto_cases: alone and a field default needs.test_report_need reports on a created need),
needs.test_report_duplicate_id (warning: a need of an :auto_suites: / :auto_cases: expansion is not created),
needs.test_report_id_shadows_section (warning: a need’s id is also a section’s anchor on its page)
and needs.test_report_note (info) —
are listed in Diagnostics.
The test-results and test-env tables reuse those that apply to them and add three of their own —
needs.test_report_env_shape (an environment file, or one environment in it, that is not an object),
needs.test_report_env_not_present (an :env: name the file does not hold)
and needs.test_report_env_key_not_present (a :data: name a shown environment does not hold),
all warnings — listed in Results tables.
needs.filter (warning) is the code of a dynamic function
whose filter cannot be evaluated on some of the needs it tests —
one lacking a field the filter compares, say:
calc_sum still counts them, check_linked_values still tests them and copy drops them,
as sphinx-needs does, and the call is reported once, naming them.
needs.create_need (warning, as a Sphinx build logs it) is a need directive, a list2need item or a src-trace need
that creates no need because a field its type requires has no value
(a field not nullable on the type, with no default: see Fields per need type);
the first such field is named, core fields first, then the others in the order they are declared;
every other reason a need cannot be built is needs.build_error.
needs.undeclared_for_type (warning) is a value set, in a need of a type that does not declare it,
for a field or link type need types declare alone (see Fields per need type):
the value is ignored and the need holds null ([], no links, for a link type);
it is reported at the option of a need directive or a list2need item, at the needimport for an imported need,
and at the source for a need of external_needs.
needs.needextend (warning) is a needextend option that does not extend the needs of a type it matched,
the type not declaring the field or link type: one per needextend, need type and option, counting the needs it does not extend.
needs.link_target_type (warning) is a resolved link to a need whose type the target_types of its link type,
as the source need’s type declares them, do not accept (see Link types):
one per distinct link, at the source need (at the needimport for an imported need) and the target need;
needs.external_link_target_type (warning) is the same for a need of external_needs, at its source.
Two more are worth naming here, because they are the ones raised by a
whole-PROJECT check rather than by reading a single file:
needs.cypher_vocabulary— a view directive’s:cypher:(Cypher query) references a label, relationship type or property key that does not exist anywhere in the project’s needs graph. openCypher runs such a query silently — the missing name reads asnull, so the view usually matches nothing or renders blank cells, though a null-tolerant test such asIS NULLcan instead make it match everything — and this is what says so, anchored on the:cypher:option, with the same did-you-mean notesubc query cypherprints.Like every whole-project code (
std.duplicate_docname, thetoctree.*family), it is reported byubc check, counted by theubc build htmlquality gate, and listed — with its position — in the editor extension’s diagnostics view. It is not an inline squiggle: the editor’s per-file underlines carry the parse and markup phases only, which is why theneeds.cypher_invalidon the very same option does underline and this one does not.One warning per directive, carrying every note its query produced, because a
:cypher:has a single source range for the whole query:warning[needs.cypher_vocabulary] --> index.rst:9:5 the needtable :cypher: query references vocabulary this project does not have: unknown label `ned` — did you mean `req`?; unknown property `staus` — did you mean `status`? (the query still runs — the missing name reads as null, so the result is not what the query says: usually no rows or blank cells, sometimes a full but wrong table)
It is recomputed for the whole project on every index pass, so it disappears by itself once the missing vocabulary exists — you do not have to re-save the file it was raised on. A directive written in an
.. include::``d fragment is reported against the FRAGMENT, with the including page named alongside it, so a ``per-file-ignoresglob on either path suppresses it. A known field that merely happens to be unset on some needs never raises it: the check tests the project’s schema, never any need’s data.Narrow it with
contains = "unknown label", scope it to a path withper-file-ignores("index.rst" = ["needs.cypher_vocabulary"]), or silence the class withignore = ["needs.cypher_vocabulary"].message-ignoresmatches the message TEXT only, so a rule naming a position such ascontains = "index.rst:9:5"never fires — useper-file-ignoresfor that. It is distinct fromneeds.cypher_invalid, which reports a query that does not parse or has the wrong shape — a different fault with a different fix, so the two are separately suppressible.needs.filter_type— ac.is_a('<name>')in a filter (Special functions) names no need type of the project, so it selects no need: a misspelt type, or a type’s title written where its name belongs. It is Sphinx-Needs’needs.filter_type, with the same did-you-mean: the type whose title the name is, else the closest type name.warning[needs.filter_type] --> index.rst:12:22 the needtable :filter: 'c.is_a('rq')' names 'rq', which is not a need type (did you mean 'req'?); c.is_a('rq') selects no needIt is reported for every filter ubCode evaluates, once per
c.is_aliteral as written. A view’s:filter:, needflow’s:highlight:, needgantt’s:milestone_filter:, aneedextractfilter argument and a:need_count:role are reported on the literal itself, and so is thefilterof a dynamic function in a needtable’s:style_row:or in a:need_func:/:ndf:role (where it cannot be placed, on the option’s name or on the role); a chart’s content-line filter and aneedextendfilter on the directive; a link’s condition, a dynamic function’sfilterin a need option and a bracketed variant condition at the need; a derived field’swhereandtest, and a[needs.variants]entry, once each at the configuration file, whether or not a need uses them. A filter written over several lines is quoted on one, its line breaks shown as\n. Likeneeds.cypher_vocabularyit is recomputed for the whole project on every index pass, so declaring the type makes it disappear without touching the file that names it, and it is listed in the diagnostics view rather than underlined. A filter that does not parse isneeds.filter_invalid(or its surface’s own code) instead, and the two are separately suppressible:ignore = ["needs.filter_type"]silences this one alone.needs.id_namespace— a need id the project writes or generates holds::but is not a namespace and a local id (A::::B,NS::,std::vector<int>::size), whilenamespaced_ids = trueis set under[needs](it is off by default: with nothing set, every id is a plain id and this is never reported). The need is kept, read as a plain id; the warning names what is wrong with the id and the three ways out. It is Sphinx-Needs’needs.id_namespace.warning[needs.id_namespace] --> index.rst:4:4 Need id 'A::::B' contains '::' but is not a namespaced id (a namespace segment is empty), so it is read as a plain id. Correct the id, set `namespaced_ids = false` under `[needs]` to read no id as namespaced, or ignore `needs.id_namespace` under `[lint]`.
It is reported once per need, at the need, for every way a project makes its own needs: a need directive in reStructuredText or MyST, a
list2needitem, a declared template directive, a need from a source comment, a test-report need, and an id generated from a title or a type’s prefix. A need fromneedimportor from[[needs.external_needs]]is the data of the project that wrote it, and is not reported. An id thatid_regex(or its type’sid_regex) also refuses is reported asneeds.id_regextoo, because ubCode keeps that need, where a Sphinx build refuses the need and reports only its pattern. Likeneeds.filter_typeit is recomputed for the whole project on every index pass, so correcting the id makes it disappear, and it is listed in the diagnostics view rather than underlined. Under the default gate it failsubc build html: correct the id, turn the reading off, or silence it withignore = ["needs.id_namespace"].needs.namespaced_ids_off— a filter readsc.id.ns,c.id.localorc.in_namespace()(Filtering by namespace: c.id and c.in_namespace) whilenamespaced_idsis off under[needs](the default in this release). With the switch off every need is in no namespace, soc.id.nsis empty for every need,c.id.localis the whole id andc.in_namespace("nc")is false for every need: the filter is answered, and means nothing. The answer is unchanged; the warning names the filter, the values it reads (in the orderc.id.ns,c.id.local,c.in_namespace()), what each means, and the two ways out.warning[needs.namespaced_ids_off] --> index.rst:12:13 The filter 'c.in_namespace("nc")' reads c.in_namespace(), but namespaced ids are off for this project: c.in_namespace() is false for every need. Set `namespaced_ids = true` under `[needs]` to read '::' in an id as a namespace separator, or ignore `needs.namespaced_ids_off` under `[lint]`.It is reported once for each filter at each place it is written, not once for each need, row or page it is evaluated for, in every place
needs.filter_typereads a filter: on the first namespace value the filter reads where that place positions ac.is_aliteral, and whereneeds.filter_typeis reported otherwise (aneedextend’s filter, which this warning then does not quote, on the directive; a link’s condition and a dynamic function’sfilterin a need option at the need; a derived field’swhereandtestat the configuration file). Two cases are counted otherwise, asneeds.filter_typecounts them too: a filter in a fragment spliced by.. include::is reported once for each page that includes it, at the same place in the fragment, and a dynamic function’sfilterthat a field’sdefaultor aneedextendvalue puts on needs is reported once for each need it lands on, at that need. A:need_count:percentage target (a ? b) is two filters, and each half is reported on its own, quoting that half. A filter that does not parse, or that is refused for a namespace reason (c.in_namespace(""), a compared barec.id), keeps its own finding and gets no other; each half of a:need_count:percentage target is judged on its own, so a refused half keeps its refusal and the other half is still reported. The places that refuse the three names when they evaluate a filter (a field’spredicates, aneedimport:filter:, a variant condition) report that refusal alone, and an.. if::condition, which reads no need, is not checked. It is not reported for aneedumltemplate’sfilter(), decided when the diagram is drawn, nor forubc query filter,ubc build pdfselections and the editor’s filter surfaces, which have no place in the project. Likeneeds.filter_typeit is recomputed for the whole project on every index pass, and it is listed in the diagnostics view rather than underlined. Setnamespaced_ids = trueunder[needs]to read the namespaces, or silence it withignore = ["needs.namespaced_ids_off"].
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.
A finding about content that was spliced into a page is suppressed by a rule
matching any file it names, exactly as above
(apart from the shown-by needextract page described below) —
so the only question is which files that is:
An included fragment — spliced by
.. include::— names the fragment and the page it was spliced into (theincluded-fromline the report prints beside it), so a rule naming either path suppresses it. A dangling cross-reference of the standard domain (std.ref,std.doc,std.term,std.any) in a fragment that several pages include is ONE finding naming every one of those pages on which it fails to resolve (a relative:doc:can resolve from one including page and not from another), so a rule naming any of the pages it names silences it for all of them; to say so explicitly, name the fragment in the rule. A finding raised while a page reads the fragment — a missing image, an invalid option — is reported once per including page instead, so a rule naming one page silences only that page’s copy.Prologue and epilogue content (
rst_prolog/rst_epilog) has no file of its own — it is written inubproject.toml— so the finding names the page, labelled(in rst_prolog), and a rule naming the page suppresses it.A card whose need has a home document — a need shown by a
needextract— names that document, so a rule naming the home document suppresses it and a rule naming the page the card appears on does not. The report also prints that page beside it, labelled(shown-by needextract), so you can find the page that shows the card; that location only shows the way and is never matched by a rule.A card with no home document — an imported need, a generated report — names the page itself with a label (
(imported),(in needreport)), so a rule naming the page still suppresses it.
The same rule decides suppression in ubc check,
in ubc build html and in ubc build pdf,
for per-finding diagnostics and for the aggregated
build.directive_unhandled-style counts alike —
in the aggregated case it is applied to each counted site,
so a rule removes the sites it names from the count
and leaves the rest reported.
[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"
Source-mount confinement (build.mount_path_escape)¶
build.mount_path_escape reports a document contributed by a
[[source.mounts]] tree that references a file
outside that tree — an include, an image, a download or a diagram
:file: that climbs out of the mount.
Despite the build. prefix it is an indexing diagnostic, anchored at the
referring document, so unlike the ubc build html warnings below
per-file-ignores does apply to it. That is the only way to hold two
mounts to different policies, because ignore is project-wide per code:
[lint.per-file-ignores]
# Off for one trusted generated tree, still on for every other mount.
"generated/**" = ["build.mount_path_escape"]
# …or off for the whole project.
# [lint]
# ignore = ["build.mount_path_escape"]
Its severity is fixed at warning level. To make it fail a build, escalate with
[build.html] deny — deny = "warning" turns this
(and every other warning) into a non-zero exit.
Unreadable source files (read_error)¶
read_error reports a source file that ubCode found but could not read:
the file is not valid UTF-8, it cannot be opened, or it disappeared while the project was being indexed.
It is graded error,
and nothing from that file is indexed: no needs, no targets, no other diagnostics.
A source file traced by codelinks is a source file too:
one that is not UTF-8 or cannot be read contributes no markers
(no needs, no @need-ids: references, no URLs),
while every other file of its codelinks project keeps its own;
this holds for a .. src-trace:: project,
for a project scanned only for @need-ids: references,
and for the preprocessor-aware C/C++ engine.
The finding is located at the source file alone, never at the src-trace directive that traced it,
so a per-file-ignores entry for the page that holds the directive does not silence it;
one for the source file does, as do ignore and --lint-extend-ignore.
A scoped ubc check <path> reports it whatever the paths,
since the source file usually lies outside the documentation you name.
For a file that is not valid UTF-8, the message is the one Python’s UTF-8 decoder (bytes.decode("utf-8"))
gives for the same bytes, followed by the line and column of the first byte that could not be decoded:
error[read_error]
--> page.rst:4:2
'utf-8' codec can't decode byte 0xe4 in position 14: invalid continuation byte (line 4, column 2)
The finding is located at that byte, so ubc check and its JSON output (--output-format json)
name its line and column; the column counts bytes from the start of the line.
A file that cannot be opened is reported with the operating system’s message, located at the whole file.
Fix the file’s encoding (re-save it as UTF-8) or permissions, or exclude it from the project’s source patterns
(exclude; for a codelinks source, the project’s source_discover exclude).
In the editor it also shows in the Problems panel, on the file itself, while that file is not open,
once the project has been indexed in the session (opening one of its documents indexes it).
It is filtered as an open document’s diagnostics are, lsp_select included,
and a [lint] change applies to it at once.
It is cleared there once an index pass reads the file again, or finds it deleted:
on save or when the file changes on disk, with [server] index_on_save
(the default), or when the project is re-indexed.
When a source cannot be read¶
A source that cannot be read defines no needs, so every answer computed over the project’s needs is missing the needs written in it: a query, the graph schema, a reference lookup, a coverage report. ubCode counts these findings as such a source:
read_error(above), whichever file it is reported on: a page, or a codelinks source file that is not UTF-8;directive.include_encoding_error: an.. include::target that is not UTF-8, reported at theincludedirective and listed at the included file;needs.importandneeds.externalwhen the needs.json aneedimportor an[[needs.external_needs]]entry reads is not UTF-8 text (the message saysit is not UTF-8 text).
Each file is listed once per code, however many findings name it (one needs.json imported by several directives, one include target several pages include), and the warning’s first line counts files.
A needs.json that does not parse, an .. include:: target that does not exist,
and a literalinclude or csv-table file that is not UTF-8 are reported under their own codes,
and are not counted here.
What each surface does with them:
ubc checkand the builds report each as a finding, and fail as their--denylevel says.ubc query filter,ubc query cypher,ubc query searchandubc codelinks coveragestill answer over the needs that remain, with the same output and exit code, and write a warning to stderr naming each source aspath:line: code: message(see the query page).The MCP project tools still answer, and name each source in an
unreadable_sourceslist and a warning line (see the MCP page).The
ubc agentcommands that build the graph stop: they printreason: "unreadable_sources"with the list, orpromptaSTOPfix order, and exit non-zero rather than order the missing needs written again (see the agent commands).
To fix one, re-save the file the entry names as UTF-8 without changing its content,
then run ubc check.
Deleting the file clears it too.
Two kinds are fixed elsewhere:
a needs.json fetched from a URL is listed at the page or ubproject.toml that names it, with its url,
and is fixed where it is published (or its source removed);
a read_error with no line is a file that could not be read at all (a dangling link, no permission, a directory),
and is restored or removed.
The set is read through [lint], as ubc check reports it.
A per-file-ignores entry of the code opts that one file out.
It names the file the finding is reported at:
for an include target, the page that includes it (with directive.include_encoding_error),
and for a remote needs.json, the page or ubproject.toml that names it.
A global ignore = ["read_error"] silences every unreadable page,
and with it the warnings and the agent stop above:
a query then answers over the needs that remain without saying any are missing.
Files no root claims (std.file_outside_roots)¶
Added in version 0.33.0.
std.file_outside_roots reports a file that matches your source patterns but
that no root claims: it lies outside the project’s source root
([source] dir, or the deprecated
[project] srcdir)
and outside every [[source.mounts]] root.
The message names whichever of the two keys your project actually writes.
Discovery walks the declared roots and nothing else, so such a file is not
discovered at all —
it is not indexed, it produces no page, and no :doc: or toctree entry can
name it.
This warning is the only thing that will tell you it is there.
It can only arise when the source root is an explicit subdirectory (or a directory beside the configuration folder): left unset, the source root is the configuration file’s own directory, which claims every file below it. For that default layout ubCode does not even look, so the check costs nothing.
Three ways to act on it, and they are what the message names:
move the file under the source directory (or under a mount root), which makes it a document;
add it to [source] extend_exclude, which stops discovering it — the right answer for a
README.mdsitting beside the project;.. include::it from a document, which is the right answer for a fragment. A file some document already pulls in this way is exempt and never reported: a fragment has no document name on purpose.
Use extend_exclude, not exclude.
exclude is the base list, so setting it replaces the default hygiene
patterns (.git, node_modules, _build, dist, .venv and the
rest) — which would silence the file you named and start looking inside a
vendored tree instead, earning a fresh std.file_outside_roots pointing
inside it.
extend_exclude adds to the defaults rather than replacing them.
The patterns this check honours are matched against the configuration folder — the tree it scans — rather than against a source root. That holds under [source] dir too, where the same patterns anchor at each source root for discovery: this pass walks the configuration folder, and a pattern compiled against a root that is not the tree being walked would exclude nothing here. It is the one place the configuration folder still decides anything once discovery follows the roots, and it is what makes a pattern you wrote to keep a directory out of your project keep it out of this report too.
Like build.mount_path_escape above it is an indexing diagnostic anchored at
the file itself, so per-file-ignores applies —
which is how one tree of loose files is silenced while the rest of the project
stays covered:
[lint.per-file-ignores]
# Off for one directory of notes, still on everywhere else.
"notes/**" = ["std.file_outside_roots"]
# …or off for the whole project.
# [lint]
# ignore = ["std.file_outside_roots"]
Ignoring this code project-wide also skips the filesystem pass that feeds it.
This check is a second, names-only walk of the configuration folder — it reads no
file, but on a large repository it is not free — so a project that has silenced
it stops paying for it as well.
It is the one place a [lint] setting changes what ubCode reads from disk, and
it is deliberate: a monorepo that does not want the check should not be charged
for it on every build.
per-file-ignores does not skip the pass, because a project that silences
one directory still wants the report for the rest.
One class of file this check does not cover: a file under a mount root
inside the configuration folder that the mount’s own walk does not yield.
A mount claims its whole subtree, so such a file is “claimed” here even though
nothing discovers it.
Two things put a file in that state.
The first is the mount’s own exclude — that absence is what your own mount
configuration asked for, rather than something to warn you about.
The second is a source or parser include pattern written with a directory
prefix (vendor/*.rst): such a pattern is matched relative to the mount’s own
root inside a mount, so it can stop matching there even though you named the
file.
If a file under a mount root has gone missing and you did not exclude it, check
your include patterns for a directory prefix.
Its severity is fixed at warning level, and [build.html] deny escalates it like any other.
Variant-excluded toctree entries (toctree.variant_excluded)¶
Added in version 0.33.0.
toctree.variant_excluded reports a toctree entry naming a document that
[[source.variant_sources]] removed from
the current variant’s document set.
The message names both the document and the if string that removed it, so
the rule to narrow is the one you are told about.
It replaces two codes that would otherwise be misleading:
toctree.nonexisting_document for an explicit entry (the name is not a
mistake — the page exists in another variant), and toctree.empty_glob for a
:glob: entry whose only matches were removed (the pattern is not empty —
this variant emptied it).
It is graded info, not warning, and does not fail ubc check.
In a 150% model a shared index that lists every edition’s pages is the normal
shape, so this fires on configurations that are entirely correct — once per
entry, on every build of every variant.
As a warning it would have failed the default exit policy on such a project,
and the obvious response would have been to ignore the code, which switches
the reclassification off for the case it exists to catch: a rule glob that
matched more than its author intended.
Info keeps the message where you can read it and leaves the exit code alone.
Silencing it is therefore cosmetic rather than a way to unblock a build — it removes the message from the output, and nothing else:
[lint.per-file-ignores]
# Quieter for the one index that lists every edition's pages.
"reference/index.rst" = ["toctree.variant_excluded"]
# …or quiet for the whole project.
# [lint]
# ignore = ["toctree.variant_excluded"]
Consider leaving it on: it is the only remaining place a too-broad rule is
visible, because a removed file is gone from every other product — no page, no
document name, no needs, nothing in needs.json.
If you want it enforced, [build.html] deny with
deny = "info" escalates it like any other finding.
The diagnostic is anchored at the containing document, so per-file-ignores
globs on the document that holds the toctree — not on the excluded page,
which this variant does not have.
Ambiguous inventory matches (intersphinx.ambiguous)¶
intersphinx.ambiguous reports a cross-reference that matched more than
one loaded intersphinx project — or more than one
object type — after finding nothing in the project itself.
It fires on :ref:, :term:, :doc:, :any:, a sphinx-design link
typed any, and the unqualified :external: form; a target already
qualified with a project key (:ref:`zulu:shared`,
:external+zulu:ref:`shared`) names one inventory and cannot be ambiguous.
The message says which project won and which also matched:
multiple inventory matches for 'shared': took 'zulu' (std:label), also matched by 'alpha' (std:label)
It is graded info, not warning, and never fails a build: the reference
resolves, to exactly the page it always did, and a sphinx-build is silent
about the collision entirely.
Two overlapping inventories are also normal — every Sphinx-generated
objects.inv ships the same handful of built-in labels — so this fires on
configurations that are perfectly correct.
Read it as a note about your configuration rather than a fault in the page.
It is worth reading because of how the winner is chosen: the inventories are
merged in project-name order, and the alphabetically last project wins a
collision.
Adding an inventory whose key sorts after an existing one therefore moves every
colliding link, silently — and so does renaming a project key.
The order the projects appear in ubproject.toml has no effect.
To pin one target, qualify it with the project key:
:ref:`zulu:shared`
:external+zulu:ref:`shared`
To silence the notice instead:
[lint.per-file-ignores]
# Quiet for the one page that references the overlapping project.
"reference/api.rst" = ["intersphinx.ambiguous"]
# …or quiet for the whole project.
# [lint]
# ignore = ["intersphinx.ambiguous"]
If you want it enforced, [build.html] deny with
deny = "info" escalates it like any other finding.
The equivalent collision reached through a Markdown link ([](#target)
or [](inv:…)) reports intersphinx.ref at warning level instead, and
fails a default build — because myst-parser warns on it and this side of
the family follows its own upstream.
The two codes are silenced separately.
Link-check findings¶
Added in version 0.34.0.
The seven linkcheck.* codes that ubc build linkcheck reports —
linkcheck.broken, linkcheck.anchor_missing,
linkcheck.redirect_permanent, linkcheck.redirect_temporary,
linkcheck.blocked, linkcheck.server_error and linkcheck.timeout —
go through this same configuration.
ignore suppresses a whole class,
message-ignores narrows one to particular messages,
and per-file-ignores suppresses classes for particular source files:
[lint.per-file-ignores]
# Redirects are expected in the archive; dead links there are not.
"archive/**" = ["linkcheck.redirect_permanent"]
That last one is the equivalent of Sphinx’s linkcheck_exclude_documents,
with no extra knob to learn.
per-file-ignores is applied per occurrence:
a rule silences the places the URL is written under its glob and leaves the same
URL’s other occurrences standing,
so one archived page cannot hide a dead link in the rest of the project.
A finding disappears only when every one of its occurrences is silenced.
ignore and message-ignores ask about the code and the verdict’s message,
both of which belong to the URL rather than to a place,
so those two silence the whole finding.
A URL that exists only as a need field has no source file to match,
and is never silenced by a path rule.
Suppressed findings are counted separately —
the summary line ends with N suppressed by [lint],
and --output-format json marks each one "suppressed": true and keeps its
code, so a report consumer can still see what was silenced.
They are not counted under their status class,
because a run that passes should not also announce a broken link.
To suppress by URL rather than by file or code, use [linkcheck] ignore, which also stops the request being made at all.
Each class carries its own default severity, and [linkcheck] deny sets the bar those severities are compared against — see Link checking for the table.
Build warnings¶
Added in version 0.31.0.
The build.* warnings that ubc build html reports
(build.directive_unhandled, build.search_index_large, and the rest)
go through this same configuration:
ignore suppresses one by code,
and message-ignores narrows a code to particular messages —
for instance a single unhandled directive name.
per-file-ignores applies to the ones that name a source file.
A warning raised while rendering one page carries that page as its location,
printed as its own --> line, as an indexing warning’s is,
so a rule naming the page silences it.
The site-wide tallies (build.directive_unhandled, build.role_unhandled,
build.diagram_file_unresolved, build.diagram_unconvertible
and build.plantuml_render_failed)
apply the rules site by site:
a rule matching the file a site is written in
(or the page an included fragment is spliced into)
takes that site out of the count,
and the warning goes once no site is left.
The whole-build warnings (asset reads, stale files, the manifest write)
belong to no file, so a path rule never reaches them;
ignore and message-ignores still do.
Narrowing happens before gating:
a code silenced here never reaches
the quality gate
that decides the exit code of ubc build html,
so silencing a code is enough to keep a build green
without lowering the project’s bar.
The codes tied to a [build.html] setting are documented with that setting
on the [build.html] configuration page.
These are not tied to one:
Identifier |
Description |
|---|---|
|
A |
|
A page’s local image is missing from the build’s image table. This should not happen; please report it. |
|
A page rendered a different sequence of sections, figures, tables, code blocks or equations from the one its numbers were assigned over, so the items that could not be matched print no number rather than a wrong one. This should not happen; please report it (see Numbering sections, figures and equations). |
|
The output directory had content and no |
|
The project has documents but none became a page, so no site was written. |
|
|
|
|
|
A |
|
The |
|
The incremental-build manifest could not be written. The site is complete; the next build cannot skip unchanged pages. |
|
A page’s rendered body could not be stored for reuse. The site is complete; the next build renders that page again. |
Changed in version 0.31.1: A warning belonging to one page now names it,
as a docname: prefix on the message:
warning[build.video_glob_unsupported]
guide/intro: a video source cannot be a wildcard pattern ...
The rest of the message is unchanged,
so a message-ignores pattern written against the message text keeps matching,
and you can narrow one to a single page by including the prefix
(contains = "guide/intro: a video source").
This applies to the warnings raised while rendering a particular page.
The unhandled-markup radars (build.directive_unhandled,
build.role_unhandled) and the diagram-decline codes
(build.diagram_file_unresolved, build.diagram_unconvertible,
build.plantuml_render_failed)
are also raised during rendering
but are site-wide aggregates over every page,
so they carry no prefix and name their example positions inside the message instead;
nor do the whole-build warnings (asset reads, stale files, the manifest write),
which belong to no page.
Two codes are the exception on the page-scoped side:
build.need_view_failed and build.need_view_truncated
name their own position as docname:line: (with the line number),
so they are not given a second prefix —
a narrowing pattern for either must use that form
(contains = "guide/intro:42:"), not docname: plus a space.
Changed in version 0.31.2: build.need_view_truncated joins build.need_view_failed
as a code that names its own docname:line: position.
It is raised once per view directive whose :max_items: cap
(its own, or the project-wide needs.views_max_items default)
dropped items from the rendered result:
warning[build.need_view_truncated]
index:16: view directive needlist #0 was truncated: showing the first 2 of 3 needs ...
Narrow it to one page the same way as its sibling —
contains = "index:16:" — or silence the whole code
with ignore = ["build.need_view_truncated"].
Like every build warning it counts toward
the quality gate,
so on the default bar a truncated view fails ubc build html
until it is narrowed here or the cap is raised.
Changed in version 0.32.0: A build warning’s position is no longer part of its message.
The docname: prefix of 0.31.1
and the docname:line: head of build.need_view_failed and build.need_view_truncated
are printed as a --> location line instead,
as an indexing warning’s position is,
and per-file-ignores now matches those locations.
A message-ignores pattern that quoted a position no longer matches:
narrow to one page with per-file-ignores instead.
Added in version 0.36.0: Two of the redirects warnings are the ones most likely to want narrowing, because both are judgements about anchors rather than about the entry itself:
build.redirect_anchor_unknownThe target page renders no such section. The check reads the ids the rendered page actually carries — section slugs, generated ids, and anchors written by hand in a
rawblock — so a finding here is nearly always a real typo or a section that moved again. What it cannot see is an id a script injects at runtime, which is the honest reason to silence it (along with a deliberate placeholder for a section that is about to exist).build.redirect_anchor_shadowedThe key’s page still renders the section the entry says has moved, so the entry is inert. Silence it only when you are keeping the entry on purpose — for instance while a rename is rolled out across several repositories.
Narrow either to a single entry with message-ignores,
using the spelling that message carries.
build.redirect_anchor_unknown names both
the entry’s key and the target it points at
(contains = "guide/old#setup" for the key,
contains = "guide/new#install" for the target),
which is what lets you narrow it
when several entries point at one page.
build.redirect_anchor_shadowed names the key only
(contains = "guide/setup#old-name").
Neither carries a location,
so per-file-ignores cannot reach them.
Added in version 0.31.2: build.need_style_invalid is raised once per need per page whose
:style: carried a token that is not a valid CSS identifier
(an ASCII letter or underscore, then ASCII letters, digits, underscores or
hyphens) — so a need carded on two pages is reported for each.
Such a token becomes no class on the card;
valid tokens on the same need still apply:
warning[build.need_style_invalid]
index: need REQ_1: ignored invalid :style: token(s) "9bad", "has space" ...
It is an ordinary page-scoped code —
the message names the NEED and ubCode prefixes the page,
so narrow it with contains = "index: need REQ_1"
or silence the class with ignore = ["build.need_style_invalid"].
Like every build warning it counts toward
the quality gate,
so on the default bar a mistyped style fails ubc build html
until it is fixed or narrowed here.
Added in version 0.31.2: build.need_layout_unknown is raised once per page and unknown name
whose needs asked for a card design this project does not have —
neither a built-in one nor one of its own
[needs.card_layouts] designs.
The affected needs are listed on the one line (the first five, then a count),
because a mistyped [needs.fields.layout] default applies to
every need in the project and would otherwise print hundreds of
identical lines:
warning[build.need_layout_unknown]
index: unknown :layout: "Focus" on 7 need(s) (REQ_1, REQ_2, REQ_3, REQ_4, REQ_5 and 2 more): rendered with the default layout "clean" (valid: clean, complete, focus, debug, clean_l, ...; aliases: test, focus_f)
The valid: list is built from your project: the built-in designs
first, then any design [needs.card_layouts] defines,
so a design you add appears in the message with no second edit.
The named default is your project’s
default_layout,
so the message says which design the card actually got.
The card renders with the default clean design;
a Sphinx-Needs build raises SphinxNeedLayoutException here,
which ends the build.
It is an ordinary page-scoped code —
the message names the NEEDS and ubCode prefixes the page,
so narrow it with contains = 'unknown :layout: "Focus"'
or silence the class with ignore = ["build.need_layout_unknown"].
Like every build warning it counts toward
the quality gate,
so on the default bar a mistyped layout fails ubc build html
until it is fixed or narrowed here.
Added in version 0.31.2: build.need_string_link_invalid is raised once per page and message
when a [needs.string_links] rule matched a
value but drew no link — its link_url or link_name failed to render,
or the target it rendered is not one this build will emit
(https://, http://, mailto: or a relative reference; anything
else, javascript: included, is refused rather than escaped).
warning[build.need_string_link_invalid]
index: the string link "tickets" drew no link for tickets on 7 need(s) (REQ_1, REQ_2, REQ_3, REQ_4, REQ_5 and 2 more) because its `link_name` failed to render (unknown filter: filter no_such_filter is unknown (in string_link:1)) — the value is shown as plain text
The value itself is kept, as plain text — a Sphinx-Needs build drops it
out of the page entirely in the template-failure case. Findings are
aggregated by message across the needs they apply to and across both
surfaces of a page (a card and a needtable hitting one broken rule report
once), because a bad template applies to every need carrying the field.
Narrow it with contains = 'the string link "tickets"'
or silence the class with ignore = ["build.need_string_link_invalid"].
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.