You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2026/05/15 08:09:50 UTC

(groovy) branch master updated: minor refactor: fix sonarqube warnings

This is an automated email from the ASF dual-hosted git repository.

paulk-asert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 7f8308ad91 minor refactor: fix sonarqube warnings
7f8308ad91 is described below

commit 7f8308ad91ed9b4cee46954e593455004b0cac55
Author: Paul King <pa...@asert.com.au>
AuthorDate: Fri May 15 18:09:41 2026 +1000

    minor refactor: fix sonarqube warnings
---
 src/spec/doc/assets/js/view-example.js                              | 6 +++---
 .../groovy/tools/groovydoc/gstringTemplates/topLevel/index.html     | 4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/spec/doc/assets/js/view-example.js b/src/spec/doc/assets/js/view-example.js
index 62ac61a2f9..c990e1a394 100644
--- a/src/spec/doc/assets/js/view-example.js
+++ b/src/spec/doc/assets/js/view-example.js
@@ -22,10 +22,10 @@ function toggle_result_block(e) {
 
 function insert_result_links() {
         $('.result').each(function (idx, node) {
-            znode = $(node);
-            p = $(znode.parent().children()[0]);
+            const znode = $(node);
+            const p = $(znode.parent().children()[0]);
             p.append(' <a class="view-result" href="#">[ view example ]</a>');
-            view_result_link = p.children().last();
+            const view_result_link = p.children().last();
             view_result_link.on('click', $.proxy(toggle_result_block, znode));
         });
         }
diff --git a/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/topLevel/index.html b/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/topLevel/index.html
index 1282d9a437..764e84f3ce 100644
--- a/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/topLevel/index.html
+++ b/subprojects/groovy-groovydoc/src/main/resources/org/codehaus/groovy/tools/groovydoc/gstringTemplates/topLevel/index.html
@@ -26,7 +26,9 @@
 <link href="groovy.ico" type="image/x-icon" rel="shortcut icon">
 <link href="groovy.ico" type="image/x-icon" rel="icon">
 <script type="text/javascript">
-    targetPage = "" + window.location.search;
+    // Must be `var` (not let/const): it is read cross-frame as `top.targetPage`
+    // below, which requires it to be a property of the global object.
+    var targetPage = "" + window.location.search;
     if (targetPage != "" && targetPage != "undefined")
         targetPage = targetPage.substring(1);
     if (targetPage.indexOf(":") != -1)