XYOracleNetwork/sdk-xyo-client-android

View on GitHub

Showing 5 of 23 total issues

Method query has a Cognitive Complexity of 50 (exceeds 20 allowed). Consider refactoring.
Open

    @ExperimentalCoroutinesApi
    @RequiresApi(Build.VERSION_CODES.M)
    suspend fun query(query: XyoPayload, payloads: List<XyoPayload>?, previousHash: String?): PostQueryResult {
        val bodyString = buildQuery(query, payloads, previousHash)
        val postBody = bodyString.toRequestBody(MEDIA_TYPE_JSON)
Severity: Minor
Found in sdk/src/main/java/network/xyo/client/node/client/NodeClient.kt - About 5 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

Method postBoundWitnessesAsync has a Cognitive Complexity of 49 (exceeds 20 allowed). Consider refactoring.
Open

    @ExperimentalCoroutinesApi
    private suspend fun postBoundWitnessesAsync (
        entries: List<XyoBoundWitnessJson>
    ): PostBoundWitnessesResult {
        val bodyString = XyoSerializable.toJson(entries)

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

Method postBoundWitnessesAsync has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @ExperimentalCoroutinesApi
    private suspend fun postBoundWitnessesAsync (
        entries: List<XyoBoundWitnessJson>
    ): PostBoundWitnessesResult {
        val bodyString = XyoSerializable.toJson(entries)

    Method query has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @ExperimentalCoroutinesApi
        @RequiresApi(Build.VERSION_CODES.M)
        suspend fun query(query: XyoPayload, payloads: List<XyoPayload>?, previousHash: String?): PostQueryResult {
            val bodyString = buildQuery(query, payloads, previousHash)
            val postBody = bodyString.toRequestBody(MEDIA_TYPE_JSON)
    Severity: Minor
    Found in sdk/src/main/java/network/xyo/client/node/client/NodeClient.kt - About 1 hr to fix

      Avoid too many return statements within this method.
      Open

              return EcPointMath.dot(p1, p2, m, this)
      Severity: Major
      Found in sdk/src/main/java/network/xyo/client/EcCurve.kt - About 30 mins to fix
        Severity
        Category
        Status
        Source
        Language