Skip to content

CaffeineDuck/Balderdash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Balderdash [WIP]

Balderdash is a profanity checker tool for your codebase. It was created to that you won't have to worry about mistakenly commiting curse words or some not-so-appropriate words to your main branch.

It's a simple shell script and can run on almost any Unix system. It was created in shell due to how simple it was to write it. I have no plans of moving it to other languages and adding more graphic features.

Features

  • Extremely fast search using ag.
  • Multi language support.
  • Custom white-list/ black-list support.
  • Files in .gitignore and .ignore are automatically ignored.
  • Very modular CLI.
  • Pre commit hook support.
  • [TODO] Github actions support.

Installation

You'll need to have ag installed in your system. ag is very fast code searcher.

The following script adds balderdash script to your /bin.

curl -Ls https://raw.githubusercontent.com/CaffeineDuck/Balderdash/main/install.sh | bash

You'll need to run init after installing the script.

balderdash init

Using pre-commit hook

  • Add to your hooks.
repos:
  - repo: https://github.com/caffeineDuck/balderdash
    rev: $LATEST_VERSION
    hooks:
      - id: balderdash
  • Install the balderdash CLI and run the balderdash init command.

CLI Usage Examples

  • Checking the current directory for profanity
balderdash check
  • Checking specific dir for profanity
balderdash check -d dir/
  • Checking specific file for profanity
balderdash check -f app.py
  • Checking from your custom parsed wordlist
bash check -f app.py -w parsed_wordlist.txt

Note: Your wordlist must follow Extended Regex format

CLI Reference

Balderdash is a tool to find profanity in files

Usage: balderdash [command] [options]

Commands:
  init|i: Initialize the config file
  help|h: Display this help message
  check|c <-f|-c|-w|-d>: Check a file/dir for profanity
  download|dw <-c>: Download the profanity list according to language selection

Options:
  -f [FILE]: Specify a file to check
  -c [FILE]: Specify a config file
  -d [DIR]: Specify a directory to check
  -w [FILE]: Specify a file containing profanity words list

Configuration

You can configure how the CLI and works through the config file in your ~/.config/balderdash/balderdash.conf file. It can be used to customize blacklisted words, white-listed words.

  • Add new language to the checker (balderdash.conf):
LANGUAGES=(en np fr au)

You can check the list of supported languages in the words directory. You can create a PR and add your own language or words to a specific language there

  • Add custom white-listed/ black-listed words (balderdash.conf):
DEFAULT_WHITELIST=(gosh shit)
DEFAULT_BLACKLIST=(sudo pipenv)

If it's a multi word black-list/ white-list wrap it in double quotes