Showing 10 of 12 total issues
Function _update
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
_update () {
const deletedInterfaces = new Set(this._interfaces.keys())
for (const { interfaceId, addresses } of this._collectInterfaces()) {
deletedInterfaces.delete(interfaceId)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
File index.js
has 318 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict'
const os = require('os')
const objectHash = require('object-hash')
const deepEquals = require('fast-deep-equal')
const { hasListener } = require('has-listener')
Function _process
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
_process (change) {
const { type } = change
let networkInterface, addresses
switch (type) {
case ChangeType.updateInterface:
Function _update
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
_update () {
const deletedInterfaces = new Set(this._interfaces.keys())
for (const { interfaceId, addresses } of this._collectInterfaces()) {
deletedInterfaces.delete(interfaceId)
Function _process
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_process (change) {
const { type } = change
let networkInterface, addresses
switch (type) {
case ChangeType.updateInterface:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function preferInternalForLocal
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
preferInternalForLocal (family, address) {
const local = this.isLocalAddress(family, address)
if (!local) {
return address
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
if (parts[5]) return NicType.bluetooth
Avoid too many return
statements within this function. Open
return null
Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = cb => {
wmic.get_list('nic', (err, nics) => {
if (err) return cb(err, undefined)
cb(null, nics
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = cb => {
bgbash.exec(cmd, (err, stdout) => {
if (err) return cb(err, undefined)
let str = stdout.toString()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"