Configure XRLint
Note: this chapter's material is based on the documentation of how to configure ESLint. Many parts have been copied and adjusted as it applies in many similar ways to XRLint.
Configuration File
The XRLint configuration file may be named any of the following:
- YAML format:
xrlint-config.yaml
(or use extension.yml
) - JSON format:
xrlint-config.json
- Python module:
xrlint_config.py
(note the underscore)
It should be placed in the root directory of your project and export an array of configuration objects or references to predefined configuration objects.
Here’s a YAML example:
- files: ["**/*.zarr", "**/*.nc"]
- plugins:
xcube: xrlint.plugins.xcube
- recommended
- xcube/recommended
Same using JSON:
[
{"files": ["**/*.zarr", "**/*.nc"]},
{
"plugins": {
"xcube": "xrlint.plugins.xcube"
}
},
"recommended",
"xcube/recommended"
]
And as Python module:
def export_config():
return [
{"files": ["**/*.zarr", "**/*.nc"]},
{
"plugins": {
"xcube": "xrlint.plugins.xcube"
}
},
"recommended",
"xcube/recommended"
]
Configuration Objects
Each configuration object contains all the information XRLint needs to execute on a set of files. Each configuration object is made up of these properties:
name
- A name for the configuration object. This is used in error messages and config inspector to help identify which configuration object is being used.files
- A list of glob patterns indicating the files or URLs that the configuration object should apply to. If not specified, the configuration object applies to all files matched by any other configuration object. See section File and Ignore Patterns below.ignores
- A list of glob patterns indicating the files and URLs that the configuration object should not apply to. If not specified, the configuration object applies to all files matched byfiles
. If ignores is used without any other keys in the configuration object, then the patterns act as global ignores. See section File and Ignore Patterns below.opener_options
- A dictionary specifying keyword-arguments that are passed directly to thexarray.open_dataset()
function. The available options are dependent on the xarray backend selected by theengine
option. See section Opener Options below.linter_options
- A dictionary containing settings related to the linting process. (Currently not used.) See section Linter Options below.settings
- An object containing name-value pairs of information that should be available to all rules.plugins
- A dictionary containing a name-value mapping of plugin names to either plugin module names orPlugin
objects. Whenfiles
is specified, these plugins are only available to the matching files. See sections Configuring Plugins and Custom Plugins below.rules
- An object containing the configured rules. Whenfiles
orignores
are specified, these rule configurations are only available to the matching files. See sections Configuring Rules and Custom Rules below.processor
- A string indicating the name of a processor inside of a plugin, i.e.,"<plugin-name>/<processor-name>"
. In Python configurations it can also be an object of typeProcessorOp
containingpreprocess()
andpostprocess()
methods. See sections Configuring Processors and Custom Processors below.
File and Ignore Patterns
Coming soon
Opener Options
Coming soon
Linter Options
Coming soon
Configuring Plugins
Coming soon
Configuring Rules
Coming soon
Configuring Processors
Coming soon
Predefined Configuration Objects
Coming soon
Custom Plugins
Coming soon
Custom Rules
Coming soon
Custom Processors
Coming soon