diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2023-09-15 13:16:01 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-09-23 18:36:03 +0300 |
commit | 9b6446766f42a829f2a07a55989f4e404531fd3e (patch) | |
tree | 7d95444ed4a8c66781a0f02926bd080f58bf6c20 /testdata | |
parent | BannedPhaseCall: detect calls of phase functions directly (diff) | |
download | pkgcheck-9b6446766f42a829f2a07a55989f4e404531fd3e.tar.gz pkgcheck-9b6446766f42a829f2a07a55989f4e404531fd3e.tar.bz2 pkgcheck-9b6446766f42a829f2a07a55989f4e404531fd3e.zip |
VariableShadowed: new check to detect shadowed variables
Resolves: https://github.com/pkgcore/pkgcheck/issues/622
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'testdata')
3 files changed, 40 insertions, 0 deletions
diff --git a/testdata/data/repos/standalone/DeclarationShadowedCheck/VariableShadowed/expected.json b/testdata/data/repos/standalone/DeclarationShadowedCheck/VariableShadowed/expected.json new file mode 100644 index 00000000..91e303eb --- /dev/null +++ b/testdata/data/repos/standalone/DeclarationShadowedCheck/VariableShadowed/expected.json @@ -0,0 +1,3 @@ +{"__class__": "VariableShadowed", "category": "DeclarationShadowedCheck", "package": "VariableShadowed", "version": "0", "lines": [11, 13], "var_name": "RDEPEND"} +{"__class__": "VariableShadowed", "category": "DeclarationShadowedCheck", "package": "VariableShadowed", "version": "0", "lines": [9, 15], "var_name": "RESTRICT"} +{"__class__": "VariableShadowed", "category": "DeclarationShadowedCheck", "package": "VariableShadowed", "version": "0", "lines": [5, 16], "var_name": "VAL"} diff --git a/testdata/data/repos/standalone/DeclarationShadowedCheck/VariableShadowed/fix.patch b/testdata/data/repos/standalone/DeclarationShadowedCheck/VariableShadowed/fix.patch new file mode 100644 index 00000000..2c184ed9 --- /dev/null +++ b/testdata/data/repos/standalone/DeclarationShadowedCheck/VariableShadowed/fix.patch @@ -0,0 +1,21 @@ +diff -Naur standalone/DeclarationShadowedCheck/VariableShadowed/VariableShadowed-0.ebuild fixed/DeclarationShadowedCheck/VariableShadowed/VariableShadowed-0.ebuild +--- standalone/DeclarationShadowedCheck/VariableShadowed/VariableShadowed-0.ebuild ++++ fixed/DeclarationShadowedCheck/VariableShadowed/VariableShadowed-0.ebuild +@@ -2,15 +2,12 @@ HOMEPAGE="https://github.com/pkgcore/pkgcheck" + DESCRIPTION="ebuild with shadowed variables" + S=${WORKDIR} + +-VAL= +- + SLOT="0" + LICENSE="BSD" +-RESTRICT="!test? ( test )" ++RESTRICT="test" + + RDEPEND="dev-lang/ruby" + DEPEND="${RDEPEND}" +-RDEPEND="dev-ruby/stub" ++RDEPEND+="dev-ruby/stub" + +-RESTRICT="test" + VAL=5 diff --git a/testdata/repos/standalone/DeclarationShadowedCheck/VariableShadowed/VariableShadowed-0.ebuild b/testdata/repos/standalone/DeclarationShadowedCheck/VariableShadowed/VariableShadowed-0.ebuild new file mode 100644 index 00000000..11dd30ce --- /dev/null +++ b/testdata/repos/standalone/DeclarationShadowedCheck/VariableShadowed/VariableShadowed-0.ebuild @@ -0,0 +1,16 @@ +HOMEPAGE="https://github.com/pkgcore/pkgcheck" +DESCRIPTION="ebuild with shadowed variables" +S=${WORKDIR} + +VAL= + +SLOT="0" +LICENSE="BSD" +RESTRICT="!test? ( test )" + +RDEPEND="dev-lang/ruby" +DEPEND="${RDEPEND}" +RDEPEND="dev-ruby/stub" + +RESTRICT="test" +VAL=5 |