aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-09-15 13:16:01 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2023-09-23 18:36:03 +0300
commit9b6446766f42a829f2a07a55989f4e404531fd3e (patch)
tree7d95444ed4a8c66781a0f02926bd080f58bf6c20 /testdata
parentBannedPhaseCall: detect calls of phase functions directly (diff)
downloadpkgcheck-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')
-rw-r--r--testdata/data/repos/standalone/DeclarationShadowedCheck/VariableShadowed/expected.json3
-rw-r--r--testdata/data/repos/standalone/DeclarationShadowedCheck/VariableShadowed/fix.patch21
-rw-r--r--testdata/repos/standalone/DeclarationShadowedCheck/VariableShadowed/VariableShadowed-0.ebuild16
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