@sap/di.code-validation.core
Advanced tools
Comparing version 1.0.1 to 1.0.3
@@ -1,1 +0,1 @@ | ||
{"bin":{"validationframework":"bin/run.js"},"bugs":{"url":"https://github.com/DevX/CodeValidation/issues"},"config":{"ghooks":{"pre-commit":"mocha test"}},"dependencies":{"optionator":"0.8.1"},"description":"Code validation","devDependencies":{"amdefine":"1.0.0","bump":"0.2.5","chai":"3.5.0","chai-string":"^1.3.0","eslint":"^3.0.1","filter-node-package":"^2.0.2","ghooks":"^1.3.2","grunt":"^1.0.1","grunt-bump":"0.7.0","grunt-contrib-clean":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-istanbul-coverage":"^0.1.4","grunt-mocha-istanbul":"^5.0.2","grunt-mocha-test":"^0.13.2","gruntify-eslint":"^2.0.0","istanbul":"^0.4.5","mocha":"^3.1.2","mocha-junit-reporter":"^1.12.1","sinon":"1.17.2"},"engines":{"npm":">=3.0.0"},"homepage":"https://github.com/DevX/CodeValidation","main":"./src/api.js","maintainers":[{"name":"https-support.sap.com","email":"do-not-reply@sap.com"}],"name":"@sap/di.code-validation.core","optionalDependencies":{},"readme":"[![Build Status](https://mo-373599990.mo.sap.corp:8443/job/CodeValidation_ci_multi_job/badge/icon)](https://mo-373599990.mo.sap.corp:8443/job/CodeValidation_ci_multi_job)\n\n\n# di.code-validation.core \ncode validation controller for DI.\nreturning issues in code according to validators configured\n\n### install\n\nnpm install di.code-validation.core --save-dev\n\n### CodeValidation API\n\n```javascript\nexecuteForProject(projectPath, workspaceRootName, configuration, callbackFunction)\n```\n\n_basePath_ - full path for the validated folder location\n\n_options_ - an object to set additional options for execution and return values processing.\n\n_options.pathPrefix_ - validation issues paths are relative to the project path. _pathPrefix enable to set constant prefix to the returned path.\n\n_configuration_ - configuration of the validators to execute. object of type _ValidationConfig_\n\n_callbackFunction_ - callback of results. (TBD: add also failure for callback?)\n\n_ValidationConfig_ structure:\n```javascript\n {\n \"validators\" : {\n \"validator1\" : {\n \"extensions\" : ['.js', '.xsjs'],\n \"filters\": {\n \"levels\" :[\"error\", \"warning\", \"info\"]\n }\n },\n \"validator2\" : {\n \"extensions\" : ['.new'],\n \"filters\": {\n \"levels\" :[\"error\"]\n }\n }\n ....\n }\n }\n```\n\n_result_ structure:\n```javascript\n{\n \"validator_id\" : {\n \"issues\" : {\n \"relative_file_path\" : [\n {\n \"category\" : \"Possible Error\",\n \"checker\" : \"validator checker name\",\n \"column\" : 1,\n \"line\" : 14,\n \"message\" : \"some message\",\n \"path\" : \"relative_file_path\",\n \"ruleId\" : \"optional name of rule\",\n \"severity\" : \"error\"\n }\n ....\n ]\n }\n ....\n }\n}\n```\n\n#### validator API\n\nEach validator should implement following API:\n\n```javascript\n validateFiles(validationMetadata, fileResources)\n```\n\n _validationMetadata_ - contains following methods:\n \n getRootPath() - workspaceRootName\n \n getLevels() - array of levels of issues to return\n \n _fileResources_ - array of files to validate (TBD: enable validation by extension of regular expression)\n \n getPath() - returns the file full path\n \n getText() - returns the text in the file\n\n#### run validation from command line\n\nnode di.code-validation.core\\bin\\run.js \"project file location\" \"client workspace root path\"\n\n--c \"configuration file location\" - file with validation configuration. if not supplied defaults used.\n\nExample for configuration file:\n\n```javascript\n var configParam = { \n \"validators\" : { \n \"di.code-validation.js\" : { \n \"extensions\" : [\".js\", \".xsjs\"], \n \"filters\": { \n \"levels\" :[\"error\", \"warning\", \"info\"] \n } \n } \n } \n };\n module.exports = configParam;\n```\n\n--l \"log file\" - location of the outpul log file. default is the execution directory\n\n### default configuration:\n\n```javascript\n validators: {\n \"di.code-validation.js\": {\n extensions: [\".js\", \".xsjs\"]\n },\n \"di.code-validation.xml\": {\n extensions: [ \".xml\"]\n }\n }\n```\n","readmeFilename":"README.md","repository":{"type":"git","url":"git+https://github.com/DevX/CodeValidation.git"},"scripts":{"prepareRelease":"clean-packages --warn-only && npm prune --production","test":"mocha"},"version":"1.0.1","license":"SEE LICENSE IN developer-license-3.1.txt"} | ||
{"bin":{"validationframework":"bin/run.js"},"bugs":{"url":"https://github.com/DevX/CodeValidation/issues"},"config":{"ghooks":{"pre-commit":"mocha test"}},"dependencies":{"optionator":"0.8.1"},"description":"Code validation","devDependencies":{"amdefine":"1.0.0","bump":"0.2.5","chai":"3.5.0","chai-string":"^1.3.0","debug":"^2.6.3","eslint":"^3.0.1","filter-node-package":"^2.0.2","ghooks":"^1.3.2","grunt":"^1.0.1","grunt-bump":"0.7.0","grunt-contrib-clean":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-istanbul-coverage":"^0.1.4","grunt-mocha-istanbul":"^5.0.2","grunt-mocha-test":"^0.13.2","gruntify-eslint":"^2.0.0","istanbul":"^0.4.5","mocha":"^3.1.2","mocha-junit-reporter":"^1.12.1","sinon":"1.17.2","whitesource":"0.3.13"},"engines":{"npm":">=3.0.0"},"homepage":"https://github.com/DevX/CodeValidation","main":"./src/api.js","maintainers":[{"name":"https-support.sap.com","email":"do-not-reply@sap.com"}],"name":"@sap/di.code-validation.core","optionalDependencies":{},"readme":"# di.code-validation.core \ncode validation controller for DI.\nreturning issues in code according to validators configured\n\n### install\n\nnpm install di.code-validation.core --save-dev\n\n### CodeValidation API\n\n```javascript\nexecuteForProject(projectPath, workspaceRootName, configuration, callbackFunction)\n```\n\n_basePath_ - full path for the validated folder location\n\n_options_ - an object to set additional options for execution and return values processing.\n\n_options.pathPrefix_ - validation issues paths are relative to the project path. _pathPrefix enable to set constant prefix to the returned path.\n\n_configuration_ - configuration of the validators to execute. object of type _ValidationConfig_\n\n_callbackFunction_ - callback of results. (TBD: add also failure for callback?)\n\n_ValidationConfig_ structure:\n```javascript\n {\n \"validators\" : {\n \"validator1\" : {\n \"extensions\" : ['.js', '.xsjs'],\n \"filters\": {\n \"levels\" :[\"error\", \"warning\", \"info\"]\n }\n },\n \"validator2\" : {\n \"extensions\" : ['.new'],\n \"filters\": {\n \"levels\" :[\"error\"]\n }\n }\n ....\n }\n }\n```\n\n_result_ structure:\n```javascript\n{\n \"validator_id\" : {\n \"issues\" : {\n \"relative_file_path\" : [\n {\n \"category\" : \"Possible Error\",\n \"checker\" : \"validator checker name\",\n \"column\" : 1,\n \"line\" : 14,\n \"message\" : \"some message\",\n \"path\" : \"relative_file_path\",\n \"ruleId\" : \"optional name of rule\",\n \"severity\" : \"error\"\n }\n ....\n ]\n }\n ....\n }\n}\n```\n\n#### validator API\n\nEach validator should implement following API:\n\n```javascript\n validateFiles(validationMetadata, fileResources)\n```\n\n _validationMetadata_ - contains following methods:\n \n getRootPath() - workspaceRootName\n \n getLevels() - array of levels of issues to return\n \n _fileResources_ - array of files to validate (TBD: enable validation by extension of regular expression)\n \n getPath() - returns the file full path\n \n getText() - returns the text in the file\n\n#### run validation from command line\n\nnode di.code-validation.core\\bin\\run.js \"project file location\" \"client workspace root path\"\n\n--c \"configuration file location\" - file with validation configuration. if not supplied defaults used.\n\nExample for configuration file:\n\n```javascript\n var configParam = { \n \"validators\" : { \n \"di.code-validation.js\" : { \n \"extensions\" : [\".js\", \".xsjs\"], \n \"filters\": { \n \"levels\" :[\"error\", \"warning\", \"info\"] \n } \n } \n } \n };\n module.exports = configParam;\n```\n\n--l \"log file\" - location of the outpul log file. default is the execution directory\n\n### default configuration:\n\n```javascript\n validators: {\n \"di.code-validation.js\": {\n extensions: [\".js\", \".xsjs\"]\n },\n \"di.code-validation.xml\": {\n extensions: [ \".xml\"]\n }\n }\n```\n","readmeFilename":"README.md","repository":{"type":"git","url":"git+https://github.com/DevX/CodeValidation.git"},"scripts":{"prepareRelease":"clean-packages --warn-only && npm prune --production","test":"mocha"},"version":"1.0.3","license":"SEE LICENSE IN developer-license-3.1.txt"} |
@@ -1,4 +0,1 @@ | ||
[![Build Status](https://mo-373599990.mo.sap.corp:8443/job/CodeValidation_ci_multi_job/badge/icon)](https://mo-373599990.mo.sap.corp:8443/job/CodeValidation_ci_multi_job) | ||
# di.code-validation.core | ||
@@ -5,0 +2,0 @@ code validation controller for DI. |
@@ -25,2 +25,8 @@ /** | ||
FileResource.prototype.getSize = function() { | ||
var stats = fs.statSync(this.filePath) | ||
var fileSizeInBytes = stats.size | ||
return fileSizeInBytes; | ||
}; | ||
module.exports = FileResource; |
var path = require("path"); | ||
var util = require("util"); | ||
var os = require("os"); | ||
var debug = require('debug')('code-validation') | ||
var name = 'validation-process' | ||
/** | ||
@@ -35,3 +38,6 @@ * Created by I028014 on 31/05/2016. | ||
var validationMetadata = new ValidationMetadata(basePath, validationConfig.getLevels(providerName)); | ||
fileUtils.listFilteredFiles(validationMetadata.getRootPath(), {extensions: extensions, ignoredPaths : validationConfig.getIgnoredPaths()}, function (files) { | ||
fileUtils.listFilteredFiles(validationMetadata.getRootPath(), { | ||
extensions: extensions, | ||
ignoredPaths: validationConfig.getIgnoredPaths() | ||
}, function (files) { | ||
var fileResources = []; | ||
@@ -42,3 +48,12 @@ files.forEach(function (filePath) { | ||
}); | ||
debug('start: %s', providerName); | ||
var results = provider.validateFiles(validationMetadata, fileResources, {}); | ||
if (process.env.DEBUG === 'code-validation') { | ||
var totalSize = 0; | ||
fileResources.forEach(function (file) { | ||
var size = file.getSize(); | ||
totalSize += size; | ||
}); | ||
debug('finish to run: %s with %d issues for:%d files with total size of: %d (Bytes)', providerName, results.issues.length, fileResources.length, totalSize); | ||
} | ||
done(results); | ||
@@ -45,0 +60,0 @@ }); |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
218599
51
1232
21
126
10