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

escomplex

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

escomplex - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

CONTRIBUTING.md

2

package.json
{
"name": "escomplex",
"version": "0.2.0",
"version": "0.2.1",
"description": "Software complexity analysis of JavaScript-family abstract syntax trees.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/philbooth/escomplex",

@@ -15,2 +15,9 @@ # escomplex

* [Usage](#usage)
* [Arguments](#arguments)
* [ast](#ast)
* [walker](#walker)
* [options](#options)
* [Result](#result)
* [For a single module](#for-a-single-module)
* [For multiple modules](#for-multiple-modules)
* [Related projects](#related-projects)

@@ -120,3 +127,4 @@ * [Development](#development)

which can help to identify areas of code
that warrant closer inspection.
that warrant closer inspection
by a human being.

@@ -168,2 +176,6 @@ ## Links to research

### Arguments
#### ast
The first argument, `ast`,

@@ -176,5 +188,4 @@ must be either

an extra property, `path`,
that is either a relative
or full path to equivalent module
on disk.
that is either a relative or full path
to the equivalent module on disk.
As well as identifying

@@ -185,5 +196,9 @@ each of the result objects,

#### walker
The second argument, `walker`,
must be a [syntax tree walker](#syntax-tree-walkers).
#### options
The third argument, `options`,

@@ -215,7 +230,63 @@ is an optional object

### Result
#### For a single module
If a single abstract syntax tree object
is passed in the `ast` argument,
the result will be a report object
containing the following properties:
that looks like the following:
```javascript
{
maintainability: 171,
dependencies: [],
aggregate: {
sloc: {
logical: 0,
physical: 0
},
params: 0,
cyclomatic: 1,
cyclomaticDensity: 1,
halstead: {
vocabulary: 0,
difficulty: 0,
volume: 0,
effort: 0,
bugs: 0,
time: 0
}
},
functions: [
{
name: '',
line: 0,
sloc: {
logical: 0,
physical: 0
},
params: 0,
cyclomatic: 1,
cyclomaticDensity: 1,
halstead: {
vocabulary: 0,
difficulty: 0,
volume: 0,
effort: 0,
bugs: 0,
time: 0
}
},
...
]
}
```
The meaning of those values, briefly,
is as follows
(see [metrics](#metrics)
for more information
on each one):
* `report.maintainability`:

@@ -286,10 +357,33 @@ The maintainability index for the module.

#### For multiple modules
If an array of syntax trees
is passed in the `ast` argument,
the result will be an object
containing the following properties:
that looks like the following:
```javascript
{
reports: [
...
],
adjacencyMatrix: [
[ 0 ]
],
firstOrderDensity: 0,
visibilityMatrix: [
[ 0 ]
],
changeCost: 100,
coreSize: 100
}
```
Those properties
are defined as follows:
* `result.reports`:
An array of report objects,
each one in the same format described above
each one in the same format
[described above](#for-a-single-module)
but with an extra property `path`

@@ -335,5 +429,8 @@ that matches the `path` property

Refer to the [contrubution guidelines][contributions]
before submitting a pull request.
Source code is in `/src`.
Unit tests are in `/test`.
You can run them with `npm test`.
You can run the tests with `npm test`.
You can run the linter with `npm run lint`.

@@ -365,7 +462,3 @@ Make sure you've installed

[license]: https://github.com/philbooth/escomplex/blob/master/COPYING
[node]: http://nodejs.org/
[npm]: https://npmjs.org/
[jshint]: https://github.com/jshint/node-jshint
[mocha]: http://visionmedia.github.com/mocha
[chai]: http://chaijs.com/
[contributions]: https://github.com/philbooth/escomplex/blob/master/CONTRIBUTING.md
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