AMW-590 Collection spelling and grammar checking for PRs#24
AMW-590 Collection spelling and grammar checking for PRs#24RanabirChakraborty wants to merge 1 commit into
Conversation
|
A couple of notes:
|
|
|
||
|
|
||
| def _load_accepted_terms(): | ||
| """Load accepted spelling terms from the shared Vale vocabulary file.""" |
| SKIP_RULES = { | ||
| "write-good.TooWordy", | ||
| "write-good.Weasel", | ||
| } |
There was a problem hiding this comment.
Couldn't this be part of a shared vale.ini that can be overridden by a project's own vale.ini?
5391576 to
00a2a10
Compare
|
@iweiss Thanks for the suggestions, Fixed it accordingly. |
| current = parent | ||
|
|
||
|
|
||
| VALE_CONFIG = _find_vale_config() |
There was a problem hiding this comment.
Currently it silently returns a nonexistent path. We can add an error msg to handle this and also in the README we have mentioned that in every collection root path we need to have .vale.ini file present.
| with tempfile.NamedTemporaryFile( | ||
| mode='w', suffix='.md', dir=PROJECT_ROOT, delete=False | ||
| ) as tmp: | ||
| tmp.write(clean + '\n') |
There was a problem hiding this comment.
What is being accomplished by writing this temporary file?
There was a problem hiding this comment.
Actually Vale's CLI only accepts file paths, it has no stdin mode. Adding a comment here.
| FQCN | ||
| Jinja | ||
| jinja | ||
| playbook |
There was a problem hiding this comment.
Isn't this in the standard English dictionary?
| colocated | ||
| multicast | ||
| infinispan | ||
| idempotency |
| utils | ||
| repo | ||
| repos | ||
| boolean |
| It runs two checks in every pull request: | ||
|
|
||
| 1. **Prose files** — Vale lints all Markdown and RST files in the collection using the styles configured in the project's `.vale.ini`. | ||
| 2. **Ansible YAML name fields** — A Python script extracts `name:` fields from task files, handler files, playbooks, and Molecule scenarios and runs them through Vale individually, suppressing rules that are too noisy for short imperative strings. |
| Spell and grammar checking for ansible-middleware collections using [Vale](https://vale.sh/). | ||
| It runs two checks in every pull request: | ||
|
|
||
| 1. **Prose files** — Vale lints all Markdown and RST files in the collection using the styles configured in the project's `.vale.ini`. |
There was a problem hiding this comment.
I don't see a .vale.ini in this PR. Is this on purpose?
There was a problem hiding this comment.
I think .vale.ini should be independent to the collection, that's why haven't provided any .vale.ini here, we can add one in the collection root path. Also added an example in README.
| name: Spelling and Grammar check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 |
There was a problem hiding this comment.
Always suggest and use the latest version of an action, even in examples.
| @@ -0,0 +1,106 @@ | |||
| Ranabir | |||
There was a problem hiding this comment.
Can't the authors key/array be excluded from checking?
| TokenIgnores = (?:[a-z][a-z\d]*_)+[a-z\d_]+ | ||
| ``` | ||
|
|
||
| `TokenIgnores` is important: it prevents Vale from spell-checking Ansible `snake_case` variable names inside prose. |
There was a problem hiding this comment.
What do you mean by "inside prose" in this context?
There was a problem hiding this comment.
like for this case, jboss_home appears within a sentence in a Markdown or RST file. Vale would split it at underscores and flag jboss and home separately as misspelled words. Inside prose means the underscored vars. Explained in the comment as well.
00a2a10 to
9880727
Compare
Issue: http://redhat.atlassian.net/browse/AMW-590