From: John Mulligan Date: Sat, 9 Mar 2024 16:37:49 +0000 (-0500) Subject: cephadm: use check-black environment, drop fix X-Git-Tag: v19.1.0~165^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2a6ad81155c42b5bab5113f492c275004f349ffe;p=ceph.git cephadm: use check-black environment, drop fix A few months ago when we were starting the cephadm refactoring effort in earnest we agreed to use `black` to format the python files we moved into `cephadmlib` (while leaving the formatting of cephadm.py as-is). We created tox rules to check or apply black formatting but promptly got lazy and stopped running the checks manually - they were not run automatically. Change the default environment list to call check-black to start enforcing the use of black style formatting. At the same time, remove the `fix` environment entirely. It is liable to leave uncommitted changes in your working tree when run - unlike check-black. This moves cephadm practices closer to ones I've seen widely used in other python codebases. Note that cephadm.py remains outside of this rule - it only requires pep8 formatting (via flake8). cephadm.py should continue to be disassembled and components moved into cephadmlib over time. flake8 also remains in effect for cephadmlib, it's fast, finds obvious mistakes and does some code-level linting (like unused vars) that black does not. Signed-off-by: John Mulligan (cherry picked from commit 155a91bfb0b6fdf9563a907b2aa5740e00046e6e) --- diff --git a/src/cephadm/tox.ini b/src/cephadm/tox.ini index 4871c186b3e3..8c3728ff4c9b 100644 --- a/src/cephadm/tox.ini +++ b/src/cephadm/tox.ini @@ -2,8 +2,8 @@ envlist = py3 mypy - fix flake8 + check-black skipsdist = true [flake8] @@ -50,14 +50,6 @@ deps = -c{toxinidir}/../mypy-constrains.txt commands = mypy --config-file ../mypy.ini {posargs:cephadm.py cephadmlib} -[testenv:fix] -basepython = python3 -deps = - autopep8 -commands = - python --version - autopep8 {[autopep8]addopts} {posargs: cephadm.py} - [testenv:flake8] basepython = python3 allowlist_externals = bash