Skip to content

Commit 917a49a

Browse files
committed
Add pylint and ruff linter in the make lint-python target and point make lint
to the renamed style-check-python and lint-python targets.
1 parent 317b85b commit 917a49a

3 files changed

Lines changed: 42 additions & 3 deletions

File tree

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,20 @@ ifneq ($(MIG_ENV),'local')
5252
@echo "unavailable outside local development environment"
5353
@exit 1
5454
endif
55+
@make style-check-python
5556
@make lint-python
5657

5758
# NOTE: black and isort use pyproject.toml to temporarily exclude a few paths
58-
.PHONY: lint-python
59-
lint-python:
59+
.PHONY: style-check-python
60+
style-check-python:
6061
@$(LOCAL_PYTHON_BIN) -m black $(LINT_ENFORCE_DIRS) --check
6162
@$(LOCAL_PYTHON_BIN) -m isort $(LINT_ENFORCE_DIRS) --check-only
6263

64+
.PHONY: lint-python
65+
lint-python:
66+
@$(LOCAL_PYTHON_BIN) -m pylint $(LINT_ENFORCE_DIRS) --errors-only
67+
@$(LOCAL_PYTHON_BIN) -m ruff check $(LINT_ENFORCE_DIRS)
68+
6369
.PHONY: clean
6470
clean:
6571
@rm -f ./envhelp/py3.imageid

local-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
autopep8;python_version >= "3"
66
black
77
isort
8+
pylint
9+
ruff
810
# We need paramiko for the ssh unit tests
911
# NOTE: paramiko-3.0.0 dropped python2 and python3.6 support
1012
paramiko;python_version >= "3.7"

pyproject.toml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ extend-exclude = '''
2323
[tool.isort]
2424
profile = "black"
2525
line_length = 80
26+
skip_glob = [".git/*", "tests/data/*", "tests/fixture/*"]
2627
# NOTE: the following paths must be kept in sync with black extend-exclude
2728
skip = [
2829
"bin/checkconf.py",
@@ -33,4 +34,34 @@ skip = [
3334
"sbin/grid_sftp.py",
3435
"sbin/grid_webdavs.py"
3536
]
36-
skip_glob = [".git/*", "tests/data/*", "tests/fixture/*"]
37+
38+
[tool.pylint]
39+
max-line-length = 80
40+
ignore-pattern = '''
41+
tests/data/
42+
| tests/fixture/
43+
'''
44+
# NOTE: the following paths must be kept in sync with black extend-exclude
45+
ignore-paths = [
46+
"bin/checkconf.py",
47+
"bin/createresource.py",
48+
"bin/notifypassword.py",
49+
"sbin/grid_ftps.py",
50+
"sbin/grid_openid.py",
51+
"sbin/grid_sftp.py",
52+
"sbin/grid_webdavs.py"
53+
]
54+
55+
[tool.ruff]
56+
line-length = 80
57+
exclude = [".git/", "tests/data/", "tests/fixture/"]
58+
# NOTE: the following regex matches must be kept in sync with isort skip
59+
extend-exclude = [
60+
"bin/checkconf.py",
61+
"bin/createresource.py",
62+
"bin/notifypassword.py",
63+
"sbin/grid_ftps.py",
64+
"sbin/grid_openid.py",
65+
"sbin/grid_sftp.py",
66+
"sbin/grid_webdavs.py"
67+
]

0 commit comments

Comments
 (0)