extends: existence message: "Use the Oxford comma in '%s'." link: 'https://developers.google.com/style/commas' scope: sentence level: warning nonword: true # List items may be several words long, not just one. Four guards keep the # false-positive rate down: # # 1. The comma can't be the one closing a fronted subordinate clause # ('When your alarm rings, you turn it off and tumble out of bed.') -- # that comma separates clauses, not list items. Only the first comma of # such a sentence is exempt, so 'When it rains, apples, pears or bananas # get wet.' is still caught. # 2. The item can't open with a clause-introducer (', which ...', # ', specifically ...'). # 3. The item can't open with a subject pronoun followed by a verb, which # marks a compound predicate rather than a list ('..., you walk to the # fridge and get a snack.'). A pronoun directly followed by 'and'/'or' # is a real list item, so ', you and me.' still matches. # 4. Neither item may contain an auxiliary verb, which is another compound # predicate signal (', it has some downsides and is officially # discouraged.'). # # The trailing anchor allows end-of-scope so list fragments ('Apples, pears # or bananas') are still caught. tokens: - '(?