Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Finding unused variables #4245

kururin ·


Would you recommend any specific approach to list unused variables in a configuration (and its children)?
I made a script to clean up unused steps, but doing the same for variables is more complicated because a variable can be referenced by any script...
Exporting configurations (xml) and parsing them would be solution but I'm wondering if you have a better way to do that.

Thank you :)

  • replies 2
  • views 180
  • stars 0
robinshen ADMIN ·

Something like below should work:


import com.pmease.quickbuild.migration.*

def someConf = ...
def varRef1 = "vars.getValue(\"some var\")"
def varRef2 = "vars.get(\"some var\")"

def xml = VersionedDocument.fromBean(someConf).toXML();
if (xml.contains(varRef1) || xml.contains(varRef2)) {
  used = true
} else {
  for (eachChild in system.configurationManager.getDescendents()) {
    def xml = VersionedDocument.fromBean(eachChild).toXML();
    if (xml.contains(varRef1) || xml.contains(varRef2)) {
      used = true
kururin ·

Thank you!