Permalink
Browse files

Fix jsHint issues

  • Loading branch information...
1 parent 487f571 commit 276630ad114afc95930beafed26cd563ccb47941 Andre Rodrigues committed Feb 17, 2013
Showing with 1,862 additions and 2,046 deletions.
  1. +27 −0 .jshintrc
  2. +5 −6 lib/azure.js
  3. +21 −22 lib/diagnostics/logger.js
  4. +47 −47 lib/http/webresource.js
  5. +4 −5 lib/serviceruntime/fileinputchannel.js
  6. +3 −4 lib/serviceruntime/goalstatedeserializer.js
  7. +23 −28 lib/serviceruntime/namedpipeinputchannel.js
  8. +3 −4 lib/serviceruntime/namedpipeoutputchannel.js
  9. +3 −4 lib/serviceruntime/protocol1runtimeclient.js
  10. +3 −4 lib/serviceruntime/protocol1runtimecurrentstateclient.js
  11. +3 −5 lib/serviceruntime/protocol1runtimegoalstateclient.js
  12. +59 −57 lib/serviceruntime/roleenvironment.js
  13. +3 −4 lib/serviceruntime/runtimekernel.js
  14. +9 −8 lib/serviceruntime/runtimeversionmanager.js
  15. +7 −8 lib/serviceruntime/runtimeversionprotocolclient.js
  16. +4 −7 lib/serviceruntime/xmlcurrentstateserializer.js
  17. +4 −5 lib/serviceruntime/xmlgoalstatedeserializer.js
  18. +27 −30 lib/serviceruntime/xmlroleenvironmentdatadeserializer.js
  19. +129 −150 lib/services/blob/blobservice.js
  20. +2 −6 lib/services/blob/hmacsha256sign.js
  21. +5 −6 lib/services/blob/models/blobresult.js
  22. +2 −4 lib/services/blob/models/blocklistresult.js
  23. +3 −4 lib/services/blob/models/containeraclresult.js
  24. +12 −11 lib/services/blob/models/containerresult.js
  25. +2 −3 lib/services/blob/models/leaseresult.js
  26. +3 −6 lib/services/blob/models/listblobsresultcontinuation.js
  27. +3 −6 lib/services/blob/models/listcontainersresultcontinuation.js
  28. +3 −6 lib/services/blob/models/servicepropertiesresult.js
  29. +17 −18 lib/services/blob/sharedaccesssignature.js
  30. +15 −11 lib/services/blob/sharedkey.js
  31. +9 −9 lib/services/blob/sharedkeylite.js
  32. +26 −26 lib/services/core/connectionstringparser.js
  33. +20 −20 lib/services/core/exponentialretrypolicyfilter.js
  34. +13 −13 lib/services/core/linearretrypolicyfilter.js
  35. +4 −9 lib/services/core/servicebusserviceclient.js
  36. +9 −10 lib/services/core/servicebussettings.js
  37. +53 −59 lib/services/core/serviceclient.js
  38. +25 −28 lib/services/core/servicemanagementclient.js
  39. +9 −12 lib/services/core/servicemanagementsettings.js
  40. +15 −22 lib/services/core/servicesettings.js
  41. +4 −9 lib/services/core/sqlserviceclient.js
  42. +9 −16 lib/services/core/storageserviceclient.js
  43. +14 −20 lib/services/core/storageservicesettings.js
  44. +3 −6 lib/services/queue/models/listqueuesresultcontinuation.js
  45. +2 −4 lib/services/queue/models/queuemessageresult.js
  46. +6 −5 lib/services/queue/models/queueresult.js
  47. +3 −6 lib/services/queue/models/servicepropertiesresult.js
  48. +54 −57 lib/services/queue/queueservice.js
  49. +3 −7 lib/services/serviceBus/models/acstokenresult.js
  50. +0 −3 lib/services/serviceBus/models/notificationhubresult.js
  51. +11 −15 lib/services/serviceBus/models/queuemessageresult.js
  52. +11 −11 lib/services/serviceBus/models/resourceresult.js
  53. +0 −2 lib/services/serviceBus/models/ruleresult.js
  54. +31 −33 lib/services/serviceBus/notificationhubservice.js
  55. +159 −157 lib/services/serviceBus/servicebusservice.js
  56. +21 −25 lib/services/serviceBus/servicebusservicebase.js
  57. +5 −14 lib/services/serviceBus/wrap.js
  58. +16 −20 lib/services/serviceBus/wrapservice.js
  59. +5 −15 lib/services/serviceBus/wraptokenmanager.js
  60. +1 −1 lib/services/serviceManagement/models/namevalidation.js
  61. +70 −76 lib/services/serviceManagement/models/roleparser.js
  62. +76 −78 lib/services/serviceManagement/models/servicemanagementserialize.js
  63. +66 −71 lib/services/serviceManagement/servicebusmanagementservice.js
  64. +242 −244 lib/services/serviceManagement/servicemanagementservice.js
  65. +4 −7 lib/services/serviceManagement/sqlmanagementservice.js
  66. +3 −11 lib/services/sqlAzure/models/databaseresult.js
  67. +6 −12 lib/services/sqlAzure/sqlserveracs.js
  68. +15 −19 lib/services/sqlAzure/sqlservice.js
  69. +19 −19 lib/services/table/batchserviceclient.js
  70. +5 −14 lib/services/table/models/entityresult.js
  71. +3 −4 lib/services/table/models/queryentitiesresultcontinuation.js
  72. +3 −4 lib/services/table/models/querytablesresultcontinuation.js
  73. +5 −15 lib/services/table/models/tableresult.js
  74. +4 −7 lib/services/table/sharedkeylitetable.js
  75. +4 −7 lib/services/table/sharedkeytable.js
  76. +16 −16 lib/services/table/tablequery.js
  77. +81 −83 lib/services/table/tableservice.js
  78. +34 −34 lib/util/atomhandler.js
  79. +0 −16 lib/util/constants.js
  80. +45 −45 lib/util/iso8061date.js
  81. +31 −31 lib/util/js2xml.js
  82. +108 −102 lib/util/odatahandler.js
  83. +1 −1 lib/util/rfc1123date.js
  84. +17 −13 lib/util/util.js
  85. +3 −3 lib/util/validate.js
  86. +9 −1 package.json
View
@@ -0,0 +1,27 @@
+{
+ "node": true,
+ "bitwise": true,
+ "camelcase": true,
+ "curly": false,
+ "eqeqeq": false,
+ "forin": true,
+ "immed": true,
+ "indent": 2,
+ "latedef": true,
+ "newcap": true,
+ "noarg": true,
+ "noempty": true,
+ "nonew": true,
+ "plusplus": false,
+ "quotmark": "single",
+ "regexp": true,
+ "undef": true,
+ "unused": true,
+ "strict": false,
+ "trailing": true,
+ "maxparams": false,
+ "maxdepth": false,
+ "maxstatements": false,
+ "maxcomplexity": false,
+ "sub": true
+}
View
@@ -58,13 +58,12 @@ exports.createBlobService = function (storageAccountOrConnectionString, storageA
/**
* Queue client exports.
*/
-
var QueueService = require('./services/queue/queueservice');
exports.QueueService = QueueService;
/**
* Creates a new QueueService object.
-* If no storageAccount or storageAccessKey are provided, the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY
+* If no storageAccount or storageAccessKey are provided, the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY
* environment variables will be used.
*
* @param {string} [storageAccountOrConnectionString] The storage account or the connection string.
@@ -135,7 +134,7 @@ exports.SqlService = SqlService;
* @param {string} [acsHost] The acs host.
* @param {object} [authenticationProvider] The authentication provider.
*/
-exports.createSqlService = function(serverName, administratorLogin, administratorLoginPassword, host, acsHost, authenticationProvider) {
+exports.createSqlService = function (serverName, administratorLogin, administratorLoginPassword, host, acsHost, authenticationProvider) {
return new SqlService(serverName, administratorLogin, administratorLoginPassword, host, acsHost, authenticationProvider);
};
@@ -164,7 +163,7 @@ exports.ServiceManagementService = ServiceManagementService;
* serializetype: 'XML'
* }
*/
-exports.createServiceManagementService = function(subscriptionId, authentication, hostOptions) {
+exports.createServiceManagementService = function (subscriptionId, authentication, hostOptions) {
return new ServiceManagementService(subscriptionId, authentication, hostOptions);
};
@@ -193,7 +192,7 @@ exports.SqlManagementService = SqlManagementService;
* serializetype: 'XML'
* }
*/
-exports.createSqlManagementService = function(subscriptionId, authentication, hostOptions) {
+exports.createSqlManagementService = function (subscriptionId, authentication, hostOptions) {
return new SqlManagementService(subscriptionId, authentication, hostOptions);
};
@@ -222,7 +221,7 @@ exports.ServiceBusManagementService = ServiceBusManagementService;
* serializetype: 'XML'
* }
*/
-exports.createServiceBusManagementService = function(subscriptionId, authentication, hostOptions) {
+exports.createServiceBusManagementService = function (subscriptionId, authentication, hostOptions) {
return new ServiceBusManagementService(subscriptionId, authentication, hostOptions);
};
View
@@ -13,8 +13,23 @@
* limitations under the License.
*/
-// Expose 'Logger'.
-exports = module.exports = Logger;
+function Logger(level, loggerFunction) {
+ var self = this;
+
+ this.level = level;
+ this.loggerFunction = loggerFunction;
+
+ if (!this.loggerFunction) {
+ this.loggerFunction = function (logLevel, msg) {
+ var currentLevelIndex = Logger.logPriority.indexOf(self.level);
+ var logLeveLIndex = Logger.logPriority.indexOf(logLevel);
+
+ if (logLeveLIndex <= currentLevelIndex) {
+ console.log(self.level + ' : ' + msg);
+ }
+ };
+ }
+}
Logger.LogLevels = {
/**
@@ -58,7 +73,7 @@ Logger.LogLevels = {
DEBUG : 'debug'
};
-Logger.logPriority = [
+Logger.logPriority = [
Logger.LogLevels.EMERGENCY,
Logger.LogLevels.ALERT,
Logger.LogLevels.CRITICAL,
@@ -69,24 +84,8 @@ Logger.logPriority = [
Logger.LogLevels.DEBUG
];
-function Logger(level, loggerFunction) {
- var self = this;
-
- this.level = level;
- this.loggerFunction = loggerFunction;
-
- if (!this.loggerFunction) {
- this.loggerFunction = function (logLevel, msg) {
- var currentLevelIndex = Logger.logPriority.indexOf(self.level);
- var logLeveLIndex = Logger.logPriority.indexOf(logLevel);
-
- if (logLeveLIndex <= currentLevelIndex) {
- console.log(self.level + ' : ' + msg);
- }
- };
- }
-}
-
Logger.prototype.log = function (level, msg) {
this.loggerFunction(level, msg);
-};
+};
+
+module.exports = Logger;
View
@@ -15,13 +15,13 @@
// Module dependencies.
var azureutil = require('../util/util');
-var ServiceClient = require('../services/core/serviceclient');
var Constants = require('../util/constants');
var HeaderConstants = Constants.HeaderConstants;
var HttpConstants = Constants.HttpConstants;
-// Expose 'WebResource'.
-exports = module.exports = WebResource;
+function encodeSpecialCharacters(path) {
+ return path.replace(/'/g, '%27');
+}
/**
* Creates a new WebResource object.
@@ -97,7 +97,7 @@ WebResource.del = function (path) {
* @param {string} path The path for the post operation.
* @return {WebResource} A new webresource with a post operation for the given path.
*/
-WebResource.post = function(path) {
+WebResource.post = function (path) {
var webResource = new WebResource();
webResource.path = path ? encodeSpecialCharacters(path) : null;
webResource.httpVerb = HttpConstants.HttpVerbs.POST;
@@ -205,10 +205,12 @@ WebResource.prototype.getQueryStringValues = function (uriEncode) {
var queryString = {};
if (this._queryString) {
for (var queryStringName in this._queryString) {
- var queryStringEntry = this._queryString[queryStringName];
- queryString[queryStringName] = (uriEncode && queryStringEntry.uriEncodable) ?
- azureutil.encodeUri(queryStringEntry.value) :
- queryStringEntry.value;
+ if (this._queryString.hasOwnProperty(queryStringName)) {
+ var queryStringEntry = this._queryString[queryStringName];
+ queryString[queryStringName] = (uriEncode && queryStringEntry.uriEncodable) ?
+ azureutil.encodeUri(queryStringEntry.value) :
+ queryStringEntry.value;
+ }
}
}
@@ -226,7 +228,9 @@ WebResource.prototype.getQueryString = function (uriEncode) {
if (queryStringValues) {
var parametersString = [];
for (var parameter in queryStringValues) {
- parametersString.push(parameter + '=' + queryStringValues[parameter]);
+ if (queryStringValues.hasOwnProperty(parameter)) {
+ parametersString.push(parameter + '=' + queryStringValues[parameter]);
+ }
}
if (parametersString.length > 0) {
@@ -278,58 +282,56 @@ WebResource.prototype.addOptionalHeader = function (name, value) {
WebResource.prototype.addOptionalMetadataHeaders = function (metadata) {
if (metadata) {
for (var metadataHeader in metadata) {
- this.addOptionalHeader(HeaderConstants.PREFIX_FOR_STORAGE_METADATA + metadataHeader.toLowerCase(), metadata[metadataHeader]);
+ if (metadata.hasOwnProperty(metadataHeader)) {
+ this.addOptionalHeader(HeaderConstants.PREFIX_FOR_STORAGE_METADATA + metadataHeader.toLowerCase(), metadata[metadataHeader]);
+ }
}
}
return this;
};
WebResource.prototype.addOptionalAccessConditionHeader = function (accessConditionHeaders) {
- if (accessConditionHeaders) {
- var ifMatch = azureutil.tryGetValueInsensitive(HeaderConstants.IF_MATCH, accessConditionHeaders);
- if (ifMatch) {
- this.addOptionalHeader(HeaderConstants.IF_MATCH, ifMatch);
- }
+ var ifMatch = azureutil.tryGetValueInsensitive(HeaderConstants.IF_MATCH, accessConditionHeaders);
+ if (ifMatch) {
+ this.addOptionalHeader(HeaderConstants.IF_MATCH, ifMatch);
+ }
- var ifModifiedSince = azureutil.tryGetValueInsensitive(HeaderConstants.IF_MODIFIED_SINCE, accessConditionHeaders);
- if (ifModifiedSince) {
- this.addOptionalHeader(HeaderConstants.IF_MODIFIED_SINCE, ifModifiedSince);
- }
+ var ifModifiedSince = azureutil.tryGetValueInsensitive(HeaderConstants.IF_MODIFIED_SINCE, accessConditionHeaders);
+ if (ifModifiedSince) {
+ this.addOptionalHeader(HeaderConstants.IF_MODIFIED_SINCE, ifModifiedSince);
+ }
- var ifNoneMatch = azureutil.tryGetValueInsensitive(HeaderConstants.IF_NONE_MATCH, accessConditionHeaders);
- if (ifNoneMatch) {
- this.addOptionalHeader(HeaderConstants.IF_NONE_MATCH, ifNoneMatch);
- }
+ var ifNoneMatch = azureutil.tryGetValueInsensitive(HeaderConstants.IF_NONE_MATCH, accessConditionHeaders);
+ if (ifNoneMatch) {
+ this.addOptionalHeader(HeaderConstants.IF_NONE_MATCH, ifNoneMatch);
+ }
- var ifUnmodifiedSince = azureutil.tryGetValueInsensitive(HeaderConstants.IF_UNMODIFIED_SINCE, accessConditionHeaders);
- if (ifUnmodifiedSince) {
- this.addOptionalHeader(HeaderConstants.IF_UNMODIFIED_SINCE, ifUnmodifiedSince);
- }
+ var ifUnmodifiedSince = azureutil.tryGetValueInsensitive(HeaderConstants.IF_UNMODIFIED_SINCE, accessConditionHeaders);
+ if (ifUnmodifiedSince) {
+ this.addOptionalHeader(HeaderConstants.IF_UNMODIFIED_SINCE, ifUnmodifiedSince);
}
};
WebResource.prototype.addOptionalSourceAccessConditionHeader = function (accessConditionHeaders) {
- if (accessConditionHeaders) {
- var sourceIfMatch = azureutil.tryGetValueInsensitive(HeaderConstants.SOURCE_IF_MATCH_HEADER, accessConditionHeaders);
- if (sourceIfMatch) {
- this.addOptionalHeader(HeaderConstants.SOURCE_IF_MATCH_HEADER, sourceIfMatch);
- }
+ var sourceIfMatch = azureutil.tryGetValueInsensitive(HeaderConstants.SOURCE_IF_MATCH_HEADER, accessConditionHeaders);
+ if (sourceIfMatch) {
+ this.addOptionalHeader(HeaderConstants.SOURCE_IF_MATCH_HEADER, sourceIfMatch);
+ }
- var sourceIfModifiedSince = azureutil.tryGetValueInsensitive(HeaderConstants.SOURCE_IF_MODIFIED_SINCE_HEADER, accessConditionHeaders);
- if (sourceIfModifiedSince) {
- this.addOptionalHeader(HeaderConstants.SOURCE_IF_MODIFIED_SINCE_HEADER, sourceIfModifiedSince);
- }
+ var sourceIfModifiedSince = azureutil.tryGetValueInsensitive(HeaderConstants.SOURCE_IF_MODIFIED_SINCE_HEADER, accessConditionHeaders);
+ if (sourceIfModifiedSince) {
+ this.addOptionalHeader(HeaderConstants.SOURCE_IF_MODIFIED_SINCE_HEADER, sourceIfModifiedSince);
+ }
- var sourceIfNoneMatch = azureutil.tryGetValueInsensitive(HeaderConstants.SOURCE_IF_NONE_MATCH_HEADER, accessConditionHeaders);
- if (sourceIfNoneMatch) {
- this.addOptionalHeader(HeaderConstants.SOURCE_IF_NONE_MATCH_HEADER, sourceIfNoneMatch);
- }
+ var sourceIfNoneMatch = azureutil.tryGetValueInsensitive(HeaderConstants.SOURCE_IF_NONE_MATCH_HEADER, accessConditionHeaders);
+ if (sourceIfNoneMatch) {
+ this.addOptionalHeader(HeaderConstants.SOURCE_IF_NONE_MATCH_HEADER, sourceIfNoneMatch);
+ }
- var sourceIfUnmodifiedSince = azureutil.tryGetValueInsensitive(HeaderConstants.SOURCE_IF_UNMODIFIED_SINCE_HEADER, accessConditionHeaders);
- if (sourceIfUnmodifiedSince) {
- this.addOptionalHeader(HeaderConstants.SOURCE_IF_UNMODIFIED_SINCE_HEADER, sourceIfUnmodifiedSince);
- }
+ var sourceIfUnmodifiedSince = azureutil.tryGetValueInsensitive(HeaderConstants.SOURCE_IF_UNMODIFIED_SINCE_HEADER, accessConditionHeaders);
+ if (sourceIfUnmodifiedSince) {
+ this.addOptionalHeader(HeaderConstants.SOURCE_IF_UNMODIFIED_SINCE_HEADER, sourceIfUnmodifiedSince);
}
};
@@ -349,6 +351,4 @@ WebResource.prototype.validResponse = function (statusCode) {
return false;
};
-function encodeSpecialCharacters(path) {
- return path.replace(/'/g, '%27');
-}
+module.exports = WebResource;
@@ -17,10 +17,7 @@
var fs = require('fs');
var xml2js = require('xml2js');
-// Expose 'FileInputChannel'.
-exports = module.exports = FileInputChannel;
-
-function FileInputChannel() { }
+function FileInputChannel() {}
FileInputChannel.prototype.readInputChannel = function (name, parseXml, callback) {
this._readData(name, function (error, data) {
@@ -44,4 +41,6 @@ FileInputChannel.prototype.readInputChannel = function (name, parseXml, callback
FileInputChannel.prototype._readData = function (name, callback) {
fs.readFile(name, callback);
-};
+};
+
+module.exports = FileInputChannel;
@@ -16,9 +16,6 @@
// Module dependencies.
var XmlGoalStateDeserializer = require('./xmlgoalstatedeserializer');
-// Expose 'GoalStateDeserializer'.
-exports = module.exports = GoalStateDeserializer;
-
function GoalStateDeserializer() {
this.deserializer = new XmlGoalStateDeserializer();
}
@@ -29,4 +26,6 @@ GoalStateDeserializer.prototype.deserialize = function (xml) {
}
return this.deserializer.deserialize(xml);
-};
+};
+
+module.exports = GoalStateDeserializer;
Oops, something went wrong.

0 comments on commit 276630a

Please sign in to comment.