Skip to content

Commit

Permalink
Configure isort and towncrier, fix Flake8 config
Browse files Browse the repository at this point in the history
Configure isort to recognise CCTBX imports and run it as a pre-commit
hook.

Flake8 is no-longer available as a pre-commit out-of-the-box hook.
Update accordingly.  See
https://github.com/pre-commit/pre-commit-hooks#deprecated--replaced-hooks
  • Loading branch information
benjaminhwilliams committed Jun 23, 2020
1 parent 90b824d commit 406252f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
22 changes: 17 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
# Run libtbx.pre-commit install to enable repository pre-commits.
repos:

# Automatic source code formatting
# Automatically sort imports with isort
- repo: https://github.com/timothycrosley/isort.git
rev: 4.3.21-2
hooks:
- id: isort
additional_dependencies: [toml]

# Automatic source code formatting with Black
- repo: https://github.com/psf/black
rev: 19.10b0
hooks:
- id: black
args: [--safe, --quiet]

# Syntax check and some basic flake8
# Enforce style with Flake8
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
args: ['--max-line-length=88', '--select=E401,E711,E712,E713,E714,E721,E722,E901,F401,F402,F403,F405,F631,F632,F633,F811,F812,F821,F822,F841,F901,W191,W291,W292,W293,W602,W603,W604,W605,W606']

# Syntax check with pre-commit out-of-the-box hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
rev: v3.1.0
hooks:
- id: check-ast
- id: check-yaml
- id: flake8
args: ['--max-line-length=88', '--select=E401,E711,E712,E713,E714,E721,E722,E901,F401,F402,F403,F405,F631,F632,F633,F811,F812,F821,F822,F841,F901,W191,W291,W292,W293,W602,W603,W604,W605,W606']
- id: check-merge-conflict
- id: check-added-large-files
args: ['--maxkb=200']
14 changes: 14 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[tool.towncrier]
package = "screen19"
package_dir = ".."
filename = "CHANGELOG.rst"

[tool.isort]
known_cctbx="boost,boost_adaptbx,cbflib_adaptbx,cctbx,chiltbx,clipper_adaptbx,cma_es,cootbx,crys3d,cudatbx,fable,fast_linalg,fftw3tbx,gltbx,iota,iotbx,libtbx,mmtbx,omptbx,prime,rstbx,scitbx,simtbx,smtbx,spotfinder,tbxx,ucif,wxtbx,xfel"
sections="FUTURE,STDLIB,THIRDPARTY,CCTBX,FIRSTPARTY,LOCALFOLDER"
# Explicitly black-compatible settings
multi_line_output=3
include_trailing_comma=true
force_grid_wrap=0
use_parentheses=true
line_length=88

0 comments on commit 406252f

Please sign in to comment.