Developer Portal for YouTrack and Hub Help

Profanity Blocker

This workflow blocks the submission of a description or comment if it contains a word from the blacklist.



Previous Title

Spam Blacklist




Block descriptions and comments that contain stop words (on-change rule)

profanity-common.js (custom script)

Use Case

This workflow prevents users from submitting issues or comments that contain offensive language. You can edit the rule to add words to or remove words from the blacklist.


This workflow contains two modules. The first is an on-change rule that checks the description and comment to see if it contains any word on the blacklist. The second module is a custom script.

Block descriptions and comments that contain stop words

When an issue is reported or updated, this rule checks the description and comment to see if it contains any word on the blacklist. If true, a warning is displayed. The user is informed that the description or comment contains one or more words from the blacklist.

const entities = require('@jetbrains/youtrack-scripting-api/entities'); const workflow = require('@jetbrains/youtrack-scripting-api/workflow'); const profanity = require('./profanity-common'); exports.rule = entities.Issue.onChange({ title: 'Block descriptions and comments that contain stop words', action: (ctx) => { const issue = ctx.issue; const texts = []; function add(text) { if (text) { texts.push(text); } } issue.getAdded('comments').forEach(function (comment) { add(comment.text); }); const becomesReported = issue.becomesReported; if (becomesReported || issue.isChanged('summary')) { add(issue.summary); } if (becomesReported || issue.isChanged('description')) { add(issue.description); } texts.forEach(function (text) { text = text.toLowerCase(); profanity.words().forEach(function (badWord) { let index = text.indexOf(badWord); while (index !== -1) { const sepBefore = index === 0 || profanity.separators.indexOf(text.substring(index - 1, index)) > -1; const endIndex = index + badWord.length; const sepAfter = endIndex === text.length || profanity.separators.indexOf(text.substring(endIndex, endIndex + 1)) > -1; workflow.check(!(sepBefore && sepAfter), 'Using the word {0} is prohibited', badWord); index = text.indexOf(badWord, endIndex); } }); }); } });


This custom script contains all of the words in the stop list. This script is referenced in the on-change rule in the const profanity = require('./profanity-common'); declaration.

If you find any profane words that are reported in your issues or any other words that you want to block, you can update the list of words in this module without modifying the workflow rule.

exports.words = function () { return '<a comma-separated list of stop words>' .split(', ').map(function (word) { return word.toLowerCase(); }); }; exports.separators = '~`!@#$%^&*()-_+=[]{}:;\'\"\\|,<.>/? \n\r\t';
Last modified: 30 April 2024