From 24a4d81097c2a930b34d55e25400d14b74ec4112 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 4 Jul 2021 01:53:02 -0700 Subject: style: clean up and restructure `spack style` command This consolidates code across tools in `spack style` so that each `run_` function can be called indirecty through a dictionary of handlers, and os that checks like finding the executable for the tool can be shared across commands. - [x] rework `spack style` to use decorators to register tools - [x] define tool order in one place in `spack style` - [x] fix python 2/3 issues to Get `isort` checks working - [x] make isort error regex more robust across versions - [x] remove unused output option - [x] change vestigial `TRAVIS_BRANCH` to `GITHUB_BASE_REF` - [x] update completion --- share/spack/qa/run-style-tests | 2 +- share/spack/spack-completion.bash | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'share') diff --git a/share/spack/qa/run-style-tests b/share/spack/qa/run-style-tests index 23d756a3bc..4eb503dae2 100755 --- a/share/spack/qa/run-style-tests +++ b/share/spack/qa/run-style-tests @@ -18,7 +18,7 @@ check_dependencies flake8 mypy # verify that the code style is correct -spack style +spack style --root-relative # verify that the license headers are present spack license verify diff --git a/share/spack/spack-completion.bash b/share/spack/spack-completion.bash index 08a4c999c9..cd5a01c42d 100755 --- a/share/spack/spack-completion.bash +++ b/share/spack/spack-completion.bash @@ -978,7 +978,7 @@ _spack_find() { _spack_flake8() { if $list_options then - SPACK_COMPREPLY="-h --help -b --base -a --all -o --output -r --root-relative -U --no-untracked --no-flake8 --no-mypy --black" + SPACK_COMPREPLY="-h --help -b --base -a --all -r --root-relative -U --no-untracked -f --fix --no-isort --no-flake8 --no-mypy --black" else SPACK_COMPREPLY="" fi @@ -1584,7 +1584,7 @@ _spack_stage() { _spack_style() { if $list_options then - SPACK_COMPREPLY="-h --help -b --base -a --all -o --output -r --root-relative -U --no-untracked --no-flake8 --no-mypy --black" + SPACK_COMPREPLY="-h --help -b --base -a --all -r --root-relative -U --no-untracked -f --fix --no-isort --no-flake8 --no-mypy --black" else SPACK_COMPREPLY="" fi -- cgit v1.2.3-60-g2f50