Skip to content

Commit

Permalink
Add pre-commit, editorconfig, black, isort, flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
foosel committed Nov 3, 2020
1 parent 0299693 commit ba1435e
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
max_line_length = 90

[**.py]
indent_size = 4

[**.yaml]
indent_size = 2
4 changes: 4 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
max-line-length = 90
extend-ignore = E203, E231, E265, E266, E402, E501, E731
select = B,C,E,F,W,T4,B9
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# refs to ignore during git blame, use with --ignore-revs-file
7 changes: 7 additions & 0 deletions .isort.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[settings]
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
ensure_newline_before_comments = True
line_length = 90
34 changes: 34 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict
- id: check-merge-conflict
- id: fix-encoding-pragma
- repo: https://github.com/OctoPrint/codemods
rev: devel
hooks:
- id: codemod_dict_to_literal
stages: ["manual"]
- id: codemod_set_to_literal
stages: ["manual"]
- id: codemod_not_in
stages: ["manual"]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.5.4
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: stable
hooks:
- id: black
args: ["--config", "black.toml"]
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.1
hooks:
- id: flake8
additional_dependencies:
- flake8-bugbear
4 changes: 4 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ exclude:
- .github
- .asset-cache
- _build
- .editorconfig
- .git-blame-ignore-revs
- .pre-commit-config.yaml
- black.toml

plugins:
- jekyll-redirect-from
Expand Down
10 changes: 10 additions & 0 deletions black.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[tool.black]
line-length = 90
include = '''
(
(
.github
).*\.pyi?$
)
'''

0 comments on commit ba1435e

Please sign in to comment.