Skip to content

Commit 2fca218

Browse files
committed
initial docs
1 parent c74d031 commit 2fca218

File tree

8 files changed

+203
-7
lines changed

8 files changed

+203
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ __pycache__
99
*.egg-info
1010
.coverage
1111
htmlcov/
12+
site/
1213

1314
# Jupyter
1415
.ipynb_checkpoints

docs/about.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# About XRLint
2+
3+
## Changelog
4+
5+
You can find the complete XRLint changelog
6+
[here](https://github.com/bcdev/xrlint/blob/main/CHANGES.md).
7+
8+
## Reporting
9+
10+
If you have suggestions, ideas, feature requests, or if you have identified
11+
a malfunction or error, then please
12+
[post an issue](https://github.com/bcdev/xrlint/issues).
13+
14+
## Contributions
15+
16+
The XRLint project welcomes contributions of any form
17+
as long as you respect our
18+
[code of conduct](https://github.com/bcdev/xrlint/blob/main/CODE_OF_CONDUCT.md)
19+
and follow our
20+
[contribution guide](https://github.com/bcdev/xrlint/blob/main/CONTRIBUTING.md).
21+
22+
If you'd like to submit code or documentation changes, we ask you to provide a
23+
pull request (PR)
24+
[here](https://github.com/bcdev/xrlint/pulls).
25+
For code and configuration changes, your PR must be linked to a
26+
corresponding issue.
27+
28+
## Development
29+
30+
To set up development environment, with repository root as current
31+
working directory:
32+
33+
```bash
34+
pip install .[dev,doc]
35+
```
36+
37+
### Testing and Coverage
38+
39+
XRLint uses [pytest](https://docs.pytest.org/) for unit-level testing
40+
and code coverage analysis.
41+
42+
```bash
43+
pytest --cov=xrlint --cov-report html
44+
```
45+
46+
### Code Style
47+
48+
XRLint source code is formatted using the [black](https://black.readthedocs.io/) tool.
49+
50+
```bash
51+
black .
52+
```
53+
54+
### Documentation
55+
56+
XRLint documentation is built using the [mkdocs](https://www.mkdocs.org/) tool.
57+
58+
With repository root as current working directory:
59+
60+
```bash
61+
pip install .[doc]
62+
63+
mkdocs build
64+
mkdocs serve
65+
mkdocs gh-deploy
66+
```
67+
68+
## License
69+
70+
XRLint is open source made available under the terms and conditions of the
71+
[MIT License](https://github.com/bcdev/xrlint/blob/main/LICENSE).
72+
73+
Copyright © 2025 Brockmann Consult Development

docs/api.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Python API
2+
3+
All described objects can be imported from the `xrlint.all` module.
4+
5+
## Function `new_linter()`
6+
7+
::: xrlint.linter.new_linter
8+
9+
## Class `Linter`
10+
11+
::: xrlint.linter.Linter
12+
13+
## Class `Config`
14+
15+
::: xrlint.config.Config
16+
17+
## Class `RuleConfig`
18+
19+
::: xrlint.rule.RuleConfig

docs/cli.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Command Line Interface
2+
3+
After installation, the `xrlint` command can be used from the terminal.
4+
The following are the command's options and arguments:
5+
6+
```
7+
Usage: xrlint [OPTIONS] [FILES]...
8+
9+
Lint the given FILES.
10+
11+
Options:
12+
--no-default-config Disable use of default configuration from
13+
xrlint.config.*
14+
-c, --config PATH Use this configuration, overriding xrlint.config.*
15+
config options if present
16+
-f, --format NAME Use a specific output format - default: simple
17+
--max-warnings COUNT Number of warnings to trigger nonzero exit code -
18+
default: -1
19+
--version Show the version and exit.
20+
--help Show this message and exit.
21+
```

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# XRLint Documentation

mkdocs.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
site_name: XRLint
2+
repo_url: https://github.com/bcdev/xrlint
3+
repo_name: bcdev/xrlint
4+
5+
copyright: Copyright © 2025 Brockmann Consult
6+
7+
nav:
8+
- Overview: index.md
9+
- CLI: cli.md
10+
- Python API: api.md
11+
- About: about.md
12+
13+
theme:
14+
name: material
15+
# logo: assets/logo.png
16+
# favicon: assets/logo-small.png
17+
palette:
18+
# Palette toggle for light mode
19+
- scheme: default
20+
primary: blue grey
21+
toggle:
22+
icon: material/brightness-7
23+
name: Switch to dark mode
24+
# Palette toggle for dark mode
25+
- scheme: slate
26+
primary: blue grey
27+
toggle:
28+
icon: material/brightness-4
29+
name: Switch to light mode
30+
31+
markdown_extensions:
32+
- admonition
33+
- pymdownx.details
34+
- pymdownx.superfences
35+
36+
extra:
37+
social:
38+
- icon: fontawesome/brands/github
39+
link: https://github.com/bcdev/xrlint
40+
- icon: fontawesome/brands/python
41+
link: https://pypi.org/project/xrlint/
42+
43+
plugins:
44+
- search
45+
- autorefs
46+
- mkdocstrings:
47+
handlers:
48+
python:
49+
options:
50+
show_root_toc_entry: false
51+
show_root_heading: false
52+
show_source: false
53+
heading_level: 3
54+
annotations_path: brief

xrlint/config.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,8 @@ class Config(ToDictMixin):
111111

112112
@property
113113
def global_ignores(self) -> list[str]:
114-
"""Get the _global ignores_ of this configuration.
115-
116-
Returns: A list of global ignore patterns or an empty list
117-
if none are configured.
114+
"""The list of `ignores` patterns from this configuration which
115+
are _global ignores_.
118116
"""
119117
return (
120118
self.ignores

xrlint/rule.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,48 @@ class Rule:
113113

114114
@dataclass(frozen=True)
115115
class RuleConfig:
116-
"""Rule configuration.
116+
"""A rule configuration.
117117
118118
Args:
119-
severity: 0, 1, 2
120-
119+
severity: rule severity, one of `2` (error), `1` (warn), or `0` (off)
120+
args: rule operation arguments.
121+
kwargs: rule operation keyword-arguments.
121122
"""
122123

123124
severity: Literal[0, 1, 2]
125+
"""Rule severity."""
126+
124127
args: tuple[Any, ...] = field(default_factory=tuple)
128+
"""Rule operation arguments."""
129+
125130
kwargs: dict[str, Any] = field(default_factory=dict)
131+
"""Rule operation keyword-arguments."""
126132

127133
@classmethod
128134
def from_value(cls, value: Any) -> "RuleConfig":
135+
"""Convert `value` into a `RuleConfig` object.
136+
137+
A rule configuration value can either be a rule _severity_,
138+
or a list where the first element is a rule
139+
_severity_ and subsequent elements are rule arguments:
140+
141+
- _severity_
142+
- `[`_severity_`]`
143+
- `[`_severity_`,` _arg-1 | kwargs_ `]`
144+
- `[`_severity_`,` _arg-1_`,` _arg-2_`,` ...`,` _arg-n | kwargs_`]`
145+
146+
The rule _severity_ is either
147+
148+
- one of `"error"`, `"warn"`, `"off"` or
149+
- one of `2` (error), `1` (warn), `0` (off)
150+
151+
Args:
152+
value: A rule severity or a list where the first element is a rule
153+
severity and subsequent elements are rule arguments.
154+
If the value is already of type `RuleConfig`it is returned as-is.
155+
Returns:
156+
A `RuleConfig` object.
157+
"""
129158
if isinstance(value, RuleConfig):
130159
return value
131160

0 commit comments

Comments
 (0)