This rule checks for cases where punctuation marks (specifically periods and commas) are placed outside of quotation marks rather than inside them. This aligns with standard American English punctuation rules and Microsoft's Style Guide, which specify that periods and commas should be placed inside quotation marks.
The correct placement of punctuation relative to quotation marks is an important aspect of maintaining consistent and professional writing. While British English may follow different conventions, in American English and according to Microsoft's style guidelines, periods and commas should always go inside the quotation marks.
Examples:
Would flag ❌:
- He said "hello". (incorrect)
- The file was labeled "output.txt", (incorrect)
Should be ✓:
- He said "hello."
- The file was labeled "output.txt,"
The rule uses a regular expression pattern to find instances where a quotation mark is followed by any content (except other quotation marks), followed by another quotation mark, and then immediately followed by either a period or comma. This pattern effectively identifies cases where the punctuation has been incorrectly placed outside the closing quotation mark.