From e6bba29e2abc710251699a73da87f28e871ac165 Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Wed, 20 Sep 2023 20:03:54 +0200 Subject: [PATCH] linting --- dotdrop/dotdrop.py | 10 ++++++---- dotdrop/uninstaller.py | 4 +--- scripts/check-syntax.sh | 10 ++++++---- tests-ng/uninstall.sh | 1 + 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/dotdrop/dotdrop.py b/dotdrop/dotdrop.py index 058c481..e89e2f1 100644 --- a/dotdrop/dotdrop.py +++ b/dotdrop/dotdrop.py @@ -622,6 +622,7 @@ def cmd_detail(opts): def cmd_uninstall(opts): + """uninstall""" dotfiles = opts.dotfiles keys = opts.uninstall_key @@ -649,15 +650,16 @@ def cmd_uninstall(opts): debug=opts.debug, backup_suffix=opts.install_backup_suffix) uninstalled = 0 - for df in dotfiles: - res, msg = uninst.uninstall(df.src, - df.dst, - df.link) + for dotf in dotfiles: + res, msg = uninst.uninstall(dotf.src, + dotf.dst, + dotf.link) if not res: LOG.err(msg) continue uninstalled += 1 LOG.log(f'\n{uninstalled} dotfile(s) uninstalled.') + return True def cmd_remove(opts): diff --git a/dotdrop/uninstaller.py b/dotdrop/uninstaller.py index 31bf09c..e6c3c5d 100644 --- a/dotdrop/uninstaller.py +++ b/dotdrop/uninstaller.py @@ -107,7 +107,6 @@ class Uninstaller: def _remove(self, path): """remove path""" - # TODO handle symlink self.log.dbg(f'handling uninstall of {path}') if path.endswith(self.backup_suffix): self.log.dbg(f'skip {path} ignored') @@ -116,8 +115,7 @@ class Uninstaller: if os.path.exists(backup): self.log.dbg(f'backup exists for {path}: {backup}') return self._replace(path, backup) - else: - self.log.dbg(f'no backup file for {path}') + self.log.dbg(f'no backup file for {path}') if os.path.isdir(path): self.log.dbg(f'{path} is a directory') diff --git a/scripts/check-syntax.sh b/scripts/check-syntax.sh index fdee823..d9622eb 100755 --- a/scripts/check-syntax.sh +++ b/scripts/check-syntax.sh @@ -38,10 +38,12 @@ pyflakes --version # checking for TODO/FIXME echo "--------------------------------------" echo "checking for TODO/FIXME" -grep -rv 'TODO\|FIXME' dotdrop/ >/dev/null 2>&1 -grep -rv 'TODO\|FIXME' tests/ >/dev/null 2>&1 -grep -rv 'TODO\|FIXME' tests-ng/ >/dev/null 2>&1 -grep -rv 'TODO\|FIXME' scripts/ >/dev/null 2>&1 +set +e +grep -r 'TODO\|FIXME' dotdrop/ && exit 1 +grep -r 'TODO\|FIXME' tests/ && exit 1 +grep -r 'TODO\|FIXME' tests-ng/ && exit 1 +#grep -r 'TODO\|FIXME' scripts/ && exit 1 +set -e # checking for tests options echo "---------------------------------" diff --git a/tests-ng/uninstall.sh b/tests-ng/uninstall.sh index 59e62b2..c701e74 100755 --- a/tests-ng/uninstall.sh +++ b/tests-ng/uninstall.sh @@ -27,6 +27,7 @@ echo -e "$(tput setaf 6)==> RUNNING $(basename "${BASH_SOURCE[0]}") <==$(tput sg ################################################################ export DOTDROP_TEST_NG_UNINSTALL_DDPATH="${ddpath}" export DOTDROP_TEST_NG_UNINSTALL_BIN="${bin}" +# shellcheck source=uninstall_ source "${cur}"/uninstall_ export DOTDROP_TEST_NG_UNINSTALL_LINK_TYPE="nolink"