Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
grunt-escomplex
Advanced tools
Code complexity module Grunt using escomplex.
Not usable yet...
This plugin requires Grunt.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-escomplex --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-escomplex');
In your project's Gruntfile, add a section named escomplex
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
escomplex: {
options: {
complexity: {
logicalor: true,
switchcase: true,
forin: false,
trycatch: false,
newmi: true
},
format: {
showFunctionDetails: false
}
},
src: [
'specificFile.js',
'src/**/*.js'
]
},
})
options.complexity
is an optional object containing properties that modify some of the complexity calculations:
options.complexity.logicalor
:Boolean indicating whether operator ||
should be considered a source of cyclomatic complexity,
defaults to true
.
options.complexity.switchcase
:Boolean indicating whether switch
statements
should be considered a source of cyclomatic complexity,
defaults to true
.
options.complexity.forin
:Boolean indicating whether for
...in
loops
should be considered a source of cyclomatic complexity,
defaults to false
.
options.complexity.trycatch
:Boolean indicating whether catch
clauses
should be considered a source of cyclomatic complexity,
defaults to false
.
options.complexity.newmi
:Boolean indicating whether the maintainability
index should be rebased on a scale from 0 to 100,
defaults to false
.
options.format
is an optional object containing properties that modify some of the output format:
options.format.showFunctionDetails
: Boolean indicating whether complexity details should be displayed in output resultIn this example, the default options are used to do something with whatever. So if the testing
file has the content Testing
and the 123
file had the content 1 2 3
, the generated result would be Testing, 1 2 3.
grunt.initConfig({
escomplex: {
options: {
complexity: {
logicalor: true,
switchcase: true,
forin: false,
trycatch: false,
newmi: true
},
format: {
showFunctionDetails: false
}
},
src: [
'specificFile.js',
'src/**/*.js'
]
},
})
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
(Nothing yet)
Copyright (c) 2015 Ludovic LEFEVRE. Licensed under the MIT license.
FAQs
Code complexity module for Grunt using escomplex.
The npm package grunt-escomplex receives a total of 2 weekly downloads. As such, grunt-escomplex popularity was classified as not popular.
We found that grunt-escomplex demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.