REF009: resource-manifest-mismatch
resource.json and the files of the resource disagree, or it is missing
| Code | REF009 |
| Name | resource-manifest-mismatch |
| Category | References (REF) |
| Default severity | warning |
| Enabled by default | yes |
| Fix available | no |
| ign-lint equivalent | none |
What it does
Section titled “What it does”Compares the files list of a resource's resource.json with the files
in the resource directory: a listed file that does not exist, and a file
that exists but is not listed, are reported. Manifests without a files
list are not checked, and unlisted files are only reported for resource
types of Inductive Automation modules (third-party modules may keep
bookkeeping files next to their resources).
It also reports code the gateway never loads because it is not in a resource:
- a resource directory without its manifest: a directory that holds the
main file of a resource type (a
view.jsonbelowviews/, acode.pybelowignition/script-python/, a timer script, a style class, ...) but noresource.json(unary-resource.jsonfor tag folders). The files are still linted as that resource; - a
view.jsonor Python file in a project or gateway configuration collection that is not inside any resource directory, and a Python file in a resource directory that is not the resource's script (ahelper.pynext to a librarycode.py). They are linted on their own, like files outside a project; - a resource manifest or data file (
resource.json,tags.json,config.json, ...) that is not inside any project (project.json) or gateway configuration collection (config-mode.json), such asconfig/resources/core/...withoutcore/config-mode.json. Verified on Ignition 8.3.3: the gateway does not load a collection directory withoutconfig-mode.json(its tags do not exist), and acoredirectory without one keeps the gateway from starting (Unable to create 'core' resource collection). iglint does not read such files either: their tag event scripts and expressions are not analysed; - a file behind a symbolic link to a directory inside a project or
collection (
ignition/script-python/lib -> ...), or behind a project or collection directory that is a symbolic link (projects/S -> ../S). Verified on Ignition 8.3.3: the gateway does not follow symbolic links to directories (a linked library folder givesImportError: No module named lib, a linked project never starts, a linkedcorecollection keeps the gateway from starting). iglint lints such a file on its own and offers no fixes for it. Symbolic links to files are followed by the gateway and are linted as usual.
Why is this bad?
Section titled “Why is this bad?”The gateway loads only the listed files. An unlisted file (for example a
view.json copied in by hand) is silently ignored, and a listed file that
is missing makes the resource incomplete or invalid on the gateway. A
directory without a manifest is a plain folder to the gateway: the view,
script or query in it does not exist at run time.
Example
Section titled “Example”{"scope": "G", "version": 1, "files": ["view.json", "thumbnail.png"]}when the directory has no thumbnail.png. Use instead:
{"scope": "G", "version": 1, "files": ["view.json"]}Generated from the rule metadata by iglint generate-docs; iglint rule REF009 prints the same page in the terminal. Source: docs/rules/REF009.md.