Skip to content

Commit 56aa36c

Browse files
committed
🎨 black, prettier, isort, flake8
1 parent 9c9ef2c commit 56aa36c

File tree

14 files changed

+1404
-1030
lines changed

14 files changed

+1404
-1030
lines changed

.github/workflows/build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,70 @@ jobs:
2828
name: dist
2929
path: dist
3030

31+
lint-black:
32+
name: 🧹 black
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: 🏗 Set up Python 3.7
37+
uses: actions/setup-python@v1
38+
with:
39+
python-version: 3.7
40+
- name: 🏗 Set up dev dependencies
41+
run: |
42+
pip install -e .[develop]
43+
- name: 🚀 Run black
44+
run: |
45+
pre-commit run --hook-stage manual black --all-files --show-diff-on-failure
46+
47+
lint-prettier:
48+
name: 🧹 prettier
49+
runs-on: ubuntu-latest
50+
steps:
51+
- uses: actions/checkout@v2
52+
- name: 🏗 Set up Python 3.7
53+
uses: actions/setup-python@v1
54+
with:
55+
python-version: 3.7
56+
- name: 🏗 Set up dev dependencies
57+
run: |
58+
pip install -e .[develop]
59+
- name: 🚀 Run prettier
60+
run: |
61+
pre-commit run --hook-stage manual prettier --all-files --show-diff-on-failure
62+
63+
lint-isort:
64+
name: 🧹 isort
65+
runs-on: ubuntu-latest
66+
steps:
67+
- uses: actions/checkout@v2
68+
- name: 🏗 Set up Python 3.7
69+
uses: actions/setup-python@v1
70+
with:
71+
python-version: 3.7
72+
- name: 🏗 Set up dev dependencies
73+
run: |
74+
pip install -e .[develop]
75+
- name: 🚀 Run isort
76+
run: |
77+
pre-commit run --hook-stage manual isort --all-files --show-diff-on-failure
78+
79+
lint-flake8:
80+
name: 🧹 Flake8
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/checkout@v2
84+
- name: 🏗 Set up Python 3.7
85+
uses: actions/setup-python@v1
86+
with:
87+
python-version: 3.7
88+
- name: 🏗 Set up dev dependencies
89+
run: |
90+
pip install -e .[develop]
91+
- name: 🚀 Run flake8
92+
run: |
93+
pre-commit run --hook-stage manual flake8 --all-files
94+
3195
publish-on-testpypi:
3296
name: 📦 Publish on TestPyPI
3397
if: github.event_name == 'push'

.pre-commit-config.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
exclude: ^(src/octoprint/vendor/|src/octoprint/static/js/lib|src/octoprint/static/vendor|tests/static/js/lib|tests/util/_files|docs/|scripts/|translations/|.*\.css|.*\.svg)
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v2.3.0
5+
hooks:
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- id: check-case-conflict
9+
- id: check-json
10+
- id: check-yaml
11+
- id: check-toml
12+
- id: check-merge-conflict
13+
- id: fix-encoding-pragma
14+
- repo: https://github.com/OctoPrint/codemods
15+
rev: devel
16+
hooks:
17+
- id: codemod_dict_to_literal
18+
stages: ["manual"]
19+
- id: codemod_set_to_literal
20+
stages: ["manual"]
21+
- id: codemod_not_in
22+
stages: ["manual"]
23+
- repo: https://github.com/pre-commit/mirrors-isort
24+
rev: v5.5.4
25+
hooks:
26+
- id: isort
27+
- repo: https://github.com/psf/black
28+
rev: 20.8b1
29+
hooks:
30+
- id: black
31+
args: ["--config", "black.toml"]
32+
- repo: https://gitlab.com/pycqa/flake8
33+
rev: 3.8.1
34+
hooks:
35+
- id: flake8
36+
additional_dependencies:
37+
- flake8-bugbear
38+
- repo: https://github.com/pre-commit/mirrors-prettier
39+
rev: v2.1.2
40+
hooks:
41+
- id: prettier

.prettierignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.md
2+
*.css
3+
**/*.min.js
4+
build
5+
dist
6+
venv
7+
venv2
8+
venv3

.prettierrc.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
printWidth: 90
2+
tabWidth: 4
3+
semi: true
4+
trailingComma: "none"
5+
singleQuote: false
6+
quoteProps: consistent
7+
bracketSpacing: false
8+
overrides:
9+
- files: ["*.yaml", "*.yml", "*.json", "*.less"]
10+
options:
11+
tabWidth: 2

black.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[tool.black]
2+
line-length = 90
3+
include = '''
4+
5+
(
6+
(
7+
src
8+
).*\.pyi?$
9+
)|(
10+
setup\.py
11+
)
12+
'''
13+
exclude = '''
14+
15+
(
16+
)
17+
'''

0 commit comments

Comments
 (0)