Showing 29 of 47 total issues
File Connection.ts
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { CallOptions, ECallKillMode } from '../types/messages/CallMessage';
import { HelloMessageDetails, WampHelloMessage } from '../types/messages/HelloMessage';
import { EWampMessageID, WampDict, WampID, WampList, WampURI } from '../types/messages/MessageTypes';
import { PublishOptions } from '../types/messages/PublishMessage';
Function processSessionMessage
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
private processSessionMessage(msg: WampMessage): void {
if (!this.transport) {
return;
}
this.state.update([EMessageDirection.RECEIVED, msg[0]]);
Function onMessage
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
protected onMessage(msg: WampMessage): boolean {
let [handled, success, error] = this.regs.Handle(msg);
if (handled) {
if (!success) {
this.violator(error);
- 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 Callee.ts
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Logger } from '../logging/Logger';
import { CallHandler, CallResult, IRegistration, LogLevel } from '../types/Connection';
import { InvocationDetails, WampYieldMessage } from '../types/messages/CallMessage';
import { EWampMessageID, WampDict, WampID, WampList, WampURI } from '../types/messages/MessageTypes';
Function onMessage
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected onMessage(msg: WampMessage): boolean {
let [handled, success, error] = this.regs.Handle(msg);
if (handled) {
if (!success) {
this.violator(error);
Function Open
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Open(endpoint: string, cb: (ev: TransportEvent) => void) {
if (!!this.webSocket) {
cb({
type: ETransportEventType.ERROR,
error: 'Transport already opened!',
Function main
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
const main = async () => {
await connection.Open();
const sub = await connection.Subscribe('foo.baz', (args, kwargs, details) => {
console.log('EVENT:', args, kwargs, details.publisher);
}, {});
Function onMessage
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected onMessage(msg: WampMessage): boolean {
if (msg[0] === EWampMessageID.ERROR && msg[1] === EWampMessageID.CALL) {
const callid = msg[2];
this.logger.log(LogLevel.WARNING, `ID: ${callid}, Received Error for Call: ${msg[4]}`);
Function onMessage
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected onMessage(msg: WampMessage): boolean {
if (msg[0] === EWampMessageID.ERROR && msg[1] === EWampMessageID.CALL) {
const callid = msg[2];
this.logger.log(LogLevel.WARNING, `ID: ${callid}, Received Error for Call: ${msg[4]}`);
- 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 constructor
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor() {
const transitions = new Map<EConnectionState, StateTransitionFunction<EConnectionState, TConnectionArgs>>();
transitions.set(EConnectionState.CLOSED, ([msgDir, msgId]) => {
if (msgId === EWampMessageID.HELLO && msgDir === EMessageDirection.SENT) {
return EConnectionState.ETABLISHING;
Function onHandlerResult
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private async onHandlerResult(res: CallResult<WampList, WampDict>): Promise<void> {
if (!res.nextResult || this.progress) {
const yieldmsg: WampYieldMessage = [
EWampMessageID.YIELD,
this.callid,
- 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 handleTransportEvent
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
private handleTransportEvent(event: TransportEvent): void {
switch (event.type) {
case ETransportEventType.OPEN: {
this.sendHello();
break;
- 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 handleTransportEvent
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private handleTransportEvent(event: TransportEvent): void {
switch (event.type) {
case ETransportEventType.OPEN: {
this.sendHello();
break;
Function Handle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public Handle(msg: WampMessage): [boolean, boolean, string] {
if (this.closed) {
return [false, true, ''];
}
if (msg[0] === this.successMsg) {
- 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 Publish
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async Publish<
A extends WampList,
K extends WampDict
>(topic: WampURI, args?: A, kwArgs?: K, options?: PublishOptions): Promise<IPublication> {
if (this.closed) {
Function Subscribe
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async Subscribe<
A extends WampList,
K extends WampDict
>(topic: WampURI, handler: EventHandler<A, K>, options?: SubscribeOptions): Promise<ISubscription> {
if (this.closed) {
Function onMessage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected onMessage(msg: WampMessage): boolean {
let [handled, success, error] = this.subs.Handle(msg);
if (handled) {
if (!success) {
this.violator(error);
Function Call
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Call<
A extends WampList,
K extends WampDict,
RA extends WampList,
RK extends WampDict
Function onMessage
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected onMessage(msg: WampMessage): boolean {
let [handled, success, error] = this.subs.Handle(msg);
if (handled) {
if (!success) {
this.violator(error);
- 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 onHandlerResult
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async onHandlerResult(res: CallResult<WampList, WampDict>): Promise<void> {
if (!res.nextResult || this.progress) {
const yieldmsg: WampYieldMessage = [
EWampMessageID.YIELD,
this.callid,