Showing 73 of 75 total issues
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':
Function proceedNegotiation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private async proceedNegotiation(
streamId: number,
initiator: proto.Info,
passive: proto.Info,
amIInitiator: boolean
- 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 connect
has a Cognitive Complexity of 9 (exceeds 5 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'
- 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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private rejoin() {
this.setState(WebChannelState.JOINING)
if (!isVisible() || !isOnline()) {
this.internalLeave()
} else {
- 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 onBrowserBack
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private onBrowserBack() {
if (isVisible() && isOnline()) {
log.webgroup('onBrowserBack', { isVisible: isVisible(), isOnline: isOnline() })
this.rejoinEnabled = this.autoRejoin
if (this.rejoinEnabled) {
- 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 decodeUserMessage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
decodeUserMessage(bytes: Uint8Array, senderId: number): UserDataType | undefined {
try {
const { length, type, contentType, full, chunk } = super.decode(bytes) as {
length: number
type: proto.Message.Type
- 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 readURLQuery
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private readURLQuery(
url: string
): {
type: number
wcId: 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 startHeartbeatInterval
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private startHeartbeatInterval() {
this.heartbeatInterval = setInterval(() => {
this.adjacentMembers.forEach((ch) => ch.sendHeartbeat())
this.distantMembers.forEach((peer, id) => {
peer.missedHeartbeat++
- 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 handleMessage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
handleMessage(msg: proto.Message) {
if (msg.type) {
switch (msg.type) {
case 'offer':
log.webrtc('REMOTE OFFER', { offer: msg.offer })
- 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
TODO found Open
// TODO: add wrtc for WebRTC/RTCDataChannel support in NodeJS
- Exclude checks
TODO found Open
// TODO: implement when there are more than one topology implementation
- Exclude checks
TODO found Open
// TODO: this is a rare case, when the joining peer id equals to the
- Exclude checks