keymetrics/pm2-io-apm

View on GitHub

Showing 121 of 129 total issues

Avoid too many return statements within this function.
Open

    return false
Severity: Major
Found in src/utils/transactionAggregator.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return original.apply(this, arguments)
    Severity: Major
    Found in src/census/plugins/redis.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return s
      Severity: Major
      Found in src/utils/autocast.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return segments.join('/')
        Severity: Major
        Found in src/utils/transactionAggregator.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return pkgPath
          Severity: Major
          Found in src/configuration.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return this.logger('Failed to send event as transporter isnt available')
            Severity: Major
            Found in src/features/events.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return action.handler(data.opts || {}, stream)
              Severity: Major
              Found in src/services/actions.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return true
                Severity: Major
                Found in src/utils/transactionAggregator.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return (plugin.getMakeRequestTraceFunction(request, options, plugin))(
                                span)
                  Severity: Major
                  Found in src/census/plugins/http.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return this.logger(`Received scoped action ${action.name} but without uuid`)
                    Severity: Major
                    Found in src/services/actions.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            if (one[i].labels && !two[i].labels) return false
                      Severity: Major
                      Found in src/utils/transactionAggregator.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                if (j === 0) return segments.join('/')
                        Severity: Major
                        Found in src/utils/transactionAggregator.ts - About 30 mins to fix

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

                            init (config?: NetworkTrafficConfig | boolean) {
                              if (config === false) return
                              if (config === true) {
                                config = allEnabled
                              }
                          Severity: Minor
                          Found in src/metrics/network.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 convertTraceStatus has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            static convertTraceStatus (statusCode: number): number {
                              if (statusCode < 200 || statusCode > 504) {
                                return TraceStatusCodes.UNKNOWN
                              } else if (statusCode >= 200 && statusCode < 400) {
                                return TraceStatusCodes.OK
                          Severity: Minor
                          Found in src/census/plugins/http.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 onUncaughtException has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            private onUncaughtException (error) {
                              if (semver.satisfies(process.version, '< 6')) {
                                console.error(error.stack)
                              } else {
                                console.error(error)
                          Severity: Minor
                          Found in src/features/notify.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 patchEnd has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            patchEnd (span: Span, resultHandler: Function): Function {
                              const plugin = this
                              const patchedEnd = function (err?: Error) {
                                if (plugin.options.detailedCommands === true && err instanceof Error) {
                                  span.addAttribute('error', err.message)
                          Severity: Minor
                          Found in src/census/plugins/redis.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 registerAction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            registerAction (actionName?: string, opts?: Object | undefined | Function, handler?: Function): void {
                              if (typeof opts === 'function') {
                                handler = opts
                                opts = undefined
                              }
                          Severity: Minor
                          Found in src/services/actions.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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            init (options?: Object) {
                              if (typeof options !== 'object') options = {}
                              this.logger('init')
                          
                              for (let availableMetric of availableMetrics) {
                          Severity: Minor
                          Found in src/features/metrics.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 aggregate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            aggregate (packet) {
                              if (this.validateData(packet) === false) return false
                          
                              // Get http path of current span
                              let path = packet.spans[0].labels['http/path']
                          Severity: Minor
                          Found in src/utils/transactionAggregator.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 _cast has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                            private _cast (s) {
                              let key
                          
                              // Don't cast Date objects
                              if (s instanceof Date) return s
                          Severity: Minor
                          Found in src/utils/autocast.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

                          Severity
                          Category
                          Status
                          Source
                          Language