@zohodesk/codestandard-analytics
Advanced tools
Comparing version 0.0.1-exp-15 to 0.0.1-exp-16
@@ -207,3 +207,3 @@ "use strict"; | ||
try { | ||
// fs.unlinkSync(getTempFilePath()); | ||
null; // fs.unlinkSync(getTempFilePath()); | ||
} catch (err) { | ||
@@ -215,3 +215,3 @@ Logger.log(Logger.FAILURE_TYPE, `Unable to remove file(Error occurred in if statement) ${file} ${err}`); | ||
try { | ||
// fs.unlinkSync(getTempFilePath()); | ||
null; // fs.unlinkSync(getTempFilePath()); | ||
} catch (err) { | ||
@@ -224,3 +224,3 @@ Logger.log(Logger.FAILURE_TYPE, `Unable to remove file(Error occurred in if statement) ${file} ${err}`); | ||
try { | ||
// fs.unlinkSync(getTempFilePath()); | ||
null; // fs.unlinkSync(getTempFilePath()); | ||
} catch (err) { | ||
@@ -310,3 +310,3 @@ Logger.log(Logger.FAILURE_TYPE, `Unable to remove file(Error occured in if statement) ${file} ${err}`); | ||
try { | ||
// fs.unlinkSync(getTempFilePath()); | ||
null; // fs.unlinkSync(getTempFilePath()); | ||
} catch (err) { | ||
@@ -318,3 +318,3 @@ Logger.log(Logger.INFO_TYPE, "Unable to remove file(Error occured in if statement in windows methoW)", file, err); | ||
try { | ||
// fs.unlinkSync(getTempFilePath()); | ||
null; // fs.unlinkSync(getTempFilePath()); | ||
} catch (err) { | ||
@@ -327,3 +327,3 @@ Logger.log(Logger.INFO_TYPE, "Unable to remove file(Error occured in else block in Windows method)", file, err); | ||
try { | ||
// fs.unlinkSync(getTempFilePath()); | ||
null; // fs.unlinkSync(getTempFilePath()); | ||
} catch (err) { | ||
@@ -330,0 +330,0 @@ Logger.log(Logger.INFO_TYPE, "Unable to remove file(Error occured in else block in Windows method)", file, err); |
@@ -107,2 +107,9 @@ "use strict"; | ||
} | ||
/** | ||
* @function fixEslintIssue - help to fix lint issue | ||
* @param {Array<String>} option - cli commads as array after parsing | ||
* @returns {void} | ||
*/ | ||
function fixEslintIssue(option) { | ||
@@ -109,0 +116,0 @@ // if(option.length == 1 && !checkIfFileExists(path.resolve(option))){ |
@@ -22,2 +22,5 @@ "use strict"; | ||
function executeSonarAnalysis(cliParams) { | ||
var { | ||
env | ||
} = cliParams; | ||
_logger.Logger.createLogFile(); | ||
@@ -39,6 +42,6 @@ const command = (0, _getSonarProperties.getSonarProperties)(cliParams); | ||
child_process.on("close", code => { | ||
code === 0 ? global.analytics.sonarQubeStatus = false : null; | ||
code === 0 ? global.analytics.sonarQubeStatus = true : null; | ||
_logger.Logger.stop(); | ||
(0, _sonarReportSummary.writeSummaryOfLint)(cliParams); | ||
(0, _getFileUtils.removeDiffFile)(); | ||
env == "ci" ? (0, _getFileUtils.removeDiffFile)() : null; | ||
_logger.Logger.cliLog(_logger.Logger.SUCCESS_TYPE, 'SonarQube analysis completed...'); | ||
@@ -45,0 +48,0 @@ _logger.Logger.cliLog(_logger.Logger.SUCCESS_TYPE, `Report ${code === 0 ? "successfully" : "failed"} sent to the server : Status - ${code === 0 ? "Success" : "Failure"}`); |
@@ -27,3 +27,3 @@ "use strict"; | ||
projectName: $projectName, | ||
reportUrl: global.analytics.sonarQubeStatus === false ? `${sonar_hostURL}/project/issues?id=${$projectName}&resolved=false` : sonar_hostURL, | ||
reportUrl: global.analytics.sonarQubeStatus === true ? `${sonar_hostURL}/project/issues?id=${$projectName}&resolved=false` : sonar_hostURL, | ||
jsonReportPath: (0, _getFileUtils.getLintReportPath)().toString() | ||
@@ -30,0 +30,0 @@ }; |
@@ -24,3 +24,3 @@ "use strict"; | ||
pipelineStatus: "passed", | ||
sonarQubeStatus: true | ||
sonarQubeStatus: false | ||
}; | ||
@@ -27,0 +27,0 @@ const [,, action, ...option] = process.argv; |
@@ -38,3 +38,3 @@ "use strict"; | ||
* @function consoleHelperCommands - This method console supported commands | ||
* @returns {void} | ||
* @returns {void} | ||
*/ | ||
@@ -51,4 +51,4 @@ | ||
_logger.Logger.log(_logger.Logger.INFO_TYPE, `Usage: npx ZDLintingFramework [command] [options]`); | ||
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Commands:\n' + ' lint Lint directory and files locally.\n' + ' lint-ci Lint files in CI with optional SonarQube integration.\n' + ' init Initialize configuration file.\n' + ' help Display list of supported commands.'); | ||
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Commands:\n' + ' lint Lint directory and files locally.\n' + ' lint-ci Lint files in CI with optional SonarQube integration.\n' + ' init Initialize configuration file.\n' + ' fix Assits to fix Lint issue \n' + ' help Display list of supported commands.'); | ||
_logger.Logger.log(_logger.Logger.INFO_TYPE, 'Options:\n' + ' --dir <path> Specify directory or file to lint (Usage: npx ZDLintingFramework lint --dir=path/to/file)\n' + ' -h, --help display help for command'); | ||
} |
@@ -5,3 +5,2 @@ const path = require("path"); | ||
* Configuration object for linting and reporting. | ||
* @typedef {Object} LintConfiguration | ||
* @property {string} ruleConfigurationPath - The path to the ESLint configuration file. | ||
@@ -24,3 +23,3 @@ * @property {boolean} impactBased - Indicates if the linting is impact-based. | ||
lintReportPath: path.resolve(process.cwd(), "lint-report", "lintReport.json"), | ||
sonar_hostURL: "https://serverlinter-np.zohodesk.csez.zohocorpin.com", | ||
sonar_hostURL: "https://client-linters.zohodesk.csez.zohocorpin.com", | ||
loginName: "developer", | ||
@@ -27,0 +26,0 @@ password: "developer", |
@@ -123,2 +123,14 @@ "use strict"; | ||
var Logger = exports.Logger = new LoggerImpl(); | ||
function reportSummaryConsole() { | ||
const { | ||
impactBased | ||
} = (0, _fileUtils.getLintConfiguration)(); | ||
const { | ||
reportStatus, | ||
pipelineStatus | ||
} = (0, _sonarReportSummary.getLintStatus)(impactBased); | ||
const typeOfConsole = reportStatus == false ? Logger.FAILURE_TYPE : Logger.SUCCESS_TYPE; | ||
const messageToConsole = reportStatus == false ? `pipeline is failed. because of rule violation` : null; | ||
messageToConsole && Logger.cliLog(typeOfConsole, messageToConsole); | ||
} | ||
function consoleViolatedRules() { | ||
@@ -136,14 +148,2 @@ const { | ||
}); | ||
} | ||
function reportSummaryConsole() { | ||
const { | ||
impactBased | ||
} = (0, _fileUtils.getLintConfiguration)(); | ||
const { | ||
reportStatus, | ||
pipelineStatus | ||
} = (0, _sonarReportSummary.getLintStatus)(impactBased); | ||
const typeOfConsole = reportStatus == false ? Logger.FAILURE_TYPE : Logger.SUCCESS_TYPE; | ||
const messageToConsole = reportStatus == false ? `pipeline is failed. because of rule violation` : null; | ||
messageToConsole && Logger.cliLog(typeOfConsole, messageToConsole); | ||
} |
@@ -55,3 +55,5 @@ "use strict"; | ||
function requestUtils(command) { | ||
return (0, _child_process.execSync)(command); | ||
return (0, _child_process.execSync)(command, { | ||
shell: true | ||
}); | ||
} | ||
@@ -80,6 +82,7 @@ | ||
command = `curl --header "PRIVATE-TOKEN:${(0, _hash.decrypt)(token, 12)}" "${endPoint}"`; | ||
(0, _fs.writeFileSync)(branchDiffPath, requestUtils(command)); | ||
} catch (err) { | ||
_logger.Logger.log(_logger.Logger.INFO_TYPE, `INFO : If you are using a VPN and encounter an SSL certification issue, ensure that the proxy is enabled for SSH and shell connections.`); | ||
_logger.Logger.log(_logger.Logger.FAILURE_TYPE, `make sure that you have access to this repository ${(0, _getSonarProperties.getRepoName)()}`); | ||
} | ||
(0, _fs.writeFileSync)(branchDiffPath, requestUtils(command)); | ||
} | ||
@@ -86,0 +89,0 @@ function getGitProjectId() { |
{ | ||
"name": "@zohodesk/codestandard-analytics", | ||
"version": "0.0.1-exp-15", | ||
"version": "0.0.1-exp-16", | ||
"description": "linting tool", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
729567
2060