Skip to content

Commit b4e49da

Browse files
committed
community standards
1 parent 7025422 commit b4e49da

File tree

3 files changed

+121
-63
lines changed

3 files changed

+121
-63
lines changed

CODE_OF_CONDUCT.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Code of Conduct
2+
3+
We are committed to providing a friendly, safe, and welcoming environment
4+
for all, regardless of gender, sexual orientation, ability, ethnicity,
5+
religion, or any other characteristic.
6+
7+
We expect everyone to treat each other with respect and kindness. We do not
8+
tolerate harassment or discrimination of any kind.
9+
10+
If you witness or experience any behavior that violates this code of conduct,
11+
please report it to the project maintainers immediately.
12+
13+
Thank you for helping us create a welcoming community!

CONTRIBUTING.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# How to contribute
2+
3+
The XRLint project welcomes contributions of any form
4+
as long as you respect our [code of conduct](CODE_OF_CONDUCT.md) and stay
5+
in line with the following instructions and guidelines.
6+
7+
If you have suggestions, ideas, feature requests, or if you have identified
8+
a malfunction or error, then please
9+
[post an issue](https://github.com/bcdev/xrlint/issues).
10+
11+
If you'd like to submit code or documentation changes, we ask you to provide a
12+
pull request (PR)
13+
[here](https://github.com/bcdev/xrlint/pulls).
14+
For code and configuration changes, your PR must be linked to a
15+
corresponding issue.
16+
17+
To ensure that your code contributions are consistent with our project’s
18+
coding guidelines, please make sure all applicable items of the following
19+
checklist are addressed in your PR.
20+
21+
**PR checklist**
22+
23+
* Format code using [black](https://black.readthedocs.io/) with default settings.
24+
Check also section [code style](#code-style) below.
25+
* Your change shall not break existing unit tests.
26+
`pytest` must run without errors.
27+
* Add unit tests for any new code not yet covered by tests.
28+
* Make sure test coverage stays close to 100% for any change.
29+
Use `pytest --cov=zappend --cov-report=html` to verify.
30+
* If your change affects the current project documentation,
31+
please adjust it and include the change in the PR.
32+
Run `mkdocs serve` to verify.
33+
34+
## Code style
35+
36+
The XRLint code complies to [PEP-8](https://pep8.org/) except for a line
37+
length of 88 characters as recommended by [black](https://black.readthedocs.io/).
38+
Since black is un-opinionated regarding the order of imports,
39+
we use the following three import blocks separated by an empty
40+
line:
41+
42+
1. Python standard library imports, e.g., `os`, `typing`, etc
43+
2. 3rd-party imports, e.g., `xarray`, `zarr`, etc
44+
3. XRLint module imports:
45+
Prefer absolute import paths: `from xrlint.a.b.c import d`.
46+
Relative imports such as `from .c import d` are ok
47+
while `..c import d` are not ok.
48+
49+
Use `typing.TYPE_CHECKING` to resolve forward references
50+
and effectively avoid circular dependencies.
51+
52+
## Contributing Rules
53+
54+
### Rule Naming
55+
56+
The rule naming conventions for XRLint are the same as or ESLint:
57+
58+
* Lower-case only.
59+
* Use dashes between words (kebab-case).
60+
* If your rule only disallows something,
61+
prefix it with `no-` such as `no-empty-attrs` for disallowing
62+
empty attributes in dataset nodes.
63+
* If your rule is enforcing the inclusion of something,
64+
use a short name without a special prefix.
65+
* Plugins should add a prefix before their rule names
66+
separated by a slash, e.g., `xcube/spatial-dims-order`.
67+
68+
### Rule Design
69+
70+
* The reasoning behind a rule should be **easy to grasp**.
71+
72+
* A rule should serve for a **single purpose only**. Try subdividing
73+
complex rule logic into multiple rules with simpler logic.
74+
75+
* Each rule should be defined in a dedicated module named after the rule,
76+
i.e., `<plugin>/rules/<rule>`. The module name should be the rule's name
77+
with dashes replaced by underscores.
78+
79+
* Write a comprehensive test for your rule logic using
80+
`xrlint.testing.RuleTester`. It should be defined in a dedicated
81+
test module, i.e., `tests/rules/test_<rule>`.

README.md

Lines changed: 27 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -20,56 +20,36 @@ Its design is heavily inspired by [ESLint](https://eslint.org/).
2020
- `xcube`: Implementing the rules for
2121
[xcube datasets](https://xcube.readthedocs.io/en/latest/cubespec.html)
2222

23-
## Contributing Rules
23+
## Currents To-Dos
2424

25-
### Rule Naming
25+
### Required
2626

27-
The rule naming conventions for XRLint are the same as or ESLint:
28-
29-
* Lower-case only.
30-
* Use dashes between words (kebab-case).
31-
* If your rule only disallows something,
32-
prefix it with `no-` such as `no-empty-attrs` for disallowing
33-
empty attributes in dataset nodes.
34-
* If your rule is enforcing the inclusion of something,
35-
use a short name without a special prefix.
36-
* Plugins should add a prefix before their rule names
37-
separated by a slash, e.g., `xcube/spatial-dims-order`.
38-
39-
### Rule Design
40-
41-
* The reasoning behind a rule should be **easy to grasp**.
42-
43-
* A rule should serve for a **single purpose only**. Try subdividing
44-
complex rule logic into multiple rules with simpler logic.
45-
46-
* Each rule should be defined in a dedicated module named after the rule,
47-
i.e., `<plugin>/rules/<rule>`. The module name should be the rule's name
48-
with dashes replaced by underscores.
49-
50-
* Write a comprehensive test for your rule logic using
51-
`xrlint.testing.RuleTester`. It should be defined in a dedicated
52-
test module, i.e., `tests/rules/test_<rule>`.
53-
54-
# TODO
27+
- populate `core` plugin by more rules
28+
- populate `xcube` plugin by more rules
29+
- add `docs`
30+
- configure api docs, use mkdocstrings ref syntax in docstrings
31+
- generate markdown rule reference for the docs
32+
- CI for package publishing
5533

34+
### Desired
35+
36+
- add some more tests so we reach 99% coverage
5637
- introduce `dataset_options` config:
57-
- `opener: OpenerOp`
58-
- `opener_options: dict[str, Any]`
59-
- add more tests, +coverage
38+
- `opener: OpenerOp`
39+
- `opener_options: dict[str, Any]`
40+
- implement `autofix` feature
41+
42+
### Nice to have
43+
6044
- use `RuleMeta.type`, it is currently unused
6145
- use `RuleTest.expected`, it is currently unused
6246
- use `processor: ProcessorOp` config, it is currently unused
63-
- add docs / api docs
64-
- add CI
65-
- generate rule ref
66-
- populate `core` plugin
67-
- populate `xcube` plugin
68-
- autofixing feature
47+
- add missing community standards,
48+
see https://github.com/bcdev/xrlint/community
6949

70-
# Ideas
50+
## Ideas
7151

72-
## Plugins
52+
### Other plugins
7353

7454
- `sgrid`: https://sgrid.github.io/sgrid/
7555
- `ugrid`: https://ugrid-conventions.github.io/ugrid-conventions/
@@ -95,26 +75,10 @@ To support the CLI mode, we need different data opener
9575
types that can read the data from a file path.
9676

9777
1. open data, if given data is a file path:
98-
a. find opener for file path
99-
b. open data
78+
- find opener for file path
79+
- open data
10080
2. verify data
101-
a. find root element type and visitor type for data
102-
b. call the root element `accept(verifier)` that verifies the
103-
root element `verify.root()` and starts traversal of
104-
child elements.
105-
106-
107-
## Config design
108-
109-
- config
110-
- plugins[str, plugin]
111-
- rules[str, rule_config]
112-
- settings[str, any]
113-
- ...
114-
- files
115-
- ignores
116-
117-
- plugin
118-
- meta
119-
- rules[str, rule]
120-
- processors
81+
- find root element type and visitor type for data
82+
- call the root element `accept(verifier)` that verifies the
83+
root element `verify.root()` and starts traversal of
84+
child elements.

0 commit comments

Comments
 (0)