Skip to content

Commit 7803dc0

Browse files
authored
Merge pull request #19 from bcdev/forman-docs_fixes
Doc fixes
2 parents e7d7915 + 1c0473d commit 7803dc0

File tree

8 files changed

+106
-41
lines changed

8 files changed

+106
-41
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Its design is heavily inspired by the awesome [ESLint](https://eslint.org/).
2020
different dataset conventions.
2121
- Project-specific configurations including configuration of individual
2222
rules and file-specific settings.
23+
- Works with dataset files in the local filesystem or any of the remote
24+
filesystems supported by xarray.
2325

2426
## Inbuilt Rules
2527

docs/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ To install the XRLint development environment into an existing Python environmen
3333
pip install .[dev,doc]
3434
```
3535

36-
or create a new environment using
36+
or create a new environment using `conda` or `mamba`
3737

3838
```bash
3939
mamba env create

docs/api.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@ This chapter provides a plain reference for the XRLint Python API.
1717
configuration information and provide related functionality:
1818
[Config][xrlint.config.Config] and [ConfigList][xrlint.config.ConfigList].
1919
- The `rule` module provides rule related classes and functions:
20-
[Rule][xrlint.rule.Rule] comprising rule metadata
21-
[RuleMeta][xrlint.rule.RuleMeta] and the rule operation
20+
[Rule][xrlint.rule.Rule] comprising rule metadata,
21+
[RuleMeta][xrlint.rule.RuleMeta], the rule validation operations in
2222
[RuleOp][xrlint.rule.RuleOp], as well as related to the latter
2323
[RuleContext][xrlint.rule.RuleContext] and [RuleExit][xrlint.rule.RuleExit].
2424
Decorator [define_rule][xrlint.rule.define_rule] allows defining rules.
25-
- The `node` module defines the nodes passed to [xrlint.rule.RuleOp]:
26-
base classes [None][xrlint.node.Node], [XarrayNode][xrlint.node.XarrayNode]
25+
- The `node` module defines the nodes passed to [RuleOp][xrlint.rule.RuleOp]:
26+
base classes [None][xrlint.node.Node], [XarrayNode][xrlint.node.XarrayNode],
2727
and the specific [DatasetNode][xrlint.node.DatasetNode],
2828
[DataArray][xrlint.node.DataArrayNode], [AttrsNode][xrlint.node.AttrsNode],
2929
and [AttrNode][xrlint.node.AttrNode] nodes.
3030
- The `processor` module provides processor related classes and functions:
3131
[Processor][xrlint.processor.Processor] comprising processor metadata
32-
[ProcessorMeta][xrlint.processor.ProcessorMeta]
32+
[ProcessorMeta][xrlint.processor.ProcessorMeta],
3333
and the processor operation [ProcessorOp][xrlint.processor.ProcessorOp].
3434
Decorator [define_processor][xrlint.processor.define_processor] allows defining
3535
processors.
@@ -41,7 +41,8 @@ This chapter provides a plain reference for the XRLint Python API.
4141
[RuleTester][xrlint.testing.RuleTester] that is made up
4242
of [RuleTest][xrlint.testing.RuleTest]s.
4343

44-
Note: the `xrlint.all` convenience module exports all of the above from a
44+
Note:
45+
the `xrlint.all` convenience module exports all of the above from a
4546
single module.
4647

4748
::: xrlint.cli.engine.XRLint

docs/cli.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ Usage: xrlint [OPTIONS] [FILES]...
88
99
Validate the given dataset FILES.
1010
11-
Reads configuration from `./xrlint_config.*` if such file exists and unless
12-
`--no_config_lookup` is set or `--config` is provided. Then validates each
13-
dataset in FILES against the configuration. The default dataset patters are
14-
`**/*.zarr` and `**/.nc`. FILES may comprise also directories. If a
15-
directory is not matched by any file pattern, it will be traversed
16-
recursively. The validation result is dumped to standard output if not
17-
otherwise stated by `--output-file`. The output format is `simple` by
18-
default. Other inbuilt formats are `json` and `html` which you can specify
19-
using the `--format` option.
11+
Reads configuration from './xrlint_config.*' if such file exists and unless
12+
'--no_config_lookup' is set or '--config' is provided. It then validates
13+
each dataset in FILES against the configuration. The default dataset patters
14+
are '**/*.zarr' and '**/.nc'. FILES may comprise also directories or URLs.
15+
The supported URL protocols are the ones supported by xarray. Using remote
16+
protocols may require installing additional packages such as S3Fs
17+
(https://s3fs.readthedocs.io/) for the 's3' protocol.
18+
19+
If a directory is provided that not matched by any file pattern, it will be
20+
traversed recursively. The validation result is dumped to standard output if
21+
not otherwise stated by '--output-file'. The output format is 'simple' by
22+
default. Other inbuilt formats are 'json' and 'html' which you can specify
23+
using the '--format' option.
2024
2125
Options:
2226
--no-config-lookup Disable use of default configuration from
@@ -36,5 +40,4 @@ Options:
3640
--init Write initial configuration file and exit.
3741
--version Show the version and exit.
3842
--help Show this message and exit.
39-
4043
```

docs/config.md

Lines changed: 60 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,78 @@ these properties:
6666
* `name` - A name for the configuration object.
6767
This is used in error messages and config inspector to help identify which
6868
configuration object is being used.
69-
* `files` - A list of glob patterns indicating the files that the
69+
* `files` - A list of glob patterns indicating the files or URLs that the
7070
configuration object should apply to. If not specified, the configuration
7171
object applies to all files matched by any other configuration object.
72-
* `ignores` - A list of glob patterns indicating the files that the
72+
See section [File and Ignore Patterns](#file-and-ignore-patterns) below.
73+
* `ignores` - A list of glob patterns indicating the files and URLs that the
7374
configuration object should not apply to. If not specified, the configuration
74-
object applies to all files matched by files. If ignores is used without any
75+
object applies to all files matched by `files`. If ignores is used without any
7576
other keys in the configuration object, then the patterns act as _global ignores_.
77+
See section [File and Ignore Patterns](#file-and-ignore-patterns) below.
7678
* `opener_options` - A dictionary specifying keyword-arguments that are passed
7779
directly to the `xarray.open_dataset()` function. The available options are
7880
dependent on the xarray backend selected by the `engine` option.
81+
See section [Opener Options](#opener-options) below.
7982
* `linter_options` - A dictionary containing settings related to
8083
the linting process. (Currently not used.)
81-
* `processor` - A string indicating the name of a processor inside of a plugin,
82-
i.e., `"<plugin-name>/<processor-name>"`. In Python configurations
83-
it can also be an object of type `ProcessorOp` containing
84-
`preprocess()` and `postprocess()` methods.
84+
See section [Linter Options](#linter-options) below.
85+
* `settings` - An object containing name-value pairs of information that should
86+
be available to all rules.
8587
* `plugins` - A dictionary containing a name-value mapping of plugin names
8688
to either plugin module names or `Plugin` objects. When `files` is specified,
8789
these plugins are only available to the matching files.
90+
See sections [Configuring Plugins](#configuring-plugins)
91+
and [Custom Plugins](#custom-plugins) below.
8892
* `rules` - An object containing the configured rules.
8993
When `files` or `ignores` are specified, these rule configurations are only
9094
available to the matching files.
91-
* `settings` - An object containing name-value pairs of information that should
92-
be available to all rules.
95+
See sections [Configuring Rules](#configuring-rules)
96+
and [Custom Rules](#custom-rules) below.
97+
* `processor` - A string indicating the name of a processor inside of a plugin,
98+
i.e., `"<plugin-name>/<processor-name>"`. In Python configurations
99+
it can also be an object of type `ProcessorOp` containing
100+
`preprocess()` and `postprocess()` methods.
101+
See sections [Configuring Processors](#custom-processors)
102+
and [Custom Processors](#custom-processors) below.
103+
104+
## File and Ignore Patterns
105+
106+
_Coming soon_
107+
108+
## Opener Options
109+
110+
_Coming soon_
111+
112+
## Linter Options
113+
114+
_Coming soon_
115+
116+
## Configuring Plugins
117+
118+
_Coming soon_
119+
120+
## Configuring Rules
121+
122+
_Coming soon_
123+
124+
## Configuring Processors
125+
126+
_Coming soon_
127+
128+
## Predefined Configuration Objects
129+
130+
_Coming soon_
131+
132+
## Custom Plugins
133+
134+
_Coming soon_
135+
136+
## Custom Rules
137+
138+
_Coming soon_
139+
140+
## Custom Processors
141+
142+
_Coming soon_
143+

docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ Its design is heavily inspired by the awesome [ESLint](https://eslint.org/).
1414
different dataset conventions.
1515
- Project-specific configurations including configuration of individual
1616
rules and file-specific settings.
17+
- Works with dataset files in the local filesystem or any of the remote
18+
filesystems supported by xarray.
1719

1820

1921
## Inbuilt Rules

xrlint/cli/engine.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,10 @@ def result_stats(self) -> ResultStats:
7373

7474
def load_config_list(self) -> None:
7575
"""Load configuration list.
76-
The function considers any `plugin` and `rule`
77-
options, the default configuration file names or a specified
78-
configuration file.
76+
The function will load the configuration list from a specified
77+
configuration file, if any.
78+
Otherwise it will search for the default configuration files
79+
in the current working directory.
7980
"""
8081
plugins = {}
8182
for plugin_spec in self.plugin_specs:
@@ -121,7 +122,7 @@ def get_config_for_file(self, file_path: str) -> Config | None:
121122
"""Compute configuration for the given file.
122123
123124
Args:
124-
file_path: A file path.
125+
file_path: A file path or URL.
125126
126127
Returns:
127128
A configuration object or `None` if no item
@@ -133,14 +134,14 @@ def print_config_for_file(self, file_path: str) -> None:
133134
"""Print computed configuration for the given file.
134135
135136
Args:
136-
file_path: A file path.
137+
file_path: A file path or URL.
137138
"""
138139
config = self.get_config_for_file(file_path)
139140
config_json_obj = config.to_json() if config is not None else None
140141
click.echo(json.dumps(config_json_obj, indent=2))
141142

142143
def verify_datasets(self, files: Iterable[str]) -> Iterator[Result]:
143-
"""Verify given files.
144+
"""Verify given files or directories which may also be given as URLs.
144145
The function produces a validation result for each file.
145146
146147
Args:

xrlint/cli/main.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,22 @@ def main(
112112
):
113113
"""Validate the given dataset FILES.
114114
115-
Reads configuration from `./xrlint_config.*` if such file
116-
exists and unless `--no_config_lookup` is set or `--config` is
115+
Reads configuration from './xrlint_config.*' if such file
116+
exists and unless '--no_config_lookup' is set or '--config' is
117117
provided.
118-
Then validates each dataset in FILES against the configuration.
119-
The default dataset patters are `**/*.zarr` and `**/.nc`.
120-
FILES may comprise also directories. If a directory is not matched
121-
by any file pattern, it will be traversed recursively.
118+
It then validates each dataset in FILES against the configuration.
119+
The default dataset patters are '**/*.zarr' and '**/.nc'.
120+
FILES may comprise also directories or URLs. The supported URL
121+
protocols are the ones supported by xarray. Using remote
122+
protocols may require installing additional packages such as
123+
S3Fs (https://s3fs.readthedocs.io/) for the 's3' protocol.
124+
125+
If a directory is provided that not matched by any file pattern,
126+
it will be traversed recursively.
122127
The validation result is dumped to standard output if not otherwise
123-
stated by `--output-file`. The output format is `simple` by default.
124-
Other inbuilt formats are `json` and `html` which you can specify
125-
using the `--format` option.
128+
stated by '--output-file'. The output format is 'simple' by default.
129+
Other inbuilt formats are 'json' and 'html' which you can specify
130+
using the '--format' option.
126131
"""
127132
from xrlint.cli.engine import XRLint
128133

0 commit comments

Comments
 (0)