Rule Definition
It is not possible to create a constant that can be used by both the manifest and the declaration of the class, a change of URL of the service would generate multiple code modifications.
Remediation
You should use only the existing instance of the OData model in the User class
Violation Code Sample
Definition 1 in the user object: (user.js)
function (Object, ODataModel, Filter, FilterOperator) {
....
constructor: function () {
var that = this;
this._oModel = new ODataModel("/abc/sap/abc/odata/smpl/v1/clientsite", {
disableHeadRequestForToken: true
});
this.onDataLoaded = that._loadUserAccount();
this.onFuncLocLoaded = this.onDataLoaded.then(function () {
return that._loadFuncLoc();
});
},
Same Definition in application manifest.json:
"_version": "1.4.0",
"sap.app":
...
"dataSources": {
"mainService": {
"uri": "/abc/sap/abc/odata/smpl/v1/clientsite",
"type": "OData",
"settings": {
"odataVersion": "2.0",
"localUri": "localService/metadata.xml"
}
}
},
"sourceTemplate": {
....
Related Technologies
Technical Criterion
Programming Practices - Structuredness
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.