woke

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2020 License: MIT Imports: 5 Imported by: 0

README

woke

GoDoc MIT License

woke is a text file analysis tool that detects non-inclusive language in your source code.

Creating an inclusive work environment is imperitive to a healthy, supportive, and productive culture, and an environment where everyone feels welcome and included.

woke's purpose is to point out places where improvements can be made by removing non-inclusive language and replacing it with more inclusive alternatives.

Companies like GitHub, Twitter, and Apple are already pushing these changes.

Installation

Using woke is straightforward. First, use go get to install the latest version (requires go, more instructions for non-go installation coming soon).

go get -u github.com/caitlinelfring/woke

woke should be installed to $GOPATH/bin/woke.

Usage

$ woke --help

woke is a linter that will check your source code for usage of non-inclusive
language and provide suggestions for alternatives. Rules can be customized
to suit your needs.

Provide a list of comma-separated file globs for files you'd like to check.

Usage:
  woke (file globs to check) [flags]

Flags:
      --exit-1-on-failure    Exit with exit code 1 on failures. Otherwise, will always exit 0 if any failures occur
  -h, --help                 help for woke
  -r, --rule-config string   YAML file with list of rules (default "default.yaml")
File globs

By default, woke will run against all text files in your current directory. To change this, supply a comma-separated list of globs as the first argument.

This can be something like **/*.go, or a comma-separated list of filenames.

$ woke test.txt
[test.txt:2:2] Instead of 'Blacklist', consider the following alternative(s): 'denylist,blocklist'
[test.txt:3:2] Instead of 'White-list', consider the following alternative(s): 'allowlist'
[test.txt:4:2] Instead of 'whitelist', consider the following alternative(s): 'allowlist'
[test.txt:5:2] Instead of 'blacklist', consider the following alternative(s): 'denylist,blocklist'
Rules

A set of default rules is provided in example.yaml. You can supply your own rules with -r path/to/rules.yaml

The syntax for rules is very basic. You just need a name, a regex used to match, and a string of alternatives.

rules:
  - name: whitelist
    regexp: \b(white-?list)\b
    alternatives: allowlist
Ignoring files

In your config file, you can ignore files by adding:

ignore_files:
  - .git/*
  - other/files/in/repo
  - globs/too/*

woke will also automatically ignore anything listed in .gitignore.

woke uses gobwas/glob to parse ignore globs. See link for more details on matching

Exit Code

By default, woke will exit with a successful exit code when there are any rule failures. The idea is, if you run woke on PRs, you may not want to block a merge, but you do want to inform the author that they can make better word choices.

If you're using work on PRs, you can choose to enforce these rules with a non-zero exit code, but running work --exit-1-on-failure.

TODO

  • Benchmarking
  • Tests
  • What happens when run on a large repo?
  • GitHub Actions
  • More rules

Resources

License

This application is licensed under the MIT License, you may obtain a copy of it here.

Documentation

Overview

Copyright © 2020 Caitlin Elfring <celfring@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
Package cmd Copyright © 2020 Caitlin Elfring <celfring@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
Package cmd Copyright © 2020 Caitlin Elfring <celfring@gmail.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL