Skip to content

Commit

Permalink
Added editorconfig, black, flake8, isort, pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jslay-excella committed Apr 13, 2022
1 parent e0f2191 commit 9a91c1c
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

# Matches multiple files with brace expansion notation
# Set default charset
# Set max line length
# 4 space indentation
[*.py]
charset = utf-8
max_line_length = 79
indent_style = space
indent_size = 4
23 changes: 23 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[flake8]
max-line-length = 79
select = C,E,F,W,B,B950
ignore =
# black https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html#line-length
E203, E501
# There's nothing wrong with assigning lambdas
E731,
# PEP8 weakly recommends Knuth-style line breaks before binary
# operators
W503, W504
exclude =
# These are directories that it's a waste of time to traverse
.git,
.tox,
.venv,
docs,
venv,

# Generated migration files will throw errors. We need to find a way
# to exclude django-generated migrations while including
# manually-written migrations.
*/migrations/*.py,
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ bower_components/
.grunt/
src/vendor/
dist/

# IDEs
.idea/
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
args: ["wagtailinventory", "setup.py", "--line-length=79"]
exclude: migrations
- repo: https://gitlab.com/pycqa/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear==22.1.11]
- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
name: isort (python)
args: ["wagtailinventory"]
17 changes: 17 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,22 @@ exclude = '''
)
'''

[tool.isort]
profile = "black"
line_length = 79
lines_after_imports = 2
skip = [".tox", "migrations", ".venv", "venv"]
known_django = ["django"]
known_wagtail = ["wagtail"]
default_section = "THIRDPARTY"
sections = [
"STDLIB",
"DJANGO",
"WAGTAIL",
"THIRDPARTY",
"FIRSTPARTY",
"LOCALFOLDER"
]

[build-system]
requires = ["setuptools", "wheel"]

0 comments on commit 9a91c1c

Please sign in to comment.