Skip to content

Commit 4169712

Browse files
authored
Merge pull request #1381 from consideRatio/pr/pre-commit
Add pre-commit: pretter, black, pyupgrade, and misc
2 parents 3ccb21a + e2295ee commit 4169712

File tree

4 files changed

+84
-1
lines changed

4 files changed

+84
-1
lines changed

.flake8

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# flake8 is a Python linting tool run by pre-commit as declared by our
2+
# pre-commit-config.yaml file.
3+
#
4+
# This configuration is compatible with the autoformatter tool black, and
5+
# further relaxed to not bug us with too small details.
6+
#
7+
# flake8 configuration reference:
8+
# https://flake8.pycqa.org/en/latest/user/configuration.html
9+
#
10+
[flake8]
11+
max-line-length = 88
12+
extend-ignore = C, E, W
13+
14+
# Adjustments to linting the binderhub repo
15+
builtins = c, load_subconfig
16+
exclude = versioneer.py,binderhub/_version.py

.pre-commit-config.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# pre-commit is a tool to perform a predefined set of tasks manually and/or
2+
# automatically before git commits are made.
3+
#
4+
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level
5+
#
6+
# Common tasks
7+
#
8+
# - Run on all files: pre-commit run --all-files
9+
# - Register git hooks: pre-commit install --install-hooks
10+
#
11+
repos:
12+
# Autoformat: Python code, syntax patterns are modernized
13+
- repo: https://github.com/asottile/pyupgrade
14+
rev: v2.31.0
15+
hooks:
16+
- id: pyupgrade
17+
args:
18+
- --py37-plus
19+
20+
# Autoformat: Python code
21+
- repo: https://github.com/psf/black
22+
rev: 22.1.0
23+
hooks:
24+
- id: black
25+
args: [--target-version=py37]
26+
27+
# Autoformat: Python code
28+
- repo: https://github.com/asottile/reorder_python_imports
29+
rev: v3.0.1
30+
hooks:
31+
- id: reorder-python-imports
32+
33+
# Autoformat: js, html, markdown, yaml, json
34+
- repo: https://github.com/pre-commit/mirrors-prettier
35+
rev: v2.6.1
36+
hooks:
37+
- id: prettier
38+
exclude_types:
39+
# These are excluded initially as pre-commit was added but can
40+
# absolutely be enabled later. If so, we should consider having a
41+
# separate run of pre-commit where we configure a line spacing of 4
42+
# for these file formats.
43+
- html
44+
- javascript
45+
- css
46+
47+
# Misc autoformatting and linting
48+
- repo: https://github.com/pre-commit/pre-commit-hooks
49+
rev: v4.1.0
50+
hooks:
51+
- id: end-of-file-fixer
52+
exclude_types: [svg]
53+
- id: check-case-conflict
54+
- id: check-executables-have-shebangs
55+
- id: requirements-txt-fixer
56+
57+
# Lint: Python code
58+
- repo: https://github.com/PyCQA/flake8
59+
rev: "4.0.1"
60+
hooks:
61+
- id: flake8
62+
63+
# versioneer.py is excluded for being an imported dependency we opt to not
64+
# modify ourselves. This is also set in .flake8 for consistency.
65+
exclude: versioneer.py|binderhub/_version.py

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
helm-chart/binderhub/templates/
2+
http-record.doi.org.json

binderhub/launcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def _cancel_ready_event(f=None):
243243
else:
244244
ready_event_future.cancel()
245245
try:
246-
resp = await self.api_request(
246+
await self.api_request(
247247
'users/{}/servers/{}'.format(escaped_username, server_name),
248248
method='POST',
249249
body=json.dumps(data).encode('utf8'),

0 commit comments

Comments
 (0)