Sap.ui5.define Template recognized as undefined variable

Hello SonarQube - Team!

We are working in our company with SAP UI5 - which is a JS Framework for browser SAP application. The framework uses it’s own structure/templates

As you can see - your code check always states this “UI5 definition statement” as a bug. But this is none. We need to exclude this check. But we want to keep on using the rule - because the rule itself makes sense. So we ask you to please exclude sap.ui.define per regex (or whatever) out of this rule.

Or please suggest a better solution.



Hey there.

What version of SonarQube are you using?

Hello Colin,

Version 8.9.8




As noted in the rule description:

This rule does not raise issues on global variables which are defined with sonar.javascript.globals and sonar.javascript.environments properties.

So I suggest diving into the global/project-level Administration > Languages > Javascript and adding sap to suppress these issues.

I’ll flag this internally to see if sap is one we’d want to add to the defaults.

Hello Andreas,

Welcome to the Sonar community, and thank you for your feedback!

We can indeed add sap to the list of global defaults. I created this ticket to address this as soon as possible. In the meantime, you can indeed use the sonar.javascript.globals property as suggested by Colin.

Hope this helps,

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.