Skip to content

Commit 7212d35

Browse files
committed
Add pre-commit hooks
1 parent b04fc97 commit 7212d35

File tree

7 files changed

+131
-0
lines changed

7 files changed

+131
-0
lines changed

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
updates:
3+
# - package-ecosystem: pip
4+
# directory: "/"
5+
# schedule:
6+
# interval: daily
7+
- package-ecosystem: 'github-actions'
8+
directory: '/'
9+
schedule:
10+
# Check for updates once a week
11+
interval: 'weekly'

.github/workflows/linting.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: linting
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
branches:
9+
- 'main'
10+
11+
jobs:
12+
linting:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-python@v2
17+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v3.4.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-docstring-first
8+
- id: check-json
9+
- id: check-yaml
10+
- id: double-quote-string-fixer
11+
12+
- repo: https://github.com/ambv/black
13+
rev: 20.8b1
14+
hooks:
15+
- id: black
16+
17+
- repo: https://github.com/keewis/blackdoc
18+
rev: v0.3.3
19+
hooks:
20+
- id: blackdoc
21+
22+
- repo: https://gitlab.com/pycqa/flake8
23+
rev: 3.9.0
24+
hooks:
25+
- id: flake8
26+
27+
- repo: https://github.com/asottile/seed-isort-config
28+
rev: v2.2.0
29+
hooks:
30+
- id: seed-isort-config
31+
- repo: https://github.com/pre-commit/mirrors-isort
32+
rev: v5.8.0
33+
hooks:
34+
- id: isort
35+
36+
- repo: https://github.com/pre-commit/mirrors-prettier
37+
rev: v2.2.1
38+
hooks:
39+
- id: prettier
40+
# - repo: https://github.com/deathbeds/prenotebook
41+
# rev: f5bdb72a400f1a56fe88109936c83aa12cc349fa
42+
# hooks:
43+
# - id: prenotebook
44+
# args:
45+
# [
46+
# '--keep-output',
47+
# '--keep-metadata',
48+
# '--keep-execution-count',
49+
# '--keep-empty',
50+
# ]
51+
- repo: https://github.com/nbQA-dev/nbQA
52+
rev: 0.5.9
53+
hooks:
54+
- id: nbqa-black
55+
additional_dependencies: [black==20.8b1]
56+
exclude: posts/2021/function-expressions-in-js.ipynb
57+
- id: nbqa-pyupgrade
58+
additional_dependencies: [pyupgrade==2.7.3]
59+
exclude: posts/2021/function-expressions-in-js.ipynb
60+
- id: nbqa-isort
61+
additional_dependencies: [isort==5.7.0]
62+
exclude: posts/2021/function-expressions-in-js.ipynb

.prettierrc.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tabWidth = 2
2+
semi = false
3+
singleQuote = true

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# [ncar.github.io/esds](https://ncar.github.io/esds/)
2+
3+
![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/NCAR/esds/deploy-website/main?logo=github&style=for-the-badge)
4+
![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/NCAR/esds/linting/main?label=linting&logo=github&style=for-the-badge)
5+
6+
Repository for hosting material related to Earth System Data Science Initiative efforts. The contents are posted at [ncar.github.io/esds](https://ncar.github.io/esds/).

pyproject.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[tool.black]
2+
line-length = 100
3+
target-version = ['py38']
4+
skip-string-normalization = true
5+
6+
[tool.nbqa.config]
7+
isort = "setup.cfg"
8+
black = "pyproject.toml"
9+
10+
[tool.nbqa.mutate]
11+
isort = 1
12+
black = 1
13+
pyupgrade = 1
14+
15+
[tool.nbqa.addopts]
16+
pyupgrade = ["--py36-plus"]

setup.cfg

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[flake8]
2+
exclude =
3+
ignore =
4+
max-line-length = 100
5+
max-complexity = 18
6+
select = B,C,E,F,W,T4,B9
7+
8+
[isort]
9+
known_first_party=
10+
known_third_party=
11+
multi_line_output=3
12+
include_trailing_comma=True
13+
force_grid_wrap=0
14+
combine_as_imports=True
15+
line_length=100
16+
skip=

0 commit comments

Comments
 (0)