Goal : Ability, to create a custom rule set, such that, if a groovy script file has duplicate global variables defined in a groovy script, it should disallow such variable declartions in a file.
I understand, this is technically a valid declaration, since, this is basically overriding the global variable. There's a architectural faultline in the design of the system, where in we need to disallow such declarations, else these declarations comes out as runtime detonators. (declaring the variable final is not an option,since it would involve, refactoring hundreds of groovy scripts.)
Please advice, how can I add a custom rule set to avoid duplicate global variable definition in a groovy shell script.