File: python.cmake

package info (click to toggle)
azure-vm-utils 0.6.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 484 kB
  • sloc: python: 1,758; ansic: 1,636; sh: 128; makefile: 19
file content (19 lines) | stat: -rw-r--r-- 688 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
file(GLOB PYTHON_SOURCES */*.py)

add_custom_target(
    python-autoformat
    COMMAND isort ${PYTHON_SOURCES}
    COMMAND black ${PYTHON_SOURCES}
    COMMAND autoflake -r --in-place --remove-unused-variables --remove-all-unused-imports --ignore-init-module-imports ${PYTHON_SOURCES}
    COMMENT "Running autoformatting tools"
)

add_custom_target(
    python-lint
    COMMAND isort --check-only ${PYTHON_SOURCES}
    COMMAND black --check --diff ${PYTHON_SOURCES}
    COMMAND mypy --ignore-missing-imports ${PYTHON_SOURCES}
    COMMAND flake8 --ignore=W503,E501,E402 ${PYTHON_SOURCES}
    COMMAND pylint ${PYTHON_SOURCES}
    COMMENT "Running Python lint checks and formatting checks"
)