Skip to content

OxfordComma: v0.7.0 stopped flagging lists whose predicate uses is/are/has/have #64

Description

@Adrastopoulos

The v0.7.0 rewrite added four guards against compound predicates. The auxiliary-verb guard also silences genuine missing serial commas: a list that v0.6.3 caught is now silent when its predicate uses is, are, has or have.

Same three sentences, same config, three releases:

sentence v0.6.3 v0.7.0 v0.7.1
Apples, pears or bananas are fruit. flagged silent silent
Cats, dogs or birds have owners. flagged silent silent
Cats, dogs or birds need food. flagged flagged flagged

All three are three-item lists missing the serial comma, so all three should be flagged. Rows 2 and 3 differ only in the verb.

Reproduce

b=$(mktemp -d); cd "$b"; mkdir -p styles
for v in 0.6.3 0.7.0 0.7.1; do
  curl -sL "https://github.com/vale-cli/Google/releases/download/v$v/Google.zip" -o "$v.zip"
  unzip -oq "$v.zip" -d "x$v" && mv "x$v/Google" "styles/G$(echo $v | tr -d .)"
done
printf 'StylesPath = %s/styles\nMinAlertLevel = suggestion\n[*.md]\nBasedOnStyles = G063, G070, G071\n' "$b" > cfg.ini
printf 'Apples, pears or bananas are fruit.\n\nCats, dogs or birds have owners.\n\nCats, dogs or birds need food.\n' > t.md
vale --config=cfg.ini --output=line t.md | grep OxfordComma
t.md:1:1:G063.OxfordComma:Use the Oxford comma in 'Apples, pears or'.
t.md:3:1:G063.OxfordComma:Use the Oxford comma in 'Cats, dogs or'.
t.md:5:1:G063.OxfordComma:Use the Oxford comma in 'Cats, dogs or'.
t.md:5:5:G070.OxfordComma:Use the Oxford comma in ', dogs or birds need food.'.
t.md:5:5:G071.OxfordComma:Use the Oxford comma in ', dogs or birds need food.'.

One trap if you reproduce this: the three packages need distinct style names. A package named Google in a local StylesPath is shadowed by a globally installed Google, and the run silently uses the installed copy. I lost a while to that before renaming them.

Why it happens

Guard 4 rejects a match when either item contains is|are|was|were|has|have|had|be|been|being|will|would|can|could|should|may|might|must|do|does|did. In row 2 the second item is bananas are fruit, so the guard rejects a real list. The guard does what it was written to do, but a three-item list and a two-part compound predicate look the same after the comma, so suppressing one suppresses the other.

Related, and older than the guards

A two-item coordination after a comma is still reported as a missing serial comma. This one fires in v0.6.3 too, so it is not from the rewrite:

You can write it two ways: an em dash, spaced or bare.
-> Use the Oxford comma in ', spaced or bare.'

There is no series here, so by the guidance the rule links to there is nothing to fix. I mention it only because it has the same root: the pattern reads the text after the comma and cannot count items.

If the arity has to be visible, extends: sequence supports part-of-speech tags, so the rule could require parallel nouns and drop spaced or bare while keeping pears or bananas. That is a much larger change than a token edit, so I would treat the table as the actionable part and this as context.

For context on the guards themselves, #63 reported the compound-predicate false positives that v0.7.1 refined.

Environment: Vale 3.17.1, macOS arm64, packages taken from the release archives above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions