XYOracleNetwork/sdk-core-swift

View on GitHub

Showing 31 of 235 total issues

NativeSecp256k1 has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

public class NativeSecp256k1 {

    private static final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock();
    private static final Lock r = rwl.readLock();
    private static final Lock w = rwl.writeLock();

    Function doBoundWitness has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        public func doBoundWitness (transfer: XyoIterableStructure?, completion : @escaping (_: XyoError?)->()?) {
            do {
                if (cycles >= XyoZigZagBoundWitnessSession.maxNumberOfCycles) {
                    completion(XyoError.UNKNOWN_ERROR)
                    return

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

        public func doBoundWitness (transfer: XyoIterableStructure?, completion : @escaping (_: XyoError?)->()?) {
            do {
                if (cycles >= XyoZigZagBoundWitnessSession.maxNumberOfCycles) {
                    completion(XyoError.UNKNOWN_ERROR)
                    return
    Severity: Minor
    Found in sdk-core-swift/boundWitness/XyoZigZagBoundWitnessSession.swift - About 2 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

    File NativeSecp256k1.java has 266 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright 2013 Google Inc.
     * Copyright 2014-2016 the libsecp256k1 contributors
     *
     * Licensed under the Apache License, Version 2.0 (the "License");

      Function doBoundWitnessWithPipe has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private func doBoundWitnessWithPipe (startingData : XyoIterableStructure?, handler : XyoNetworkHandler, choice : [UInt8], completion: @escaping (_: XyoBoundWitness?, _: XyoError?)->()) {
          
              do {
                  let options = getBoundWitnessesOptionsForFlag(flag: choice)
                  let additional = try getAdditionalPayloads(flag: choice, pipe: handler.pipe)
      Severity: Minor
      Found in sdk-core-swift/node/XyoOriginChainCreator.swift - About 1 hr to fix

        Function doBoundWitnessWithPipe has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private func doBoundWitnessWithPipe (startingData : XyoIterableStructure?, handler : XyoNetworkHandler, choice : [UInt8], completion: @escaping (_: XyoBoundWitness?, _: XyoError?)->()) {
            
                do {
                    let options = getBoundWitnessesOptionsForFlag(flag: choice)
                    let additional = try getAdditionalPayloads(flag: choice, pipe: handler.pipe)
        Severity: Minor
        Found in Sources/sdk-core-swift/node/XyoOriginChainCreator.swift - About 1 hr to fix

          Function doBoundWitnessWithPipe has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              private func doBoundWitnessWithPipe (startingData : XyoIterableStructure?, handler : XyoNetworkHandler, choice : [UInt8], completion: @escaping (_: XyoBoundWitness?, _: XyoError?)->()) {
              
                  do {
                      let options = getBoundWitnessesOptionsForFlag(flag: choice)
                      let additional = try getAdditionalPayloads(flag: choice, pipe: handler.pipe)
          Severity: Minor
          Found in sdk-core-swift/node/XyoOriginChainCreator.swift - 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 doBoundWitnessWithPipe has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              private func doBoundWitnessWithPipe (startingData : XyoIterableStructure?, handler : XyoNetworkHandler, choice : [UInt8], completion: @escaping (_: XyoBoundWitness?, _: XyoError?)->()) {
              
                  do {
                      let options = getBoundWitnessesOptionsForFlag(flag: choice)
                      let additional = try getAdditionalPayloads(flag: choice, pipe: handler.pipe)
          Severity: Minor
          Found in Sources/sdk-core-swift/node/XyoOriginChainCreator.swift - 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 base58FromBytes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              static func base58FromBytes(_ bytes: [UInt8]) -> String {
                  var bytes = bytes
                  var zerosCount = 0
                  var length = 0
          
          
          Severity: Minor
          Found in Sources/sdk-core-swift/objectmodel/XyoBase58.swift - About 1 hr to fix

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

                static func base58FromBytes(_ bytes: [UInt8]) -> String {
                    var bytes = bytes
                    var zerosCount = 0
                    var length = 0
                    
            Severity: Minor
            Found in sdk-core-swift/objectmodel/XyoBase58.swift - About 1 hr to fix

              Function base58FromBytes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  static func base58FromBytes(_ bytes: [UInt8]) -> String {
                      var bytes = bytes
                      var zerosCount = 0
                      var length = 0
              
              
              Severity: Minor
              Found in Sources/sdk-core-swift/objectmodel/XyoBase58.swift - 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 base58FromBytes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  static func base58FromBytes(_ bytes: [UInt8]) -> String {
                      var bytes = bytes
                      var zerosCount = 0
                      var length = 0
                      
              Severity: Minor
              Found in sdk-core-swift/objectmodel/XyoBase58.swift - 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 doBoundWitness has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public func doBoundWitness (transfer: XyoIterableStructure?, completion : @escaping (_: XyoError?)->()?) {
                      do {
                          if (cycles >= XyoZigZagBoundWitnessSession.maxNumberOfCycles) {
                              completion(XyoError.UNKNOWN_ERROR)
                              return
              Severity: Minor
              Found in sdk-core-swift/boundWitness/XyoZigZagBoundWitnessSession.swift - About 1 hr to fix

                Function doBoundWitness has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public func doBoundWitness (transfer: XyoIterableStructure?, completion : @escaping (_: XyoError?)->()?) {
                        do {
                            if (cycles >= XyoZigZagBoundWitnessSession.maxNumberOfCycles) {
                                completion(XyoError.UNKNOWN_ERROR)
                                return

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

                      public func boundWitness (handler : XyoNetworkHandler,
                                                procedureCatalogue: XyoProcedureCatalog,
                                                completion: @escaping (_: XyoBoundWitness?, _: XyoError?)->()) {
                          
                          if (currentBoundWitnessSession != nil) {
                  Severity: Minor
                  Found in Sources/sdk-core-swift/node/XyoOriginChainCreator.swift - About 1 hr to fix

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

                        public func boundWitness (handler : XyoNetworkHandler,
                                                  procedureCatalogue: XyoProcedureCatalog,
                                                  completion: @escaping (_: XyoBoundWitness?, _: XyoError?)->()) {
                            
                            if (currentBoundWitnessSession != nil) {
                    Severity: Minor
                    Found in sdk-core-swift/node/XyoOriginChainCreator.swift - About 1 hr to fix

                      Function send has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public func send(data: [UInt8], waitForResponse: Bool, completion: ([UInt8]?) -> ()) {
                              let dataWithSize = XyoBuffer()
                                  .put(bits: UInt32(data.count + 4))
                                  .put(bytes: data)
                                  .toByteArray()
                      Severity: Minor
                      Found in Sources/sdk-core-swift/network/tcp/XyoTcpSocketPipe.swift - 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 send has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public func send(data: [UInt8], waitForResponse: Bool, completion: ([UInt8]?) -> ()) {
                              let dataWithSize = XyoBuffer()
                                  .put(bits: UInt32(data.count + 4))
                                  .put(bytes: data)
                                  .toByteArray()
                      Severity: Minor
                      Found in sdk-core-swift/network/tcp/XyoTcpSocketPipe.swift - 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 getBoundWitnessesOptionsForFlag has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private func getBoundWitnessesOptionsForFlag (flag : [UInt8]) -> [XyoBoundWitnessOption] {
                              var retunOptions = [XyoBoundWitnessOption]()
                              
                              for option in boundWitnessOptions.values {
                                  if (min(option.getFlag().count, flag.count) != 0) {
                      Severity: Minor
                      Found in sdk-core-swift/node/XyoOriginChainCreator.swift - 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 getBoundWitnessesOptionsForFlag has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private func getBoundWitnessesOptionsForFlag (flag : [UInt8]) -> [XyoBoundWitnessOption] {
                              var retunOptions = [XyoBoundWitnessOption]()
                              
                              for option in boundWitnessOptions.values {
                                  if (min(option.getFlag().count, flag.count) != 0) {
                      Severity: Minor
                      Found in Sources/sdk-core-swift/node/XyoOriginChainCreator.swift - 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

                      Severity
                      Category
                      Status
                      Source
                      Language