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
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) => {
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) {
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: [
{
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[] }> {
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: {
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'),
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) {
Function getNestedObjectType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private getNestedObjectType(
boundWitness: XyoBoundWitness,
rootSchema: XyoSchema,
subSchema: XyoSchema
): XyoStructure | undefined {
- 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 getNestedObjectType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private getNestedObjectType(
boundWitness: XyoBoundWitness,
rootSchema: XyoSchema,
subSchema: XyoSchema
): XyoStructure | undefined {
- 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 getNestedObjectType
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private getNestedObjectType(
boundWitness: XyoBoundWitness,
rootSchema: XyoSchema,
subSchema: XyoSchema
): XyoStructure | undefined {
- 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 putItem
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async putItem(
key: Buffer,
hash: Buffer,
index: number
): Promise<void> {
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 {
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: {
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: {
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)
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: [
{
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,
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: [
{
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: {