lipp/node-jet

View on GitHub

Showing 62 of 123 total issues

Function createDaemon has 283 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const createDaemon = function (options) {
  options = options || {}
  const log = options.log || noop

  const users = options.users || {}
Severity: Major
Found in lib/jet/daemon.js - About 1 day to fix

    Function createDaemon has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
    Open

    const createDaemon = function (options) {
      options = options || {}
      const log = options.log || noop
    
      const users = options.users || {}
    Severity: Minor
    Found in lib/jet/daemon.js - About 1 day 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 create has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.create = function (options, notify) {
      const matches = []
      const sorted = {}
      const index = {}
      let n = -1
    Severity: Minor
    Found in lib/jet/sorter.js - About 1 day 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 create has 157 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.create = function (options, notify) {
      const matches = []
      const sorted = {}
      const index = {}
      let n = -1
    Severity: Major
    Found in lib/jet/sorter.js - About 6 hrs to fix

      Function sorter has 116 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        const sorter = function (notification, initializing) {
          const event = notification.event
          const path = notification.path
          const value = notification.value
          const lastMatchesLength = matches.length
      Severity: Major
      Found in lib/jet/sorter.js - About 4 hrs to fix

        Function createAsyncDispatcher has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

        State.prototype.createAsyncDispatcher = function (cb) {
          const that = this
        
          const dispatch = function (message) {
            const value = message.params.value
        Severity: Minor
        Found in lib/jet/peer/state.js - About 4 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 daemon.js has 317 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict'
        
        const net = require('./net')
        
        const uuid = require('uuid')
        Severity: Minor
        Found in lib/jet/daemon.js - About 3 hrs to fix

          Function create has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.create = function (options, notify) {
            const pathMatcher = jetPathMatcher.create(options)
            const valueMatcher = jetValueMatcher.create(options)
            const added = {}
          
          
          Severity: Major
          Found in lib/jet/fetcher.js - About 2 hrs to fix

            Function Peers has 64 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.Peers = function (jsonrpc, elements) {
              const instances = {}
            
              const remove = function (peer) {
                if (peer && instances[peer.id]) {
            Severity: Major
            Found in lib/jet/daemon/peers.js - About 2 hrs to fix

              Function listen has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                daemon.listen = function (listenOptions) {
                  const defaultListenOptions = {
                    tcpPort: 11122,
                    wsPort: 11123
                  }
              Severity: Major
              Found in lib/jet/daemon.js - About 2 hrs to fix

                Function create has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.create = function (options) {
                  if (!isDefined(options.path)) {
                    return
                  }
                  const po = options.path
                Severity: Major
                Found in lib/jet/path_matcher.js - About 2 hrs to fix

                  Function createSyncDispatcher has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                  State.prototype.createSyncDispatcher = function (cb) {
                    const that = this
                    const dispatcher = function (message) {
                      const value = message.params.value
                      try {
                  Severity: Minor
                  Found in lib/jet/peer/state.js - 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

                  Function create has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exports.create = function (options, notify) {
                    const pathMatcher = jetPathMatcher.create(options)
                    const valueMatcher = jetValueMatcher.create(options)
                    const added = {}
                  
                  
                  Severity: Minor
                  Found in lib/jet/fetcher.js - 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

                  Function createAsyncDispatcher has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                  Open

                  Method.prototype.createAsyncDispatcher = function (cb) {
                    const that = this
                    const dispatch = function (message) {
                      const mid = message.id
                      const reply = function (resp) {
                  Severity: Minor
                  Found in lib/jet/peer/method.js - 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

                  Function FakeFetcher has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const FakeFetcher = function (jsonrpc, fetchParams, fetchCb, asNotification) {
                    const id = '__f__' + globalFetchId
                    ++globalFetchId
                  
                    fetchParams.id = id
                  Severity: Minor
                  Found in lib/jet/peer/fetch.js - About 1 hr to fix

                    Function createAsyncDispatcher has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    State.prototype.createAsyncDispatcher = function (cb) {
                      const that = this
                    
                      const dispatch = function (message) {
                        const value = message.params.value
                    Severity: Minor
                    Found in lib/jet/peer/state.js - About 1 hr to fix

                      Function createTypedError has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                      exports.createTypedError = function (jsonrpcError) {
                        const code = jsonrpcError.code
                        const data = jsonrpcError.data
                        const dataType = typeof data
                        if (code === INVALID_PARAMS_CODE) {
                      Severity: Minor
                      Found in lib/jet/errors.js - 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 createSort has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const createSort = function (options) {
                        let sort
                        let lt, gt
                      
                        if ((!isDefined(options.sort.byValue) && !isDefined(options.sort.byValueField)) || options.sort.byPath) {
                      Severity: Minor
                      Found in lib/jet/sorter.js - About 1 hr to fix

                        Function service has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        JsonRPC.prototype.service = function (method, params, complete, asNotification) {
                          const that = this
                          return new Promise(function (resolve, reject) {
                            if (that._isClosed) {
                              reject(new errors.ConnectionClosed())
                        Severity: Minor
                        Found in lib/jet/peer/jsonrpc.js - About 1 hr to fix

                          Function MessageSocket has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const MessageSocket = function (port, ip) {
                            let last = Buffer.alloc(0)
                            let len = -1
                            const self = this
                            let socket
                          Severity: Minor
                          Found in lib/jet/message-socket.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language