Skip to content

Commit 6f95f0c

Browse files
authored
Add Vale for prose linting (#458)
1 parent d8e5632 commit 6f95f0c

File tree

14 files changed

+136
-13
lines changed

14 files changed

+136
-13
lines changed

.github/styles/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# only track the custom Vale rules
2+
/*
3+
!.gitignore
4+
!custom/

.github/styles/custom/dashes.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
extends: existence
3+
message: Don't put a space before or after a dash.
4+
nonword: true
5+
level: warning
6+
action:
7+
name: edit
8+
params:
9+
- remove
10+
- " "
11+
tokens:
12+
- \s[—–]\s

.github/styles/custom/endash.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
extends: existence
3+
message: >-
4+
Avoid en dashes ('–'). For hyphenated words, use a hyphen ('-').\nFor
5+
parenthesis, use an em dash ('—').
6+
nonword: true
7+
level: error
8+
action:
9+
name: edit
10+
params:
11+
- replace
12+
- "-"
13+
-
14+
tokens:
15+
-
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
extends: substitution
3+
message: Use '%s' instead of '%s.'
4+
level: error
5+
ignorecase: true
6+
swap:
7+
aren't: are not,
8+
can't: cannot,
9+
couldn't: could not,
10+
didn't: did not,
11+
doesn't: does not,
12+
don't: do not,
13+
hasn't: has not,
14+
haven't: have not,
15+
how'll: how will,
16+
how's: how is,
17+
isn't: is not,
18+
it'll: it will,
19+
it's: it is,
20+
shouldn't: should not
21+
that'll: that will,
22+
that's: that is,
23+
they'll: they will,
24+
they're: they are,
25+
wasn't: was not,
26+
we'll: we will,
27+
we're: we are,
28+
we've: we have,
29+
weren't: were not,
30+
what'll: what will,
31+
what's: what is,
32+
when'll: when will,
33+
when's: when is,
34+
where'll: where will,
35+
where's: where is,
36+
who'll: who will,
37+
who's: who is,
38+
why'll: why will,
39+
why's: why is,
40+
won't: will not,
41+
you're: you are
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
extends: existence
3+
message: Use the Oxford comma in '%s'.
4+
scope: sentence
5+
level: suggestion
6+
tokens:
7+
- (?:[^,]+,){1,}\s\w+\s(?:and|or)

.github/styles/custom/quotes.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
extends: existence
3+
message: Use straight quotes instead of smart quotes.
4+
level: error
5+
nonword: true
6+
action:
7+
tokens:
8+
-
9+
-
10+
-
11+
-

.github/styles/custom/spaces.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
extends: existence
3+
message: Use only one space between words and sentences (not two).
4+
level: error
5+
nonword: true
6+
tokens:
7+
- "[\\w.?!,()\\-\":] {2,}[\\w.?!,()\\-\":]"

.github/workflows/linting.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ jobs:
1616
- uses: paddyroddy/.github/actions/linting@7193f2d6fda65de74a0d750fd19f53314f899200 # v0
1717
with:
1818
pre-commit-config: ./.pre-commit-config.yaml
19+
20+
# yamllint disable-line rule:line-length
21+
- uses: paddyroddy/.github/actions/vale@d5aea086eaabccae4bcf39786ad5138b629755a6 # v0
22+
with:
23+
github-token: ${{ secrets.GITHUB_TOKEN }}

.typos.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[type.yaml]
2+
extend-words.yse = "yse"

.vale.ini

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
StylesPath = .github/styles
2+
3+
# https://github.com/errata-ai/packages
4+
Packages = proselint
5+
6+
[*.md]
7+
BasedOnStyles = custom,\
8+
proselint,\
9+
Vale
10+
11+
# Disable
12+
Vale.Spelling = NO
13+
14+
# the paper is already submitted so cannot be changed
15+
[paper/paper.md]
16+
BasedOnStyles =
17+
18+
# `vale sync` in CI means the packages are then linted, so turn them off
19+
[.github/styles/**]
20+
BasedOnStyles =

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
We as members, contributors, and leaders pledge to make participation in our
66
community a harassment-free experience for everyone, regardless of age, body
7-
size, visible or invisible disability, ethnicity, sex characteristics, gender
7+
size, visible/invisible disability, ethnicity, sex characteristics, gender
88
identity and expression, level of experience, education, socio-economic status,
99
nationality, personal appearance, race, religion, or sexual identity and
1010
orientation.

CONTRIBUTING.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ section before making your contribution. It will make it a lot easier for us
99
maintainers and smooth out the experience for all involved. The community looks
1010
forward to your contributions. 🎉
1111

12-
> And if you like the project, but just don't have time to contribute, that's
12+
> And if you like the project, but just do not have time to contribute, that is
1313
> fine. There are other easy ways to support the project and show your
14-
> appreciation, which we would also be very happy about:
14+
> appreciation, which we would also be happy about:
1515
>
1616
> - Star the project
1717
> - Tweet about it
@@ -40,7 +40,7 @@ If you then still feel the need to ask a question and need clarification, we
4040
recommend the following:
4141

4242
- Open an [Issue](https://github.com/astro-informatics/sleplet/issues/new).
43-
- Provide as much context as you can about what you're running into.
43+
- Provide as much context as you can about what you are running into.
4444
- Provide project and platform versions (python etc.), depending on what seems
4545
relevant.
4646

@@ -58,7 +58,7 @@ We will then take care of the issue as soon as possible.
5858

5959
#### Before Submitting a Bug Report
6060

61-
A good bug report shouldn't leave others needing to chase you up for more
61+
A good bug report should not leave others needing to chase you up for more
6262
information. Therefore, we ask you to investigate carefully, collect information
6363
and describe the issue in detail in your report. Please complete the following
6464
steps in advance to help us fix any potential bug as fast as possible.
@@ -95,7 +95,7 @@ We use GitHub issues to track bugs and errors. If you run into an issue with the
9595
project:
9696

9797
- Open an [Issue](https://github.com/astro-informatics/sleplet/issues/new).
98-
(Since we can't be sure at this point whether it is a bug or not, we ask you
98+
(Since we cannot be sure at this point whether it is a bug or not, we ask you
9999
not to talk about a bug yet and not to label the issue.)
100100
- Explain the behaviour you would expect and the actual behaviour.
101101
- Please provide as much context as possible and describe the _reproduction_
@@ -104,7 +104,7 @@ project:
104104
problem and create a reduced test case.
105105
- Provide the information you collected in the previous section.
106106

107-
Once it's filed:
107+
Once it is filed:
108108

109109
- The project team will label the issue accordingly.
110110
- A team member will try to reproduce the issue with your provided steps. If
@@ -131,10 +131,10 @@ and the community to understand your suggestion and find related suggestions.
131131
- Perform a [search](https://github.com/astro-informatics/sleplet/issues) to see
132132
if the enhancement has already been suggested. If it has, add a comment to the
133133
existing issue instead of opening a new one.
134-
- Find out whether your idea fits with the scope and aims of the project. It's
134+
- Find out whether your idea fits with the scope and aims of the project. It is
135135
up to you to make a strong case to convince the project's developers of the
136136
merits of this feature. Keep in mind that we want features that will be useful
137-
to the majority of our users and not just a small subset. If you're just
137+
to the majority of our users and not just a small subset. If you are just
138138
targeting a minority of users, consider writing an add-on/plugin library.
139139

140140
#### How Do I Submit a Good Enhancement Suggestion?

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@ the figures in
5959
Windows is not currently supported as `SLEPLET` relies on
6060
[pyssht](https://pypi.org/project/pyssht) and
6161
[pys2let](https://pypi.org/project/pys2let) which do not work on Windows. These
62-
can hopefully be replaced with
63-
[s2fft](https://github.com/astro-informatics/s2fft) and
62+
may be replaced with [s2fft](https://github.com/astro-informatics/s2fft) and
6463
[s2wav](https://github.com/astro-informatics/s2wav) in the future when they are
6564
available on [PyPI](https://pypi.org).
6665

documentation/DOCUMENTATION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ arbitrary region. The default region is the `south_america` arbitrary region.
5656
## Paper Figures
5757

5858
To recreate the figures from the below papers, one may use the CLI or the API.
59-
For those which don't use the `mesh` or `sphere` CLIs, the relevant API code
60-
isn't provided as it is contained within the
59+
For those which do not use the `mesh` or `sphere` CLIs, the relevant API code is
60+
not provided as it is contained within the
6161
[examples folder](https://github.com/astro-informatics/sleplet/tree/main/examples).
6262

6363
### Sifting Convolution on the Sphere

0 commit comments

Comments
 (0)