[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: testdata/repos/standalone/EbuildUnquotedVariablesCheck/EbuildUnquotedVariable/, ...

2023-04-21 Thread Arthur Zamarin
commit: 2f5ceb7da0eb16ee819aba6f0a4e4dcdd8417d42
Author: Arthur Zamarin  gentoo  org>
AuthorDate: Fri Mar 24 13:07:20 2023 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Fri Apr 21 06:31:16 2023 +
URL:
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=2f5ceb7d

MissingEAPIBlankLine: new check for missing blank after EAPI

Resolves: https://github.com/pkgcore/pkgcheck/issues/570
Signed-off-by: Arthur Zamarin  gentoo.org>

 pyproject.toml  |  4 ++--
 src/pkgcheck/checks/whitespace.py   | 17 +++--
 .../BadCommandsCheck/BannedEapiCommand/expected.json|  2 +-
 .../BadCommandsCheck/BannedEapiCommand/fix.patch|  4 ++--
 .../DeprecatedEapiCommand/expected.json |  2 +-
 .../BadCommandsCheck/DeprecatedEapiCommand/fix.patch|  4 ++--
 .../repos/standalone/EapiCheck/BannedEapi/fix.patch |  3 ++-
 .../repos/standalone/EapiCheck/DeprecatedEapi/fix.patch |  3 ++-
 .../EbuildUnquotedVariable/expected.json|  6 +++---
 .../EbuildUnquotedVariable/fix.patch|  4 ++--
 .../InsintoCheck/DeprecatedInsinto/expected.json| 10 +-
 .../standalone/InsintoCheck/DeprecatedInsinto/fix.patch |  6 +++---
 .../standalone/IuseCheck/InvalidUseFlags/fix.patch  |  2 +-
 .../standalone/IuseCheck/UnknownUseFlags/fix.patch  |  2 +-
 .../MissingSlotDepCheck/MissingSlotDep/fix.patch|  2 +-
 .../ReadonlyVariable/expected.json  |  2 +-
 .../ReadonlyVariableCheck/ReadonlyVariable/fix.patch|  3 ++-
 .../RedundantDodirCheck/RedundantDodir/expected.json|  6 +++---
 .../RedundantDodirCheck/RedundantDodir/fix.patch| 12 ++--
 .../RequiredUseCheck/RequiredUseDefaults/fix.patch  |  2 +-
 .../standalone/RequiredUseCheck/UnstatedIuse/fix.patch  |  2 +-
 .../standalone/SrcUriCheck/RedundantUriRename/fix.patch |  6 --
 .../standalone/SrcUriCheck/TarballAvailable/fix.patch   |  2 +-
 .../EbuildVariableScope/expected.json   |  2 +-
 .../VariableScopeCheck/EbuildVariableScope/fix.patch|  6 +++---
 .../BadWhitespaceCharacter/expected.json|  6 +++---
 .../WhitespaceCheck/BadWhitespaceCharacter/fix.patch|  4 ++--
 .../WhitespaceCheck/MissingEAPIBlankLine/expected.json  |  1 +
 .../WhitespaceCheck/MissingEAPIBlankLine/fix.patch  |  9 +
 .../BannedEapiCommand/BannedEapiCommand-0.ebuild|  1 +
 .../DeprecatedEapiCommand-0.ebuild  |  1 +
 .../BadDependency/BadDependency-0.ebuild|  1 +
 .../InvalidBdepend/InvalidBdepend-0.ebuild  |  1 +
 .../InvalidDepend/InvalidDepend-0.ebuild|  1 +
 .../InvalidPdepend/InvalidPdepend-0.ebuild  |  1 +
 .../InvalidRdepend/InvalidRdepend-0.ebuild  |  1 +
 .../MissingUseDepDefault/MissingUseDepDefault-0.ebuild  |  1 +
 .../standalone/EapiCheck/BannedEapi/BannedEapi-0.ebuild |  1 +
 .../EapiCheck/DeprecatedEapi/DeprecatedEapi-0.ebuild|  1 +
 .../EbuildUnquotedVariable-0.ebuild |  1 +
 .../DeprecatedInsinto/DeprecatedInsinto-1.ebuild|  1 +
 .../IuseCheck/InvalidUseFlags/InvalidUseFlags-4.ebuild  |  1 +
 .../IuseCheck/UnknownUseFlags/UnknownUseFlags-0.ebuild  |  1 +
 .../MissingSlotDep/MissingSlotDep-0.ebuild  |  1 +
 .../ReadonlyVariable/ReadonlyVariable-0.ebuild  |  1 +
 .../RedundantDodir/RedundantDodir-0.ebuild  |  1 +
 .../RequiredUseDefaults/RequiredUseDefaults-0.ebuild|  1 +
 .../RequiredUseCheck/UnstatedIuse/UnstatedIuse-0.ebuild |  1 +
 .../RedundantUriRename/RedundantUriRename-0.ebuild  |  1 +
 .../RedundantUriRename/RedundantUriRename-1.ebuild  |  1 +
 .../TarballAvailable/TarballAvailable-0.ebuild  |  1 +
 .../EbuildVariableScope/EbuildVariableScope-0.ebuild|  1 +
 .../BadWhitespaceCharacter-0.ebuild |  1 +
 .../MissingEAPIBlankLine/MissingEAPIBlankLine-0.ebuild} |  3 +--
 54 files changed, 106 insertions(+), 55 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index 880675c3..92e13cd3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,7 +9,7 @@ requires = [
"pathspec",
"tree-sitter>=0.19.0",
"snakeoil~=0.10.4",
-   "pkgcore~=0.12.20",
+   "pkgcore~=0.12.21",
 ]
 build-backend = "setuptools.build_meta"
 
@@ -41,7 +41,7 @@ dependencies = [
"pathspec",
"tree-sitter>=0.19.0",
"snakeoil~=0.10.4",
-   "pkgcore~=0.12.18",
+   "pkgcore~=0.12.21",
 ]
 
 [project.optional-dependencies]

diff --git a/src/pkgcheck/checks/whitespace.py 
b/src/pkgcheck/checks/whitespace.py
index 823a8cfd..31667f9c 100644
--- a/src/pkgcheck/checks/whitespace.py
+++ b/src/pkgcheck/checks/whitespace.py
@@ -73,6 +73,12 @@ class BadWhitespaceCharacter(results.LineResult, 
results.Warning):
 )
 
 
+class MissingEAPIBlankLine(results.VersionResult, results.Style):
+

[gentoo-commits] proj/pkgcore/pkgcheck:master commit in: testdata/repos/standalone/EbuildUnquotedVariablesCheck/EbuildUnquotedVariable/, ...

2022-11-09 Thread Arthur Zamarin
commit: d3c5be6fe4b20c405246950de3ac734068db372e
Author: Arthur Zamarin  gentoo  org>
AuthorDate: Wed Nov  9 20:02:12 2022 +
Commit: Arthur Zamarin  gentoo  org>
CommitDate: Wed Nov  9 20:02:12 2022 +
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  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}-)" # ok
export TMPDIR # ok
+
+   unset TMPDIR # ok
 }