commit: d3c5be6fe4b20c405246950de3ac734068db372e
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 9 20:02:12 2022 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Nov 9 20:02:12 2022 +0000
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=d3c5be6f
UnquotedVariable: fix false positives with unset_command
Caught on sci-biology/hmmer, it was incorrectly reporting for TMPDIR
declared with `unset`.
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/codingstyle.py | 2 ++
.../EbuildUnquotedVariable/EbuildUnquotedVariable-0.ebuild | 2 ++
2 files changed, 4 insertions(+)
diff --git a/src/pkgcheck/checks/codingstyle.py
b/src/pkgcheck/checks/codingstyle.py
index 954ef09d..a7d64aca 100644
--- a/src/pkgcheck/checks/codingstyle.py
+++ b/src/pkgcheck/checks/codingstyle.py
@@ -1019,6 +1019,8 @@ class _UnquotedVariablesCheck(Check):
# Variable is part of a shell assignment, and does not need to be
# quoted. for example S=${WORKDIR}/${PN} is ok.
'variable_assignment',
+ # Variable is being used in a unset command.
+ 'unset_command',
# Variable is part of declaring variables, and does not need to be
# quoted. for example local TMPDIR is ok.
'declaration_command',
diff --git
a/testdata/repos/standalone/EbuildUnquotedVariablesCheck/EbuildUnquotedVariable/EbuildUnquotedVariable-0.ebuild
b/testdata/repos/standalone/EbuildUnquotedVariablesCheck/EbuildUnquotedVariable/EbuildUnquotedVariable-0.ebuild
index 0c382b1b..30ff4887 100644
---
a/testdata/repos/standalone/EbuildUnquotedVariablesCheck/EbuildUnquotedVariable/EbuildUnquotedVariable-0.ebuild
+++
b/testdata/repos/standalone/EbuildUnquotedVariablesCheck/EbuildUnquotedVariable/EbuildUnquotedVariable-0.ebuild
@@ -44,4 +44,6 @@ src_prepare() {
local TMPDIR # ok
TMPDIR="$(mktemp --directory --tmpdir=/tmp ${PN}-XXXX)" # ok
export TMPDIR # ok
+
+ unset TMPDIR # ok
}