Skip to content
Merged
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
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ A selection of quality-of-life tools for use with [pre-commit](https://github.co
- [2.4.2 Uniqueness](#242-uniqueness)
- [2.5 The `no-import-testtools-in-src` hook](#25-the-no-import-testtools-in-src-hook)
- [2.6 The `americanise` hook](#26-the-americanise-hook)
- [Configuration](#configuration)
- [2.6.1 Configuration](#261-configuration)
- [`.pre-commit-config.yaml` Configuration](#pre-commit-configyaml-configuration-1)
- [Inline ignores](#inline-ignores)
- [3. Development](#3-development)
- [3.1 Testing](#31-testing)
- [3.1.1 Testing scheme](#311-testing-scheme)
Expand Down Expand Up @@ -347,7 +349,9 @@ This hook checks for imports of `pytest` and/or `unittest` in source files that

This hook checks for common non-US spellings of english words (e.g. 'initialise' rather than 'initialize') and corrects them. The hook will try to match the case of the original word, although this may be imprecise for complex case patterns when the correct spelling of the word is a different length.

#### Configuration
#### 2.6.1 Configuration

##### `.pre-commit-config.yaml` Configuration

Additional words can be manually added in the `.pre-commit-config.yaml`. For example, if we want to change all instances of `absence` to `absence` and all instances of `forth` to `fourth`, the configuration would be:

Expand All @@ -360,6 +364,22 @@ repos:
args: ["-w absence:absence", "-w forth:fourth"]
```

##### Inline ignores

Individual instances can be excluded from this hook by marking them with an inline comment reading `pragma: no americanise`. For example:

```python
def initialise(): # pragma: no americanise
print("initialise")
```

will be corrected to:

```python
def initialise(): # pragma: no americanise
print("initialize")
```


## 3. Development

Expand Down