NodeRedis/node-redis

View on GitHub

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';
Severity: Major
Found in packages/client/lib/client/index.spec.ts - About 2 days to fix

    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,
    Severity: Major
    Found in packages/client/lib/commands/generic-transformers.spec.ts - About 1 day to fix

      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';
      Severity: Major
      Found in packages/client/lib/cluster/commands.ts - About 1 day to fix

        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;
        }
        Severity: Major
        Found in packages/client/lib/commands/generic-transformers.ts - About 1 day to fix

          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 '.';
          
          
          Severity: Minor
          Found in packages/search/lib/commands/AGGREGATE.spec.ts - About 7 hrs to fix

            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,
            Severity: Minor
            Found in packages/time-series/lib/commands/index.spec.ts - About 5 hrs to fix

              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';
              Severity: Minor
              Found in packages/time-series/lib/commands/index.ts - About 5 hrs to fix

                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 '.';
                
                
                Severity: Minor
                Found in packages/search/lib/commands/CREATE.spec.ts - About 5 hrs to fix

                  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';
                  Severity: Minor
                  Found in packages/client/lib/client/commands.ts - About 4 hrs to fix

                    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) {
                    Severity: Minor
                    Found in packages/search/lib/commands/AGGREGATE.ts - About 4 hrs to fix

                    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';
                    Severity: Minor
                    Found in packages/client/lib/cluster/index.spec.ts - About 3 hrs to fix

                      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 = [
                      Severity: Minor
                      Found in packages/client/lib/commands/CLIENT_TRACKING.ts - About 3 hrs to fix

                      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';
                      
                      
                      Severity: Minor
                      Found in packages/search/lib/commands/SEARCH.spec.ts - About 2 hrs to fix

                        Function pushAggregatehOptions has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function pushAggregatehOptions(
                            args: RedisCommandArguments,
                            options?: AggregateOptions
                        ): RedisCommandArguments {
                            if (options?.VERBATIM) {
                        Severity: Major
                        Found in packages/search/lib/commands/AGGREGATE.ts - About 2 hrs to fix

                          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;
                          Severity: Minor
                          Found in packages/client/lib/client/RESP2/decoder.ts - About 2 hrs to fix

                          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 {
                          Severity: Minor
                          Found in packages/search/lib/commands/AGGREGATE.ts - About 2 hrs to fix

                            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>(),
                            Severity: Minor
                            Found in packages/client/lib/commands/CLUSTER_NODES.ts - About 1 hr to fix

                            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
                            Severity: Minor
                            Found in packages/time-series/lib/commands/index.ts - About 1 hr to fix

                              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);
                              Severity: Minor
                              Found in packages/search/lib/commands/CREATE.ts - About 1 hr to fix

                                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];
                                    }
                                Severity: Minor
                                Found in packages/client/lib/commands/CLIENT_INFO.ts - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language