So, I've analyzed my project with Sonar and I get this weird error: Always use curly braces for if/else/for/while/do statements
I know normally what this mean (and I don't create blocks without curly braces) but in this case it's weird: The errors appears mostly at this types of code (when using && or ||) and I was wondering why:
if (isCreate && latitude && longitude) {
...some code here...
}
EDIT:
The entire code:
var map = Ext.getCmp('map_canvas').getMap();
var latitude = Ext.getCmp('latitudeCmp').getValue();
var longitude = Ext.getCmp('longitudeCmp').getValue();
if (isCreate && latitude && longitude) {
var center = new google.maps.LatLng(latitude, longitude);
map.setCenter(center);
var marker = new google.maps.Marker({ position: center, map: map,icon: staticPath+'/images/residence_gMap.png'});
markersArray.push(marker);
} else if (latitude && longitude) {
var center = new google.maps.LatLng(latitude, longitude);
map.setCenter(center);
} else if (!latitude && !longitude) {
var siteEditAction = Seam.Component.getInstance('siteEditAction');
siteEditAction.getGeolocalizationParameters(fillMapParamsCallback, exceptionHandler);
}
This may be a bug in the Sonar Javascript Plugin. Can you please report your case on the user@sonar.codhaus.org mailing list: our language team will have a look at it and maybe fill an issue on our JIRA.
正如我在Sonar邮件列表( http://markmail.org/message/dva7u5pxtggsiz7x )中回答的那样:您面临以下两个问题,这些问题将在下一版本中解决-http://jira.codehaus.org/browse/SONARPLUGINS- 2079和http://jira.codehaus.org/browse/SONARPLUGINS-2200
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.