New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

complan

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

complan - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

2

index.js

@@ -33,3 +33,3 @@ #!/usr/bin/env node

}).then(function (path) {
let complexityReport = generateReport(path, reportsPath)
let complexityReport = generateReport(path, reportsPath, gitUrl)
Debug(JSON.stringify(complexityReport, null, 3))

@@ -36,0 +36,0 @@ }).catch(function (err) {

'use strict'
const Fse = require('fs-extra')
const Path = require('path')
const Util = require('./util')
module.exports = function (path, reportsPath) {
module.exports = function (path, reportsPath, gitUrl) {
var complexityReport = {}

@@ -11,14 +12,15 @@ complexityReport.report = []

var rep = {}
rep.path = report.path
rep.cyclomatic = report.cyclomatic
rep.loc = report.loc
rep.maintainability = report.maintainability
rep.path = Util.getGitPath(gitUrl, report.path)
rep.cyclomatic = +(report.cyclomatic.toFixed(2))
rep.loc = +(report.loc.toFixed(2))
rep.maintainability = +(report.maintainability.toFixed(2))
complexityReport.report.push(rep)
})
complexityReport.cyclomatic = jsonReport.cyclomatic
complexityReport.loc = jsonReport.loc
complexityReport.maintainability = jsonReport.maintainability
complexityReport.cyclomatic = +(jsonReport.cyclomatic.toFixed(2))
complexityReport.loc = +(jsonReport.loc.toFixed(2))
complexityReport.maintainability = +(jsonReport.maintainability.toFixed(2))
Fse.writeFileSync(Path.join(reportsPath, 'complexity-report.json'), JSON.stringify(complexityReport, null, 3))
console.log('Successfully wrote report at: ' + Path.join(reportsPath, 'complexity-report.json'))
Fse.removeSync(Path.join(process.cwd(), 'cc.json'))
return complexityReport
}

@@ -27,3 +27,11 @@ 'use strict'

}
},
getGitPath: function (gitUrl, localPath) {
const pathToReplace = Path.join(process.cwd(), 'clonedrepos', GitUrlParse(gitUrl).pathname)
const fileName = localPath.replace(pathToReplace, '')
const git = GitUrlParse(gitUrl)
const hash = (git.hash === '' ? 'master' : git.hash)
return git.protocol + '://' + git.resource + '/' + git.pathname + '/blob/' + hash + fileName
}
}
{
"name": "complan",
"version": "1.0.5",
"version": "1.0.6",
"description": "COMPLexity ANalyzer Tool For Javascript",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -53,5 +53,5 @@ # Complan

-g, --gitUrl <path> specify the http url or the git url of the repository
```
## License
[MIT]
[MIT]

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc