XYOracleNetwork/sdk-archivist-nodejs

View on GitHub

Showing 25 of 51 total issues

Function scanByKey has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public async scanByKey(
    key: Buffer,
    limit: number,
    index: number | undefined,
    up: boolean
Severity: Major
Found in src/repository/dynamodb/table/publickey.ts - About 3 hrs to fix

    Function scan has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public async scan(
        limit: number,
        offsetHash?: Buffer | undefined
      ): Promise<any[]> {
        return new Promise<[]>((resolve: any, reject: any) => {
    Severity: Major
    Found in src/repository/dynamodb/table/boundwitness.ts - About 2 hrs to fix

      Function migrate has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public async migrate() {
          const absorber = new ArchivistAbsorber(process.argv[2])
      
          // eslint-disable-next-line no-constant-condition
          while (true) {
      Severity: Minor
      Found in src/repository/dynamodb/xyo-dynamo-migrator.ts - About 1 hr to fix

        Function constructor has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor(tableName = 'xyo-archivist-geohash', region = 'us-east-1') {
            super(tableName, region)
            this.createTableInput = {
              AttributeDefinitions: [
                {
        Severity: Minor
        Found in src/repository/dynamodb/table/geo.ts - About 1 hr to fix

          Function getByTime has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public async getByTime(
              hour: number,
              cursor: number,
              limit: number
            ): Promise<{ lastTime: number; results: Buffer[] }> {
          Severity: Minor
          Found in src/repository/dynamodb/table/time.ts - About 1 hr to fix

            Function getByGeohash has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public async getByGeohash(geohash: string, limit: number): Promise<Buffer[]> {
                return new Promise<Buffer[]>((resolve: any, reject: any) => {
                  try {
                    const params: DynamoDB.Types.QueryInput = {
                      ExpressionAttributeValues: {
            Severity: Minor
            Found in src/repository/dynamodb/table/geo.ts - About 1 hr to fix

              Function bufferToGraphQlBlock has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function bufferToGraphQlBlock(buffer: Buffer): any {
                const boundWitness = new XyoBoundWitness(buffer)
                return {
                  bytes: buffer.toString('base64'),
              
              
              Severity: Minor
              Found in src/endpoints/buffer-to-graphql-block.ts - About 1 hr to fix

                Function getItem has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public async getItem(hash: Buffer): Promise<any> {
                    return new Promise<boolean>((resolve: any, reject: any) => {
                      try {
                        const value = this.cache.get(hash.toString())
                        if (value) {
                Severity: Minor
                Found in src/repository/dynamodb/table/boundwitness.ts - About 1 hr to fix

                  Function getNestedObjectType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private getNestedObjectType(
                      boundWitness: XyoBoundWitness,
                      rootSchema: XyoSchema,
                      subSchema: XyoSchema
                    ): XyoStructure | undefined {
                  Severity: Minor
                  Found in src/collector-stats/index.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 getNestedObjectType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private getNestedObjectType(
                      boundWitness: XyoBoundWitness,
                      rootSchema: XyoSchema,
                      subSchema: XyoSchema
                    ): XyoStructure | undefined {
                  Severity: Minor
                  Found in src/elastic-search/xyo-geohash-elastic-search.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 getNestedObjectType has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private getNestedObjectType(
                      boundWitness: XyoBoundWitness,
                      rootSchema: XyoSchema,
                      subSchema: XyoSchema
                    ): XyoStructure | undefined {
                  Severity: Minor
                  Found in src/notify/xyo-websocket-notify.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 putItem has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public async putItem(bytes: Buffer): Promise<void> {
                      const currentTime = new Date().getTime()
                  
                      return new Promise<void>((resolve: any, reject: any) => {
                        try {
                  Severity: Minor
                  Found in src/repository/dynamodb/table/time.ts - About 1 hr to fix

                    Function putItem has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public async putItem(
                        key: Buffer,
                        hash: Buffer,
                        index: number
                      ): Promise<void> {
                    Severity: Minor
                    Found in src/repository/dynamodb/table/publickey.ts - About 1 hr to fix

                      Function putItem has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        public async putItem(geohash: string, hash: Buffer): Promise<void> {
                          return new Promise<void>((resolve: any, reject: any) => {
                            try {
                              const params: DynamoDB.Types.PutItemInput = {
                                Item: {
                      Severity: Minor
                      Found in src/repository/dynamodb/table/geo.ts - About 1 hr to fix

                        Function putItem has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          public async putItem(hash: Buffer, originBlock: Buffer): Promise<void> {
                            return new Promise<void>((resolve: any, reject: any) => {
                              try {
                                const params: DynamoDB.Types.PutItemInput = {
                                  Item: {
                        Severity: Minor
                        Found in src/repository/dynamodb/table/boundwitness.ts - About 1 hr to fix

                          Function constructor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            constructor(tableName = 'xyo-archivist-time', region = 'us-east-1') {
                              super(tableName, region)
                              this.createTableInput = {
                                AttributeDefinitions: [
                                  {
                          Severity: Minor
                          Found in src/repository/dynamodb/table/time.ts - About 1 hr to fix

                            Function resolve has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              public async resolve(obj: any, args: any): Promise<any> {
                                const cursor = args.cursor as string | undefined
                                const cursorBuffer = cursor ? bs58.decode(cursor) : undefined
                                const result = await this.originBlockRepository.getOriginBlocks(
                                  args.limit as number,
                            Severity: Minor
                            Found in src/endpoints/block-list.ts - About 1 hr to fix

                              Function initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                public async initialize(delegate: IXyoPluginDelegate): Promise<boolean> {
                                  const inserter = delegate.deps
                                    .BOUND_WITNESS_INSERTER as XyoBoundWitnessInserter
                                  const stats = new XyoCollectorStats()
                                  const resolver = new XyoCollecterStatsResolver(stats)
                              Severity: Minor
                              Found in src/collector-stats/index.ts - About 1 hr to fix

                                Function constructor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  constructor(tableName = 'xyo-archivist-chains', region = 'us-east-1') {
                                    super(tableName, region)
                                    this.createTableInput = {
                                      AttributeDefinitions: [
                                        {
                                Severity: Minor
                                Found in src/repository/dynamodb/table/publickey.ts - About 1 hr to fix

                                  Function deleteItem has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    public async deleteItem(hash: Buffer): Promise<void> {
                                      return new Promise<void>((resolve: any, reject: any) => {
                                        try {
                                          const params: DynamoDB.Types.DeleteItemInput = {
                                            Key: {
                                  Severity: Minor
                                  Found in src/repository/dynamodb/table/boundwitness.ts - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language