Skip to content

Commit 975bc74

Browse files
committed
Set up pre-commit hooks.
1 parent 38a5bed commit 975bc74

File tree

5 files changed

+50
-3
lines changed

5 files changed

+50
-3
lines changed

Diff for: .flake8

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Taken directly from https://github.com/ambv/black/blob/master/.flake8
2+
# ... and slightly adapted.
3+
4+
[flake8]
5+
ignore = E203, E266, E501, W503
6+
# line length is intentionally set to 80 here because black uses Bugbear
7+
# See https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length for more details
8+
max-line-length = 88
9+
max-complexity = 18
10+
select = B,C,E,F,W,T4,B9

Diff for: .pre-commit-config.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/Quantco/pre-commit-mirrors-black
3+
rev: 22.3.0
4+
hooks:
5+
- id: black-conda
6+
args:
7+
- --safe
8+
- --target-version=py38
9+
- repo: https://github.com/Quantco/pre-commit-mirrors-flake8
10+
rev: v3.9.2
11+
hooks:
12+
- id: flake8-conda
13+
- repo: https://github.com/Quantco/pre-commit-mirrors-isort
14+
rev: 5.8.0
15+
hooks:
16+
- id: isort-conda
17+
additional_dependencies: [-c, conda-forge, toml=0.10.2]
18+

Diff for: main.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from monitoring import org, cal, setup, utils
1+
from monitoring import cal, org, setup, utils
22

33
_FIRST_YEAR = 2020
44

@@ -60,7 +60,9 @@ def gcal(interval: utils.TriggerInterval):
6060
tmpdir = setup.get_tmpdir()
6161
image_paths = [
6262
image_function(df)
63-
for image_function in cal.image_function_registry(sport, interval, path=tmpdir)
63+
for image_function in cal.image_function_registry(
64+
sport, interval, path=tmpdir
65+
)
6466
]
6567
print(f"Generated images for {interval.value} {sport.value}: {image_paths}.")
6668

Diff for: monitoring/setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from google.oauth2.credentials import Credentials
88
from googleapiclient.discovery import build
99
from googleapiclient.errors import HttpError
10-
1110
from telegram import Bot
1211

1312

Diff for: pyproject.toml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[tool.black]
2+
exclude = '''
3+
/(
4+
\.eggs
5+
| \.git
6+
| \.venv
7+
| build
8+
| dist
9+
)/
10+
'''
11+
12+
[tool.isort]
13+
multi_line_output = 3
14+
include_trailing_comma = true
15+
ensure_newline_before_comments = true
16+
line_length = 88
17+
skip_glob = '\.eggs/*,\.git/*,\.venv/*,build/*,dist/*'
18+
default_section = 'THIRDPARTY'

0 commit comments

Comments
 (0)