Skip to content

Match profanity words case-insensitively and across punctuation - #382

Merged
Cannonb4ll merged 1 commit into
ploi:mainfrom
theluckystrike:fix/ploi-profanity-case-punct
Oct 7, 2026
Merged

Cannonb4ll merged 1 commit into
ploi:mainfrom
theluckystrike:fix/ploi-profanity-case-punct

Conversation

@theluckystrike

Copy link
Copy Markdown
Contributor

ProfanityCheck split the content on single spaces and compared each piece with a case-sensitive in_array. Because of that, "Fuck", a word with punctuation right after it, a word on a new line and the default multi-word entry "screw you" weren't caught.

Each configured entry is now matched as a whole word or phrase, ignoring case. Any whitespace is allowed between the words of a phrase. Words that only contain an entry, like "Dickens" or "class", are still allowed. Empty entries are ignored.

Note that matching is now case-insensitive, so an entry like "dick" also blocks "Dick".

Added a unit test for the rule. It fails on the current main and passes with this change.

ProfanityCheck split content on single spaces and compared each piece
with a case-sensitive in_array, so "Fuck", "fuck!", newline-separated
words and the default multi-word entry "screw you" were never caught.

Match each configured entry as a whole word or phrase, ignoring case and
allowing any whitespace between the words of a phrase. Words that only
contain an entry (e.g. "Dickens") are still allowed.
@Cannonb4ll
Cannonb4ll merged commit 04be3cb into ploi:main Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants