Skip to content

Commit

Permalink
Add Flynt to linter for updating format strings
Browse files Browse the repository at this point in the history
This will convert format strings to f strings when possible
  • Loading branch information
altheaden committed Jul 5, 2023
1 parent 9a5a1f0 commit 5722bae
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ repos:
hooks:
- id: isort

# Can run individually with `flynt [file]` or `flynt [source]`
- repo: https://github.com/ikamensh/flynt
rev: '0.78'
hooks:
- id: flynt
args: ["--fail-on-change", "--verbose"]
require_serial: true

# Can run individually with `pre-commit run flake8 --all-files`
# Need to use flake8 GitHub mirror due to CentOS git issue with GitLab
# https://github.com/pre-commit/pre-commit/issues/1206
Expand Down
1 change: 1 addition & 0 deletions deploy/conda-dev-spec.template
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ types-requests
pip
pytest
isort
flynt
flake8
mypy
pre-commit
Expand Down
5 changes: 3 additions & 2 deletions docs/developers_guide/quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,9 @@ a tools that helps to enforce this standard by checking your code each time you
make a commit. It will tell you about various types of problems it finds.
Internally, it uses [flake8](https://flake8.pycqa.org/en/latest/) to check PEP8
compliance, [isort](https://pycqa.github.io/isort/) to sort, check and format
imports, and [mypy](https://mypy-lang.org/) to check for consistent variable
types. An example error might be:
imports, [flynt](https://github.com/ikamensh/flynt) to change any format
strings to f-strings, and [mypy](https://mypy-lang.org/) to check for
consistent variable types. An example error might be:

```bash
example.py:77:1: E302 expected 2 blank lines, found 1
Expand Down

0 comments on commit 5722bae

Please sign in to comment.