Skip to content

Commit

Permalink
Simple pre-commit hook for usort
Browse files Browse the repository at this point in the history
Issue #260

ghstack-source-id: 1081271f25de255bedf5c2603647762f45dcf9cc
Pull Request resolved: #261
  • Loading branch information
amyreese committed May 31, 2023
1 parent d72adf0 commit d242659
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- id: usort
name: Sort imports with µsort
description: Safe, minimal import sorting
language: python
types_or:
- python
- pyi
entry: usort format
require_serial: true
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,20 @@ To just validate that files are formatted correctly, like during CI:
$ usort check <path>
```

# License
### pre-commit

µsort provides a [pre-commit](https://pre-commit.com/) hook. To enforce sorted
imports before every commit, add the following to your `.pre-commit-config.yaml`
file:

```yaml
- repo: https://github.com/facebook/usort
rev: v1.0.7
hooks:
- id: usort
```
## License
μsort is MIT licensed, as found in the [LICENSE][] file.
Expand Down

0 comments on commit d242659

Please sign in to comment.