Coder Social home page Coder Social logo

balderdash's Introduction

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

balderdash's People

Contributors

caffeineduck avatar neeraj319 avatar pratikneupane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.