Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/forbidden-words.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Forbidden Words Check

on:
pull_request:
branches: [ "*" ]

jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: npm install

- name: Run forbidden words check
run: node tools/scripts/check-forbidden-words.js
40 changes: 40 additions & 0 deletions tools/scripts/check-forbidden-words.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import fs from "fs";
import path from "path";
import forbiddenWords from "../static/forbidden-words.json" assert { type: "json" };


const forbidden = forbiddenWords.forbiddenWords;
const docsDir = "./src/content/docs";

let hasErrors = false;

function scanFile(filePath) {
const content = fs.readFileSync(filePath, "utf8");

forbidden.forEach(word => {
if (content.toLowerCase().includes(word)) {
console.log(`❌ Forbidden word "${word}" found in: ${filePath}`);
hasErrors = true;
}
});
}

function walk(dir) {
fs.readdirSync(dir).forEach(file => {
const fullPath = path.join(dir, file);

if (fs.statSync(fullPath).isDirectory()) {
walk(fullPath);
} else if (file.endsWith(".md")) {
scanFile(fullPath);
}
});
}

walk(docsDir);

if (hasErrors) {
process.exit(1);
} else {
console.log("✅ No forbidden words found");
}
24 changes: 24 additions & 0 deletions tools/static/forbidden-words.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"forbiddenWords": [
"obviously",
"simply",
"easily",
"just",
"basically",
"clearly",
"literally",
"actually",
"needless to say",
"as you know",
"hack",
"kludge",
"stupid",
"dumb",
"crazy",
"weird",
"awful",
"horrible",
"bad code",
"broken"
]
}
Loading