@zohodesk/codestandard-analytics
Advanced tools
Comparing version 0.0.1-exp-26 to 0.0.1-exp-27
@@ -36,2 +36,3 @@ "use strict"; | ||
global.analytics.status = "FAILURE"; | ||
global.analytics.message = "Issues are detected, please review and resolve the warnings/errors."; | ||
} | ||
@@ -38,0 +39,0 @@ return true; |
@@ -42,3 +42,4 @@ "use strict"; | ||
status: "SUCCESS", | ||
sonarQubeStatus: true | ||
sonarQubeStatus: true, | ||
message: "No issues are found, your code adheres to the required standards." | ||
}; | ||
@@ -45,0 +46,0 @@ } |
@@ -23,3 +23,4 @@ "use strict"; | ||
status: "SUCCESS", | ||
sonarQubeStatus: false | ||
sonarQubeStatus: false, | ||
message: "No issues are found, your code adheres to the required standards." | ||
}; | ||
@@ -26,0 +27,0 @@ const [,, action, ...option] = process.argv; |
@@ -7,2 +7,10 @@ "use strict"; | ||
exports.encrypt = exports.decrypt = void 0; | ||
/** | ||
* | ||
* @function caesarCipher - function used to encrypt and decrypt | ||
* @param {string} str - input string | ||
* @param {number} shift - shifters | ||
* @returns {string} | ||
*/ | ||
const caesarCipher = (str, shift) => { | ||
@@ -19,5 +27,22 @@ return str.split("").map(char => { | ||
}; | ||
/** | ||
* | ||
* @function encrypt - function that encrypt | ||
* @param {string} plaintext - input string | ||
* @param {number} shift - shifters | ||
* @returns {string} | ||
*/ | ||
const encrypt = (plaintext, shift) => caesarCipher(plaintext, shift); | ||
/** | ||
* | ||
* @function decrypt - function that decrypt | ||
* @param {string} ciphertext - input string | ||
* @param {number} shift - shifters | ||
* @returns {string} | ||
*/ | ||
exports.encrypt = encrypt; | ||
const decrypt = (ciphertext, shift) => caesarCipher(ciphertext, 26 - shift); | ||
exports.decrypt = decrypt; |
@@ -162,21 +162,27 @@ "use strict"; | ||
}); | ||
const { | ||
hostname, | ||
port, | ||
pathname | ||
} = new URL(`${exemptionInstanceHost}/getApprovedTicket`); | ||
const apiInfo = { | ||
method: "GET", | ||
hostname: hostname, | ||
port: port, | ||
path: pathname, | ||
headers: { | ||
"Content-Type": "text/json", | ||
Authentication: "password", | ||
"Content-Length": Buffer.byteLength(requestBody) | ||
}, | ||
maxRedirects: 20 | ||
}; | ||
var exemption_response = JSON.parse(await requestAPI(apiInfo, requestBody)); | ||
_logger.Logger.log(_logger.Logger.INFO_TYPE, exemption_response.status == "Approved" ? `\n Exemption is Applied to this ${(0, _getSonarProperties.getBranchName)()}` : `\n Exemption is not required for this ${(0, _getSonarProperties.getBranchName)()}`); | ||
try { | ||
const { | ||
hostname, | ||
port, | ||
pathname | ||
} = new URL(`${exemptionInstanceHost}/getApprovedTicket`); | ||
const apiInfo = { | ||
method: "GET", | ||
hostname: hostname, | ||
port: port, | ||
path: pathname, | ||
headers: { | ||
"Content-Type": "text/json", | ||
Authentication: "password", | ||
"Content-Length": Buffer.byteLength(requestBody) | ||
}, | ||
maxRedirects: 20 | ||
}; | ||
var exemption_response = JSON.parse(await requestAPI(apiInfo, requestBody)); | ||
} catch (error) { | ||
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, 'seems like given invalid exemption url. so exemption not applied'); | ||
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, error.message); | ||
return false; | ||
} | ||
_logger.Logger.log(_logger.Logger.INFO_TYPE, exemption_response.status == "Approved" ? `\n Exemption is Applied to this ${(0, _getSonarProperties.getBranchName)()} Branch` : `\n Exemption is not required for this ${(0, _getSonarProperties.getBranchName)()}`); | ||
return exemption_response.status == "free" ? false : exemption_response.status == "Approved" ? true : false; | ||
@@ -183,0 +189,0 @@ } |
{ | ||
"name": "@zohodesk/codestandard-analytics", | ||
"version": "0.0.1-exp-26", | ||
"version": "0.0.1-exp-27", | ||
"description": "linting tool", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
743285
2385