-
Notifications
You must be signed in to change notification settings - Fork 599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI Docs: Using an inclusive linter #726
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8afd6d2
Add docs about using an inclusive linter
jeremydelacruz d768576
Address markdown lint errors
jeremydelacruz 60b3260
Improve clarity
jeremydelacruz baad449
Address PR comments
jeremydelacruz bc3f1fd
Address PR comments
jeremydelacruz 4fad5ee
Address PR comments and add link to inclusive linting section in main…
jeremydelacruz 6a24670
Add link to woke action with reviewdog
jeremydelacruz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Inclusive Linting | ||
|
||
As software professionals we should strive to promote an inclusive work environment, which naturally extends to the code and documentation we write. It's important to keep the use of inclusive language consistent across an entire project or repository. | ||
|
||
To achieve this, we recommend using a text file analysis tool such as an inclusive linter and including this as a step in your CI pipelines. | ||
|
||
## What to Lint for | ||
|
||
The primary goal of an inclusive linter is to flag any occurrences of non-inclusive language within source code (and optionally suggest some alternatives). Non-inclusive words or phrases in a project can be found anywhere from comments and documentation to variable names. | ||
|
||
An inclusive linter may include its own dictionary of "default" non-inclusive words and phrases to run against as a good starting point. These tools can also be customizable, oftentimes offering the ability to omit some terms and/or add your own. | ||
|
||
The ability to add additional terms to your linter has the added benefit of enabling linting of sensitive language on top of inclusive linting. This can prevent things such as customer names or other non-public information from making it into your git history, for instance. | ||
|
||
## Getting Started with an Inclusive Linter | ||
|
||
### [`woke`] | ||
|
||
One inclusive linter we recommend is `woke`. It is a language-agnostic CLI tool that detects non-inclusive language in your source code and recommends alternatives. While `woke` automatically applies a [default ruleset] with non-inclusive terms to lint for, you can also apply a custom rule config (via a yaml file) with additional terms to lint for. See [`example.yaml`] for an example of adding custom rules. | ||
madossan01 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
jeremydelacruz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Running the tool locally on a file or directory is relatively straightforward: | ||
|
||
```sh | ||
$ woke test.txt | ||
|
||
test.txt:2:2-6: `guys` may be insensitive, use `folks`, `people` instead (warning) | ||
* guys | ||
^ | ||
``` | ||
|
||
`woke` can be run locally on your machine or CI/CD system via CLI and is also available as a two GitHub Actions: | ||
|
||
- [Run woke] | ||
- [Run woke with Reviewdog] | ||
|
||
To use the standard "Run woke" GitHub Action with the default ruleset in a CI pipeline: | ||
|
||
1. Add the `woke` action as a step in your project's CI pipeline yaml: | ||
|
||
```yaml | ||
name: ci | ||
on: | ||
- pull_request | ||
jobs: | ||
woke: | ||
name: woke | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: woke | ||
uses: get-woke/woke-action@v0 | ||
with: | ||
# Cause the check to fail on any broke rules | ||
fail-on-error: true | ||
``` | ||
|
||
1. Run your pipeline | ||
1. View the output in the "Actions" tab in the main repository view | ||
|
||
For more information about additional configuration and usage, see the official [docs]. | ||
|
||
[`woke`]: https://github.com/get-woke/woke | ||
[default ruleset]: https://github.com/get-woke/woke/blob/main/pkg/rule/default.yaml | ||
[`example.yaml`]: https://github.com/get-woke/woke/blob/main/example.yaml | ||
[Run woke]: https://github.com/marketplace/actions/run-woke | ||
[Run woke with reviewdog]: https://github.com/marketplace/actions/run-woke-with-reviewdog | ||
[docs]: https://docs.getwoke.tech/ | ||
jeremydelacruz marked this conversation as resolved.
Show resolved
Hide resolved
jeremydelacruz marked this conversation as resolved.
Show resolved
Hide resolved
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love to see this guidance for CI. Thanks to propose and create the document.