Showing 58 of 158 total issues
Function create
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
value: function create() {
var _this5 = this;
var opts = pick(this.opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
opts.xdomain = !!this.opts.xd;
Function _createForOfIteratorHelper
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _createForOfIteratorHelper(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (!it) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
Function decodeString
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
value: function decodeString(str) {
var i = 0; // look up type
var p = {
type: Number(str.charAt(0))
Function patchAdapter
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
export function patchAdapter(app /* : TemplatedApp */) {
Adapter.prototype.addAll = function (id, rooms) {
const isNew = !this.sids.has(id);
addAll.call(this, id, rooms);
const socket: Socket = this.nsp.sockets.get(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 Encoder
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Encoder = /*#__PURE__*/function () {
function Encoder() {
_classCallCheck(this, Encoder);
}
Function attachApp
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public attachApp(app /*: TemplatedApp */, opts: Partial<ServerOptions> = {}) {
// merge the options passed to the Socket.IO server
Object.assign(opts, this.opts);
// set engine.io path to `/socket.io`
opts.path = opts.path || this._path;
Function open
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
value: function open(fn) {
var _this2 = this;
if (~this._readyState.indexOf("open")) return this;
this.engine = new Socket$1(this.uri, this.opts);
Function exports
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
Function exports
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
Function url
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function url(uri) {
var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
var loc = arguments.length > 2 ? arguments[2] : undefined;
var obj = uri; // default to window.location
Function onpacket
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
value: function onpacket(packet) {
var sameNamespace = packet.nsp === this.nsp;
if (!sameNamespace) return;
switch (packet.type) {
Function Manager
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Manager(uri, opts) {
var _this;
_classCallCheck(this, Manager);
Function of
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
public of(
name: string | RegExp | ParentNspNameMatchFn,
fn?: (
socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>
) => void
- 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 registerValidSW
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
Function broadcast
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Adapter.prototype.broadcast = function (packet, opts) {
const useFastPublish = opts.rooms.size <= 1 && opts.except!.size === 0;
if (!useFastPublish) {
broadcast.call(this, packet, opts);
return;
Function close
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
value: function close() {
var _this6 = this;
var close = function close() {
_this6.onClose("forced close");
Function onTransportOpen
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var onTransportOpen = function onTransportOpen() {
if (failed) return;
transport.send([{
type: "ping",
data: "probe"
Function reconnect
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
value: function reconnect() {
var _this3 = this;
if (this._reconnecting || this.skipReconnect) return this;
var self = this;
Function parseBinary
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
parseBinary (obj) {
let view = new Uint8Array(obj);
let packetId = view[0];
try {
let packet = {
Function serveFile
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function serveFile(res /* : HttpResponse */, filepath: string) {
const { size } = statSync(filepath);
const readStream = createReadStream(filepath);
const destroyReadStream = () => !readStream.destroyed && readStream.destroy();