Showing 48 of 75 total issues
Function constructor
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
wc: WebChannel,
wsOrDc: WebSocket | RTCDataChannel,
type: number,
id: number,
Function constructor
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
id: number,
pc: RTCPeerConnection,
send: (msg: proto.IMessage) => void,
remotes: Map<number, Remote>,
Function initHandlers
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
private initHandlers() {
// Configure handlers
this.wsOrDc.onmessage = ({ data }: { data: ArrayBuffer }) => {
try {
const msg = Message.decode(new Uint8Array(data))
Function init
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
private init(): void {
this.webSocketServer = new Server({
perMessageDeflate: this.perMessageDeflate,
verifyClient: (info: any) => this.validateURLQuery(info),
server: this.server,
Function create
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
create(
id: number,
connectionTimeout: number,
responseTimeout: number,
onConnectionTimeoutCallback: () => void
Function subscribeToSignalingState
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Confirmed
private subscribeToSignalingState() {
this.signaling.onState.subscribe((state: SignalingState) => {
log.signalingState(SignalingState[state], this.myId)
this.onSignalingStateChange(state)
switch (state) {
Function useAllStreams
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected useAllStreams(
wc: IStream<OutWcMessage, InWcMsg> & WebChannel,
sig: IStream<OutSigMsg, InSigMsg>
): IAllStreams<OutMsg, InMsg> {
const wcStream = this.useWebChannelStream(wc)
Function promise
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
connection.promise = new Promise((resolveResponse, rejectResponse) => {
const responseTimer = setTimeout(
() => connection.reject(new Error(ConnectionError.RESPONSE_TIMEOUT)),
responseTimeout
)
Function constructor
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(options: IWebChannelOptions) {
const { topology, autoRejoin, rtcConfiguration, signalingServer } = {
...webChannelDefaultOptions,
...options,
}
Function constructor
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
constructor(
id: number,
pc: RTCPeerConnection,
send: (msg: proto.IMessage) => void,
remotes: Map<number, Remote>,
- 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 handleInitMessage
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private handleInitMessage(msg: proto.Message) {
switch (msg.type) {
case 'initPing': {
log.channel(`${this.wc.myId} received InitPing`)
const { topology, wcId, senderId, members, key } = msg.initPing as proto.Data
Function proceedNegotiation
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async proceedNegotiation(
streamId: number,
initiator: proto.Info,
passive: proto.Info,
amIInitiator: boolean
Function readURLQuery
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
private readURLQuery(
url: string
): {
type: number
wcId: number
Function connect
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
connect(key: string): void {
if (isWebSocketSupported()) {
this.setState(SignalingState.CONNECTING)
this.ws = new env.WebSocket(this.fullUrl(key))
this.ws.binaryType = 'arraybuffer'
Function connectToMembers
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private connectToMembers(ids: number[], adjacentId: number): Promise<void | void[]> {
const missingIds = ids.filter((id) => !this.adjacentMembers.has(id) && id !== this.wc.myId)
if (missingIds.length !== 0) {
log.topology(`TRY TO CONNECT to members`, missingIds)
const attempts: Array<Promise<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 constructor
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
constructor(
wc: WebChannel,
wsOrDc: WebSocket | RTCDataChannel,
type: number,
id: number,
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
constructor(wc: WebChannel) {
super(wc, FullMesh.SERVICE_ID, proto.Message)
this.adjacentMembers = new Map()
this.distantMembers = new Map()
this.antecedentId = 0
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
constructor(options: BotOptions) {
botServer = new BotServer(options)
/**
* Read-only NodeJS http server instance.
- 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 rejoin
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private rejoin() {
this.setState(WebChannelState.JOINING)
if (!isVisible() || !isOnline()) {
this.internalLeave()
} else {
Function handleMessage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private handleMessage(bytes: ArrayBuffer) {
try {
const msg = proto.Message.decode(new Uint8Array(bytes))
switch (msg.type) {
case 'heartbeat':