| # Contribution guidelines | ||
| * Install/update the dependencies. | ||
| `npm install` | ||
| * Make sure the code lints. | ||
| `npm run lint` | ||
| * Make sure all of the tests pass. | ||
| `npm test` | ||
| * New code must have new unit tests. | ||
| * New features/metrics | ||
| or changes to existing features/metrics | ||
| must be documented in the [readme] file. | ||
| * Adhere to the coding conventions | ||
| that are used elsewhere in the codebase. | ||
| * Add yourself to the [authors] file. | ||
| * Feel free to [open an issue][newissue] first, | ||
| if the change is one that you think | ||
| needs some discussion. | ||
| I'm not precious | ||
| about the [issue list][issues]. | ||
| [readme]: https://github.com/philbooth/escomplex/blob/master/README.md | ||
| [authors]: https://github.com/philbooth/escomplex/blob/master/AUTHORS | ||
| [newissue]: https://github.com/philbooth/escomplex/issues/new | ||
| [issues]: https://github.com/philbooth/escomplex/issues | ||
+1
-1
| { | ||
| "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", |
+106
-13
@@ -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 | ||
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
168043
1.52%15
7.14%456
25.62%