Showing 13 of 539 total issues
File index.spec.ts
has 990 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { strict as assert } from 'node:assert';
import { setTimeout } from 'node:timers/promises';
import { WatchError } from "../errors";
import { RedisSentinelConfig, SentinelFramework } from "./test-util";
import { RedisNode, RedisSentinelClientType, RedisSentinelEvent, RedisSentinelType } from "./types";
File index.spec.ts
has 679 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL, waitTillBeenCalled } from '../test-utils';
import RedisClient, { RedisClientType } from '.';
import { AbortError, ClientClosedError, ClientOfflineError, ConnectionTimeoutError, DisconnectsClientError, ErrorReply, MultiErrorReply, SocketClosedUnexpectedlyError, WatchError } from '../errors';
import { defineScript } from '../lua-script';
File AGGREGATE.spec.ts
has 485 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import AGGREGATE from './AGGREGATE';
import { parseArgs } from '@redis/client/lib/commands/generic-transformers';
File CREATE.spec.ts
has 434 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import CREATE, { SCHEMA_FIELD_TYPE, SCHEMA_TEXT_FIELD_PHONETIC, SCHEMA_VECTOR_FIELD_ALGORITHM, REDISEARCH_LANGUAGE } from './CREATE';
import { parseArgs } from '@redis/client/lib/commands/generic-transformers';
File decoder.spec.ts
has 368 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { strict as assert } from 'node:assert';
import { SinonSpy, spy } from 'sinon';
import { Decoder, RESP_TYPES } from './decoder';
import { BlobError, SimpleError } from '../errors';
import { TypeMapping } from './types';
Function attachConfig
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
export function attachConfig<
M extends RedisModules,
F extends RedisFunctions,
S extends RedisScripts,
RESP extends RespVersions
- 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 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL } from '../test-utils';
import SEARCH from './SEARCH';
import { parseArgs } from '@redis/client/lib/commands/generic-transformers';
File index.spec.ts
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { strict as assert } from 'node:assert';
import testUtils, { GLOBAL, waitTillBeenCalled } from '../test-utils';
import RedisCluster from '.';
import { SQUARE_SCRIPT } from '../client/index.spec';
import { RootNodesUnavailableError } from '../errors';
Function steadyState
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function steadyState(frame: SentinelFramework) {
let checkedMaster = false;
let checkedReplicas = false;
while (!checkedMaster || !checkedReplicas) {
if (!checkedMaster) {
Function steadyState
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
async function steadyState(frame: SentinelFramework) {
let checkedMaster = false;
let checkedReplicas = false;
while (!checkedMaster || !checkedReplicas) {
if (!checkedMaster) {
- 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 spawnRedisClusterNodeDockers
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function spawnRedisClusterNodeDockers(
dockersConfig: RedisClusterDockersConfig,
serverArguments: Array<string>,
fromSlot: number,
toSlot: number
Function spawnRedisClusterDockers
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async function spawnRedisClusterDockers(
dockersConfig: RedisClusterDockersConfig,
serverArguments: Array<string>
): Promise<Array<RedisServerDocker>> {
const numberOfMasters = dockersConfig.numberOfMasters ?? 2,
Avoid deeply nested control flow statements. Open
Open
if (testUtils.isVersionGreaterThan([7, 0, 3])) {
assert.equal(typeof item.ssub, 'number');
}