Showing 65 of 129 total issues
Function toBlob
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export async function toBlob(data: BlobResolvable): Promise<Blob> {
if (data instanceof Blob) {
return data;
}
if (isArrayBufferable(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"
Further reading
Function onPacket
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private onPacket(packet: GatewayReceivePayload) {
if (packet.s) {
this.seq = packet.s;
}
- 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 start
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async start() {
const spinner = new Spinner({
text: this.firstRun ? 'Initializing development mode...' : 'Reloading...',
});
this.firstRun = false;
- 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 or
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function or<A, B>(a: BitSerializer<A>, b: BitSerializer<B>) {
return new BitSerializer({
read(buffer) {
return buffer.read() ? a.read(buffer) : b.read(buffer);
},
- 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 mergeCommands
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function mergeCommands(_list: ApplicationCommandResolvable[]) {
/** I am sorry... */
const list: any[] = _list;
const groups = list.filter(x => 'isSlashCommandGroup' in x && !x.name.includes(' '));
- 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 pluginFeatures
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function pluginFeatures({ config, featureScan }: FeaturesPluginOptions): Plugin {
const hookIDs = Object.keys(featureScan);
const featureScanValues = Object.values(featureScan);
const fileNameList = unique(featureScanValues.map(x => Object.keys(x)).flat());
const namesWithSymbols = fileNameList.map(filename => {
- 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 createConfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export async function createConfig(templatesRoot: string) {
const config = {} as ProjectConfig;
// Calculate initial directory based off of if this directory is 'empty' or not
// Empty is a loose check that allows some stuff like `.git`
- 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
Consider simplifying this complex logical expression. Open
if (this.inflate) {
const l = buf.length;
// TODO: use a single equals check instead of four separate ones.
const flush =
l >= 4 &&
Function signedInt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function signedInt(bits: number) {
const signBit = -1 << (bits - 1);
return new BitSerializer({
read(buffer) {
const value = buffer.read(bits);
- 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 loadConfig
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export async function loadConfig(root: string) {
const files = await readdir(root);
const matched = searchPaths.filter(file => files.includes(file));
if (matched.length === 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 resolveEntrypoint
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export async function resolveEntrypoint(entry: string): Promise<string | null> {
if (await exists(entry)) {
const stats = await stat(entry);
if (stats.isDirectory()) {
return resolveEntrypoint(path.join(entry, 'index'));
- 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 buildPhase2
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export async function buildPhase2({
config,
adapter,
sharedRollupPlugins,
featureScan,
- 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 resolveCreateMessageData
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function resolveCreateMessageData(input: CreateMessageData): CreateMessageResult {
const data = toJSONValue(input as JSONResolvable<CreateMessageObject>);
// String
if (typeof data === '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 $gatewayEvent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function $gatewayEvent<K extends keyof GatewayEventData>(
eventName: K,
handler: (data: GatewayEventData[K]) => void,
options: GatewayEventHookData = {}
) {
- 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
Avoid too many return
statements within this function. Open
return new Blob([data]);
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return o;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return o;
Avoid too many return
statements within this function. Open
return;