Showing 35 of 169 total issues
Function parseFlags
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parseFlags(
messageText: string,
flagsSrc: string
): TwitchFlagList {
const flags: TwitchFlagList = [];
Function splitIntoChunks
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function splitIntoChunks(
bits: string[],
separator = " ",
limit: number
): string[][] {
- 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 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor(message: IRCMessageData) {
super(message);
this.messageText = getParameter(this, 1);
Function getModsOrVips
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getModsOrVips(
conn: SingleConnection,
channelName: string,
config: GetUsersConfig
): Promise<string[]> {
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public constructor(ircMessage: IRCMessage) {
super(ircMessage);
const { isAction, message } = parseActionAndMessage(
requireParameter(this, 1)
Function parseEmotes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parseEmotes(
messageText: string,
emotesSrc: string
): TwitchEmoteList {
const emotes: TwitchEmoteList = [];
Function joinAll
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export async function joinAll(
conn: SingleConnection,
channelNames: string[]
): Promise<Record<string, Error | undefined>> {
// e.g. "JOIN #firstchannel,#secondchannel,#thirdchannel"
Function assertLink
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function assertLink(e: Error, chain: any[], depth = 0): void {
const [errorType, message, ...newChain] = chain;
const actualPrototype = Object.getPrototypeOf(e);
const expectedPrototype = errorType.prototype;
Function timeout
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
conn: SingleConnection,
channelName: string,
username: string,
length: number,
reason?: string
Avoid too many return
statements within this function. Open
return releaseFn;
Function acquire
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private async acquire(
channelName: string
): Promise<(() => void) | undefined> {
const { fastSpam, certain } = canSpamFast(
channelName,
- 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 onUserStateChange
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private onUserStateChange(channelName: string, newState: UserState): void {
const { fastSpam, certain } = canSpamFast(
channelName,
this.client.configuration.username,
newState
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
public constructor(message?: string, cause?: Error | undefined) {
let newMessage;
if (
message != null &&
cause != null &&
- 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 extractEventParams
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function extractEventParams(tags: IRCMessageTags): EventParams {
const params: EventParams = {};
// converts all msg-param-* tags into a new "params" object where keys are camelCased
// and boolean/integer tags are parsed (including a identically named "Raw" property).
- 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 applyToClient
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public applyToClient(client: ChatClient): void {
type GenericReplacementFn = (
oldFn: (channelName: string, message: string) => Promise<void>,
channelName: string,
message: string
- 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"