File group.js
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
const fs = require("fs");
const path = require("path");
const EventEmitter = require("events");
const url = require("url");
const once = require("once");
Function add
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
add(id, conf) {
if (conf.target) {
log(`Add target ${id}`);
this._list[id] = conf;
this._change();
Function handleConnect
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
handleConnect(req, socket, head) {
if (req.headers.host) {
const { host } = req.headers;
const { id, hostname, port } = this.parseHost(host);
- 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 handleUpgrade
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
handleUpgrade(req, socket, head) {
if (req.headers.host) {
const { host } = req.headers;
const { id, port } = this.parseHost(host);
const item = this.find(id);
- 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 handleConnect
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleConnect(req, socket, head) {
if (req.headers.host) {
const { host } = req.headers;
const { id, hostname, port } = this.parseHost(host);
Replace ········
with ······
Open
isWildcardMatch: matcher.isMatch(str, `*.${h}`)
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
}));
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Delete ··
Open
isStrictMatch: matcher.isMatch(str, h),
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ⏎······.concat(data)⏎······.split("\n")⏎······.slice(-100)⏎······
with .concat(data).split("\n").slice(-100)
Open
mon.tail = mon.tail
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ········
with ······
Open
host: h,
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/
Replace ⏎······.sort()⏎······.reverse()⏎······
with .sort().reverse()
Open
const arr = Object.keys(this._list)
- Read upRead up
- Exclude checks
For more information visit Source: http://eslint.org/docs/rules/