Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,21 @@ ifneq ($(MIG_ENV),'local')
@echo "unavailable outside local development environment"
@exit 1
endif
@make style-check-python
@make lint-python

# NOTE: black and isort use pyproject.toml to temporarily exclude a few paths
.PHONY: lint-python
lint-python:
.PHONY: style-check-python
style-check-python:
@$(LOCAL_PYTHON_BIN) -m black $(LINT_ENFORCE_DIRS) --check
@$(LOCAL_PYTHON_BIN) -m isort $(LINT_ENFORCE_DIRS) --check-only

# NOTE: pylint and ruff use pyproject.toml to temporarily exclude a few paths
.PHONY: lint-python
lint-python:
@$(LOCAL_PYTHON_BIN) -m pylint $(LINT_ENFORCE_DIRS) --errors-only
@$(LOCAL_PYTHON_BIN) -m ruff check $(LINT_ENFORCE_DIRS)

.PHONY: clean
clean:
@rm -f ./envhelp/py3.imageid
Expand Down
2 changes: 2 additions & 0 deletions local-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
autopep8;python_version >= "3"
black
isort
pylint
ruff
# We need paramiko for the ssh unit tests
# NOTE: paramiko-3.0.0 dropped python2 and python3.6 support
paramiko;python_version >= "3.7"
Expand Down
38 changes: 35 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Project wide settings including tooling.

# Linting tools
# TODO: fix CodeQL errors in symlinked files and disable extend-exclude+skip

# TODO: fix CodeQL errors and disable temporary named files with NOTEs below

[tool.black]
line-length = 80
exclude = '''
tests/data/
| tests/fixture/
'''
# NOTE: the following regex matches must be kept in sync with isort skip
# NOTE: the following temporay excludes must be kept in sync between tools
extend-exclude = '''
bin/checkconf.py
| bin/createresource.py
Expand All @@ -24,7 +25,7 @@ extend-exclude = '''
profile = "black"
line_length = 80
skip_glob = [".git/*", "tests/data/*", "tests/fixture/*"]
# NOTE: the following paths must be kept in sync with black extend-exclude
# NOTE: the following temporay excludes must be kept in sync between tools
skip = [
"bin/checkconf.py",
"bin/createresource.py",
Expand All @@ -34,3 +35,34 @@ skip = [
"sbin/grid_sftp.py",
"sbin/grid_webdavs.py"
]

[tool.pylint]
max-line-length = 80
ignore-pattern = '''
tests/data/
| tests/fixture/
'''
# NOTE: the following temporay excludes must be kept in sync between tools
ignore-paths = [
"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"
]

[tool.ruff]
line-length = 80
exclude = [".git/", "tests/data/", "tests/fixture/"]
# NOTE: the following temporay excludes must be kept in sync between tools
extend-exclude = [
"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"
]
Loading