XYOracleNetwork/sdk-xyo-client-js

View on GitHub

Showing 308 of 312 total issues

Function getProvider has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  async getProvider(cache = false, error?: string | boolean): Promise<Provider | undefined> {
    const providers = await this.getProviders(cache)
    if (providers.length === 0) {
      if (error) {
        throw new Error(typeof error === 'string' ? error : 'No providers available')

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 constructor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  constructor(huri: Hash | Huri | string, { archivistUri, token }: HuriOptions = {}) {
    const huriString =
      Huri.isHuri(huri)?.href ??
      (typeof huri === 'string' ? (huri as string)
      : huri instanceof ArrayBuffer ? new AddressValue(huri).hex
Severity: Minor
Found in packages/protocol/packages/payload/packages/huri/src/Huri.ts - About 25 mins 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 hashableFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  static async hashableFields<T extends Payload = Payload<AnyObject>>(
    schema: string,
    fields?: WithoutSchema<WithoutMeta<T>>,
    $meta?: JsonObject,
    $hash?: Hash,
Severity: Minor
Found in packages/protocol/packages/payload/packages/builder/src/Builder.ts - About 25 mins 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 hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  static async hash<T extends EmptyObject>(obj: T): Promise<Hash> {
    const stringToHash = this.stringifyHashFields(obj)

    if (PayloadHasher.allowSubtle) {
      try {
Severity: Minor
Found in packages/protocol/packages/core/packages/hash/src/PayloadHasher.ts - About 25 mins 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 relative has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  relative(direction: string) {
    const directionConstant = assertEx(RelativeDirectionConstantLookup[direction], () => 'Invalid direction')
    let quadkey = this.base4Hash
    if (quadkey.length === 0) {
      return this
Severity: Minor
Found in packages/sdk/packages/quadkey/src/Quadkey.ts - About 25 mins 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 emitInternal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  private async emitInternal<TEventName extends keyof TEventData, TEventArgs extends TEventData[TEventName]>(
    eventName: TEventName,
    eventArgs: TEventArgs,
    filter?: TEventArgs,
  ) {
Severity: Minor
Found in packages/modules/packages/module/packages/events/src/Events/Events.ts - About 25 mins 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 verify has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  static verify(msg: ArrayBuffer, signature: ArrayBuffer, address: ArrayBuffer) {
    let valid = false
    const sigArray = toUint8Array(signature)
    const r = sigArray.slice(0, 32)
    const s = sigArray.slice(32, 64)
Severity: Minor
Found in packages/protocol/packages/account/src/Key/AddressValue.ts - About 25 mins 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 parseQuery has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  static async parseQuery<T extends Query = Query>(obj: unknown, payloads?: Payload[]): Promise<QueryBoundWitnessWrapper<T>> {
    assertEx(!Array.isArray(obj), () => 'Array can not be converted to QueryBoundWitnessWrapper')
    switch (typeof obj) {
      case 'object': {
        const castWrapper = obj as QueryBoundWitnessWrapper<T>

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

Severity
Category
Status
Source
Language