Skip to content

Commit e87cf61

Browse files
committed
Add pre-commit, black, isort
1 parent d32e449 commit e87cf61

File tree

6 files changed

+61
-2
lines changed

6 files changed

+61
-2
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
1010

11-
[*.{md,yml}]
11+
[*.{md,yaml,yml}]
1212
indent_size = 2

.isort.cfg

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# From https://github.com/OCA/maintainer-quality-tools/blob/master/sample_files/pre-commit-13.0/.isort.cfg
2+
[settings]
3+
multi_line_output=3
4+
include_trailing_comma=True
5+
force_grid_wrap=0
6+
combine_as_imports=True
7+
use_parentheses=True
8+
line_length=88
9+
known_odoo=odoo
10+
known_odoo_addons=odoo.addons
11+
sections=FUTURE,STDLIB,THIRDPARTY,ODOO,ODOO_ADDONS,FIRSTPARTY,LOCALFOLDER
12+
known_third_party=plumbum

.pre-commit-config.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
default_language_version:
2+
python: python3
3+
repos:
4+
- repo: https://github.com/psf/black
5+
rev: 19.3b0
6+
hooks:
7+
- id: black
8+
- repo: https://github.com/pre-commit/pre-commit-hooks
9+
rev: v2.3.0
10+
hooks:
11+
- id: trailing-whitespace
12+
- id: end-of-file-fixer
13+
- id: debug-statements
14+
- id: fix-encoding-pragma
15+
args: ["--remove"]
16+
- id: check-case-conflict
17+
- id: check-docstring-first
18+
- id: check-executables-have-shebangs
19+
- id: check-merge-conflict
20+
- id: check-xml
21+
- id: mixed-line-ending
22+
args: ["--fix=lf"]
23+
- repo: https://github.com/asottile/seed-isort-config
24+
rev: v1.9.3
25+
hooks:
26+
- id: seed-isort-config
27+
- repo: https://github.com/pre-commit/mirrors-isort
28+
rev: v4.3.21
29+
hooks:
30+
- id: isort

.vscode/settings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"[python]": {
3+
"editor.formatOnSave": true,
4+
},
5+
"editor.formatOnSaveTimeout": 2000,
6+
"python.autoComplete.extraPaths": [
7+
"./tests",
8+
],
9+
"python.formatting.provider": "black",
10+
"python.linting.flake8Enabled": true,
11+
"python.linting.pylintEnabled": true,
12+
"python.pythonPath": "python3",
13+
}

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[flake8]
2+
ignore =
3+
# Line too long
4+
E501

tests/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import unittest
66

77
from plumbum import FG, local
8-
from plumbum.cmd import cat, docker
8+
from plumbum.cmd import cat, docker # pylint: disable=import-error
99
from plumbum.commands.processes import ProcessExecutionError
1010

1111
# Make sure all paths are relative to tests dir

0 commit comments

Comments
 (0)