Showing 28 of 64 total issues
Function traceChain
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
public async traceChain(
publicKey: Buffer,
limit: number | undefined = 100,
index: number | undefined = 0,
up: boolean
- 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 traceChain
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async traceChain(
publicKey: Buffer,
limit: number | undefined = 100,
index: number | undefined = 0,
up: boolean
Function getBlockPreviousHash
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private getBlockPreviousHash(
publicKeysOfParent: Buffer[],
boundWitnessBytes: Buffer
): { origin: IXyoBoundWitnessOrigin; publicKeys: Buffer[] } | undefined {
const boundWitness = new XyoBoundWitness(boundWitnessBytes)
- 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 getPublicKeyOfNextSegment
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
private getPublicKeyOfNextSegment(
boundWitnessBytes: Buffer,
publicKeysOfParty: Buffer[]
): Buffer | undefined {
const boundWitness = new XyoBoundWitness(boundWitnessBytes)
- 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 bufferToGraphQlBlock
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function bufferToGraphQlBlock(buffer: Buffer): any {
const boundWitness = new XyoBoundWitness(buffer)
return {
// todo get human readable
humanReadable: XyoHumanHeuristicResolver.resolve(buffer).value,
Function getQueryInfo
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public getQueryInfo(
day: number,
time: number,
limit: number
): Promise<IXyoQueryInfo[]> {
Function didIntersect
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public didIntersect(boundWitness: Buffer): boolean {
const founds: boolean[] = new Array(this.config.with.length)
const publicKeys = new XyoBoundWitness(boundWitness).getPublicKeys()
for (let i = 0; i < this.config.with.length; i++) {
- 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 putQueryInfo
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public putQueryInfo(info: IXyoQueryInfo): Promise<void> {
const day = Math.floor(info.time.getTime() / (1000 * 60 * 60 * 24))
return new Promise<void>((resolve: any, reject: any) => {
try {
Function initialize
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async initialize(delegate: IXyoPluginDelegate): Promise<boolean> {
const repository = delegate.deps
.REPORT_REPOSITORY as IXyoQueryReportRepository
const query = delegate.deps.QUERY as XyoQuery
const hasher = new XyoSha256()
Function getAmountInTransaction
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async getAmountInTransaction(
txHash: string,
fromEth: string,
toEth: string
): Promise<number | undefined> {
Function getBlockPreviousHash
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getBlockPreviousHash(
publicKeysOfParent: Buffer[],
boundWitnessBytes: Buffer
): { origin: IXyoBoundWitnessOrigin; publicKeys: Buffer[] } | undefined {
const boundWitness = new XyoBoundWitness(boundWitnessBytes)
Function getItem
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async getItem(key: string): Promise<any> {
return new Promise<boolean>((resolve: any, reject: any) => {
try {
const params: DynamoDB.Types.GetItemInput = {
Key: {
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(tableName = 'xyo-diviner-queries', region = 'us-east-1') {
super(tableName, region)
this.createTableInput = {
AttributeDefinitions: [
Function queryFor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async queryFor(query: IXyoQuery): Promise<any> {
if (this.auth) {
const auth = await this.auth.auth(query)
query.shouldReward = auth.shouldReward
Function getLastIntersection
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async getLastIntersection(
on: Buffer,
withKeys: Buffer[],
startingIndex: number
): Promise<Buffer | undefined> {
Function getBalance
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async getBalance(key: string): Promise<number | undefined> {
return new Promise<number | undefined>((resolve: any, reject: any) => {
try {
const params: DynamoDB.Types.GetItemInput = {
Key: {
Function queryFor
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public async queryFor(query: IXyoQuery): Promise<any> {
if (this.auth) {
const auth = await this.auth.auth(query)
query.shouldReward = auth.shouldReward
- 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 auth
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public async auth(
config: any
): Promise<{ auth: boolean; shouldReward: boolean }> {
const keys = Object.keys(config)
- 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 checkIfExceedLimit
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private checkIfExceedLimit(config: any) {
if (config.select) {
if (config.select.config) {
if (
config.select.config.limit &&
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async putItem(key: string, bal: number): Promise<void> {
return new Promise<void>((resolve: any, reject: any) => {
try {
const params: DynamoDB.Types.PutItemInput = {
Item: {