Showing 81 of 753 total issues
File index.spec.ts
has 921 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { strict as assert } from 'assert';
import testUtils, { GLOBAL, waitTillBeenCalled } from '../test-utils';
import RedisClient, { RedisClientType } from '.';
import { RedisClientMultiCommandType } from './multi-command';
import { RedisCommandRawReply, RedisModules, RedisFunctions, RedisScripts } from '../commands';
File generic-transformers.spec.ts
has 661 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { strict as assert } from 'assert';
import {
transformBooleanReply,
transformBooleanArrayReply,
pushScanArguments,
File commands.ts
has 638 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as APPEND from '../commands/APPEND';
import * as BITCOUNT from '../commands/BITCOUNT';
import * as BITFIELD_RO from '../commands/BITFIELD_RO';
import * as BITFIELD from '../commands/BITFIELD';
File generic-transformers.ts
has 569 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { RedisCommandArgument, RedisCommandArguments } from '.';
export function transformBooleanReply(reply: number): boolean {
return reply === 1;
}
File AGGREGATE.spec.ts
has 473 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { AggregateGroupByReducers, AggregateSteps, transformArguments } from './AGGREGATE';
import { SchemaFieldTypes } from '.';
File index.spec.ts
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { strict as assert } from 'assert';
import {
transformTimestampArgument,
pushRetentionArgument,
File index.ts
has 392 lines of code (exceeds 250 allowed). Consider refactoring. Open
import * as ADD from './ADD';
import * as ALTER from './ALTER';
import * as CREATE from './CREATE';
import * as CREATERULE from './CREATERULE';
import * as DECRBY from './DECRBY';
File CREATE.spec.ts
has 381 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { strict as assert } from 'assert';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './CREATE';
import { SchemaFieldTypes, SchemaTextFieldPhonetics, RedisSearchLanguages, VectorAlgorithms } from '.';
File commands.ts
has 373 lines of code (exceeds 250 allowed). Consider refactoring. Open
import CLUSTER_COMMANDS from '../cluster/commands';
import * as ACL_CAT from '../commands/ACL_CAT';
import * as ACL_DELUSER from '../commands/ACL_DELUSER';
import * as ACL_DRYRUN from '../commands/ACL_DRYRUN';
import * as ACL_GENPASS from '../commands/ACL_GENPASS';
Function pushAggregatehOptions
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
export function pushAggregatehOptions(
args: RedisCommandArguments,
options?: AggregateOptions
): RedisCommandArguments {
if (options?.VERBATIM) {
- 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 index.spec.ts
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { strict as assert } from 'assert';
import testUtils, { GLOBAL, waitTillBeenCalled } from '../test-utils';
import RedisCluster from '.';
import { ClusterSlotStates } from '../commands/CLUSTER_SETSLOT';
import { commandOptions } from '../command-options';
Function transformArguments
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
export function transformArguments<M extends boolean>(
mode: M,
options?: M extends true ? ClientTrackingOptions : undefined
): RedisCommandArguments {
const args: RedisCommandArguments = [
- 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 SEARCH.spec.ts
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { strict as assert } from 'assert';
import { RedisSearchLanguages, SchemaFieldTypes } from '.';
import testUtils, { GLOBAL } from '../test-utils';
import { transformArguments } from './SEARCH';
Function pushAggregatehOptions
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function pushAggregatehOptions(
args: RedisCommandArguments,
options?: AggregateOptions
): RedisCommandArguments {
if (options?.VERBATIM) {
Function parseArray
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private parseArray(chunk: Buffer, arraysToKeep = 0): ArrayReply | undefined {
if (this.initializeArray || this.arraysInProcess.length === arraysToKeep) {
const length = this.parseInteger(chunk);
if (length === undefined) {
this.initializeArray = true;
- 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 AGGREGATE.ts
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
import { pushVerdictArgument, transformTuplesReply } from '@redis/client/dist/lib/commands/generic-transformers';
import { Params, PropertyName, pushArgumentsWithLength, pushParamsArgs, pushSortByArguments, SortByProperty } from '.';
export enum AggregateSteps {
Function transformReply
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export function transformReply(reply: string): Array<RedisClusterMasterNode> {
const lines = reply.split('\n');
lines.pop(); // last line is empty
const mastersMap = new Map<string, RedisClusterMasterNode>(),
- 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 pushRangeArguments
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function pushRangeArguments(
args: RedisCommandArguments,
fromTimestamp: Timestamp,
toTimestamp: Timestamp,
options?: RangeOptions
Function transformArguments
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function transformArguments(index: string, schema: RediSearchSchema, options?: CreateOptions): Array<string> {
const args = ['FT.CREATE', index];
if (options?.ON) {
args.push('ON', options.ON);
Function transformReply
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function transformReply(rawReply: string): ClientInfoReply {
const map: Record<string, string> = {};
for (const item of rawReply.matchAll(CLIENT_INFO_REGEX)) {
map[item[1]] = item[2];
}