Skip to content

Commit e9adb5a

Browse files
committed
move to a central config file in the form of a pyproject.toml
1 parent 3e8f806 commit e9adb5a

3 files changed

Lines changed: 38 additions & 22 deletions

File tree

.isort.cfg

Lines changed: 0 additions & 3 deletions
This file was deleted.

Makefile

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ ifndef PY
66
PY = 3
77
endif
88

9-
FORMAT_ENFORCE_DIRS = ./bin ./mig/lib ./sbin ./tests
10-
FORMAT_EXCLUDE_REGEX = '.git|tests/data/|tests/fixture/|bin/checkconf.py|bin/createresource.py|bin/notifypassword.py|sbin/grid\_ftps.py|sbin/grid\_openid.py|sbin/grid\_sftp.py|sbin/grid\_webdavs.py'
11-
FORMAT_LINE_LENGTH = 80
9+
LINT_ENFORCE_DIRS = ./bin ./mig/lib ./sbin ./tests
1210
LOCAL_PYTHON_BIN = './envhelp/lpython'
1311

1412
ifdef PYTHON_BIN
@@ -40,14 +38,10 @@ ifneq ($(MIG_ENV),'local')
4038
endif
4139
@make format-python
4240

43-
.PHONY:format-python
41+
.PHONY: format-python
4442
format-python:
45-
@$(LOCAL_PYTHON_BIN) -m black $(FORMAT_ENFORCE_DIRS) \
46-
--line-length=$(FORMAT_LINE_LENGTH) \
47-
--exclude=$(FORMAT_EXCLUDE_REGEX)
48-
@$(LOCAL_PYTHON_BIN) -m isort $(FORMAT_ENFORCE_DIRS) \
49-
--profile=black \
50-
--line-length=$(FORMAT_LINE_LENGTH)
43+
@$(LOCAL_PYTHON_BIN) -m black $(LINT_ENFORCE_DIRS)
44+
@$(LOCAL_PYTHON_BIN) -m isort $(LINT_ENFORCE_DIRS)
5145

5246
.PHONY: lint
5347
lint:
@@ -59,15 +53,8 @@ endif
5953

6054
.PHONY: lint-python
6155
lint-python:
62-
@$(LOCAL_PYTHON_BIN) -m black $(FORMAT_ENFORCE_DIRS) \
63-
--check \
64-
--line-length=$(FORMAT_LINE_LENGTH) \
65-
--exclude $(FORMAT_EXCLUDE_REGEX)
66-
@$(LOCAL_PYTHON_BIN) -m isort $(FORMAT_ENFORCE_DIRS) \
67-
--check-only \
68-
--profile=black \
69-
--line-length=$(FORMAT_LINE_LENGTH) \
70-
--skip-glob=$(FORMAT_EXCLUDE_GLOB)
56+
@$(LOCAL_PYTHON_BIN) -m black $(LINT_ENFORCE_DIRS) --check
57+
@$(LOCAL_PYTHON_BIN) -m isort $(LINT_ENFORCE_DIRS) --check-only
7158

7259
.PHONY: clean
7360
clean:

pyproject.toml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Project wide settings including tooling.
2+
3+
# Linting tools
4+
# TODO: fix CodeQL errors in the symlinked files and disable exclude+skip here
5+
6+
[tool.black]
7+
line-length = 80
8+
# NOTE: the following regex matches us be kept in sync with isort skip
9+
extend-exclude = '''
10+
tests/data/
11+
| tests/fixture/
12+
| bin/checkconf.py
13+
| bin/createresource.py
14+
| bin/notifypassword.py
15+
| sbin/grid_ftps.py|sbin/grid_openid.py
16+
| sbin/grid_sftp.py|sbin/grid_webdavs.py
17+
'''
18+
19+
[tool.isort]
20+
profile = "black"
21+
line_length = 80
22+
# NOTE: the following paths must be kept in sync with black extend-exclude
23+
skip = [
24+
"bin/notifypassword.py",
25+
"bin/checkconf.py",
26+
"bin/createresource.py",
27+
"sbin/grid_ftps.py",
28+
"sbin/grid_openid.py",
29+
"sbin/grid_sftp.py",
30+
"sbin/grid_webdavs.py"
31+
]
32+
skip_glob = [".git/*", "tests/data/*", "tests/fixture/*"]

0 commit comments

Comments
 (0)