Tests scoping down SentenceSpacing somewhat
What does this MR do?
tl;dr Adds a scope (https://vale.sh/docs/topics/scoping/#markup) to SentenceSpacing.yml
, though I want a second opinion on whether I've added the correct one. Includes instructions on how to reproduce.
@mwoolf pinged me this morning with a failing pipeline in !159440 (merged), saying it was a false positive, and he was right. The SentenceSpacing.yml
rule was tripping up on this (correctly marked up) code example:
from django.db import models
class Animal(models.Model):
name = models.CharField(max_length=200)
number_of_legs = models.IntegerField(default=2) # 's.I' was flagged here
dangerous = models.BooleanField(default=False)
I've been staring at it, asking myself why this got flagged. I kept reading the rule contents over and over before I spotted the ABSENCE of something. Don't ask how long it took me to spot there's no scope
in the file:
extends: existence
message: "Use exactly one space between sentences and clauses. Check '%s' for spacing problems."
link: https://docs.gitlab.com/ee/development/documentation/styleguide/index.html#punctuation
level: error
nonword: true
tokens:
- '[a-z][.?!,][A-Z]'
- '[\w.?!,\(\)\-":] {2,}[\w.?!,\(\)\-":]'
I mean, Vale shouldn't be scanning code blocks, but @eread and @marcel.amirault and I have all encountered in the past that rules with anything regex-like can be overly grabby and tough to disable. Is that what's happening here? Is it possible that the lack of scope is letting this rule work like a raw
-scoped rule, and ingest code blocks?
I can't get this rule to fail reliably with my own edits, but you can reproduce it locally by reversing my changes to Max's merge request:
git fetch origin
-
git checkout -b 'mw/o11y/django-tutorial' 'origin/mw/o11y/django-tutorial'
from !159440 (merged) - open
doc/tutorials/observability/observability_django_tutorial.md
- Remove the rule-disabling codes on line 24 and the end of the file, and resave the file
- line 110-ish should fail
Setting any of these scopes in SentenceSpacing.yml
removes the error:
-
scope: text.html
(the broadest scope I can find) -
scope: paragraph
(narrower) -
scope: sentence
(probably too narrow but I'm unsure how to test)
I think we probably want to keep the scope of this rule as broad as possible without triggering the problem, but I need more eyes.
Related issues
Related to Add Django tutorial for observability tooling (!159440 - merged) where I spotted the problem.
Author's checklist
-
Optional. Consider taking the GitLab Technical Writing Fundamentals course. -
Follow the: -
If you're adding a new page, add the product availability details under the H1 topic title. -
If you are a GitLab team member, request a review based on: - The documentation page's metadata.
- The associated Technical Writer.
If you are a GitLab team member and only adding documentation, do not add any of the following labels:
~"frontend"
~"backend"
~"type::bug"
~"database"
These labels cause the MR to be added to code verification QA issues.
Reviewer's checklist
Documentation-related MRs should be reviewed by a Technical Writer for a non-blocking review, based on Documentation Guidelines and the Style Guide.
If you aren't sure which tech writer to ask, use roulette or ask in the #docs Slack channel.
-
If the content requires it, ensure the information is reviewed by a subject matter expert. - Technical writer review items:
-
Ensure docs metadata is present and up-to-date. -
Ensure the appropriate labels are added to this MR. -
Ensure a release milestone is set. - If relevant to this MR, ensure content topic type principles are in use, including:
-
The headings should be something you'd do a Google search for. Instead of Default behavior
, say something likeDefault behavior when you close an issue
. -
The headings (other than the page title) should be active. Instead of Configuring GDK
, say something likeConfigure GDK
. -
Any task steps should be written as a numbered list. - If the content still needs to be edited for topic types, you can create a follow-up issue with the docs-technical-debt label.
-
-
-
Review by assigned maintainer, who can always request/require the reviews above. Maintainer's review can occur before or after a technical writer review.