Showing 11 of 29 total issues
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 a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function add(param, opts = {}) {
mkdirp.sync(serversDir);
const cwd = opts.dir || process.cwd();
const id = opts.name ? domainify(opts.name) : getId(cwd);
- 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 getKeydownListener
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
public getKeydownListener(store: Store) {
if (this.keydownListener == null) {
this.keydownListener = (event: KeyboardEvent) => {
const selectedMonitor = store.monitors.get(store.selectedMonitorId);
const isSelectedMonitorRunning = selectedMonitor?.status === RUNNING
- 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 add
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function add(param, opts = {}) {
mkdirp.sync(serversDir);
const cwd = opts.dir || process.cwd();
const id = opts.name ? domainify(opts.name) : getId(cwd);
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 render
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public render() {
const { store } = this.props
const monitor = store.monitors.get(store.selectedMonitorId)
return (
<div
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 getKeydownListener
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public getKeydownListener(store: Store) {
if (this.keydownListener == null) {
this.keydownListener = (event: KeyboardEvent) => {
const selectedMonitor = store.monitors.get(store.selectedMonitorId);
const isSelectedMonitorRunning = selectedMonitor?.status === RUNNING
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);
Function spawn
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
spawn(cmd, opts = {}) {
const cleanAndExit = (code = 0) => {
servers.rm(opts);
this._exit(code);
};