Showing 10 of 12 total issues
Function ApiSocket
has 327 lines of code (exceeds 25 allowed). Consider refactoring. Open
const ApiSocket = (userOptions: Options.APISocketOptions, WebSocketImpl: WebSocket) => {
const options: FullOptions = {
...defaultOptions,
...userOptions
};
Function ApiSocket
has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring. Open
const ApiSocket = (userOptions: Options.APISocketOptions, WebSocketImpl: WebSocket) => {
const options: FullOptions = {
...defaultOptions,
...userOptions
};
- 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 SocketSubscriptionHandler
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
const SocketSubscriptionHandler = (
socket: () => Socket.APISocket,
logger: Logger,
{ ignoredListenerEvents = [] }: Options.SocketSubscriptionOptions
) => {
- 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 SocketRequestHandler
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
const SocketRequestHandler = (
socket: () => Socket.APISocket,
logger: Logger,
{ requestTimeout = 30, ignoredRequestPaths }: Options.SocketRequestOptions
) => {
- 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 SocketBase.ts
has 351 lines of code (exceeds 250 allowed). Consider refactoring. Open
import ApiConstants from './ApiConstants.js';
import SocketLogger from './SocketLogger.js';
import SocketSubscriptionHandler from './SocketSubscriptionHandler.js';
import SocketRequestHandler from './SocketRequestHandler.js';
Function addContextMenuItems
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
export const addContextMenuItems = async <IdT, EntityIdT extends EntityId | undefined = undefined>(
socket: APISocket,
menuItems: ContextMenuItem<IdT, EntityIdT>[],
menuTypeId: string,
menu: ContextMenu
- 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 addContextMenuItems
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const addContextMenuItems = async <IdT, EntityIdT extends EntityId | undefined = undefined>(
socket: APISocket,
menuItems: ContextMenuItem<IdT, EntityIdT>[],
menuTypeId: string,
menu: ContextMenu
Function sendRequest
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const sendRequest = <DataT extends object | undefined>(
method: string, path: string, data?: DataT, authenticating: boolean = false
) => {
// Pre-checks
if (!authenticating && !socket().isConnected()) {
Function handleMessage
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleMessage(messageObj: APIInternal.RequestSuccessResponse | APIInternal.RequestErrorResponse) {
const id = messageObj.callback_id;
if (!callbacks.hasOwnProperty(id)) {
logger.warn('No pending request for an API response', id, messageObj);
return;
Function parseCallbackData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const parseCallbackData = async <IdT, EntityIdT extends EntityId | undefined = undefined>(
item: ContextMenuItem<IdT, EntityIdT>,
data: MenuItemListHookData<IdT, EntityIdT>
): Promise<ResponseMenuItemCallbackFields> => {
const { selected_ids, entity_id, permissions, supports } = data;
- 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"