keymetrics/pm2-io-apm

View on GitHub

Showing 121 of 129 total issues

Function getPatchSendCommand has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

  private getPatchSendCommand () {
    const plugin = this
    const addArguments = typeof this.options === 'object'
      && this.options.detailedCommands === true

Severity: Minor
Found in src/census/plugins/ioredis.ts - 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

Function init has 117 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  init (config?: RuntimeMetricsOptions | boolean) {
    if (config === false) return
    if (config === undefined) {
      config = defaultOptions
    }
Severity: Major
Found in src/metrics/runtime.ts - About 4 hrs to fix

    File http.ts has 350 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Copyright 2018, OpenCensus Authors
     *
     * Licensed under the Apache License, Version 2.0 (the "License")
     * you may not use this file except in compliance with the License.
    Severity: Minor
    Found in src/census/plugins/http.ts - About 4 hrs to fix

      Function getPatchSendCommand has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

        private getPatchSendCommand () {
          const plugin = this
          const addArguments = typeof this.options === 'object'
            && this.options.detailedCommands === true
          return function internalSendCommandWrap (original: Function) {
      Severity: Minor
      Found in src/census/plugins/redis.ts - 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 transactionAggregator.ts has 336 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict'
      
      import * as Debug from 'debug'
      import { EventEmitter2 } from 'eventemitter2'
      import EWMA from './EWMA'
      Severity: Minor
      Found in src/utils/transactionAggregator.ts - About 4 hrs to fix

        Function matchPath has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

          matchPath (path, routes) {
            // empty route is / without the fist slash
            if (!path || !routes) return false
            if (path === '/') return routes[path] ? path : null
        
        
        Severity: Minor
        Found in src/utils/transactionAggregator.ts - About 3 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 http.spec.ts has 316 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * Copyright 2018, OpenCensus Authors
         *
         * Licensed under the Apache License, Version 2.0 (the "License")
         * you may not use this file except in compliance with the License.
        Severity: Minor
        Found in src/census/plugins/__tests__/http.spec.ts - About 3 hrs to fix

          Function init has 83 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            init (config: IOConfig): void {
              this.logger('init tracing')
          
              if (config.tracing === undefined) {
                config.tracing = defaultTracingConfig
          Severity: Major
          Found in src/features/tracing.ts - About 3 hrs to fix

            Function init has 83 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              init (config?: EventLoopMetricOption | boolean) {
                if (config === false) return
                if (config === undefined) {
                  config = defaultOptions
                }
            Severity: Major
            Found in src/metrics/eventLoopMetrics.ts - About 3 hrs to fix

              File https.spec.ts has 297 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /**
               * Copyright 2018, OpenCensus Authors
               *
               * Licensed under the Apache License, Version 2.0 (the "License")
               * you may not use this file except in compliance with the License.
              Severity: Minor
              Found in src/census/plugins/__tests__/https.spec.ts - About 3 hrs to fix

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

                  init (config?: RuntimeMetricsOptions | boolean) {
                    if (config === false) return
                    if (config === undefined) {
                      config = defaultOptions
                    }
                Severity: Minor
                Found in src/metrics/runtime.ts - About 3 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 getPatchIncomingRequestFunction has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  protected getPatchIncomingRequestFunction () {
                    return (original: (event: string) => boolean) => {
                      const plugin = this
                      // This function's signature is that of an event listener, which can have
                      // any number of variable-type arguments.
                Severity: Major
                Found in src/census/plugins/http.ts - About 2 hrs to fix

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

                    init (config?: V8MetricsConfig | boolean) {
                      if (config === false) return
                      if (config === undefined) {
                        config = defaultOptions
                      }
                  Severity: Minor
                  Found in src/metrics/v8.ts - 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 getMakeRequestTraceFunction has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private getMakeRequestTraceFunction (
                        request: httpModule.ClientRequest, options: httpModule.RequestOptions,
                        plugin: HttpPlugin): Func<httpModule.ClientRequest> {
                      return (span: Span): httpModule.ClientRequest => {
                        plugin.logger.debug('makeRequestTrace')
                  Severity: Major
                  Found in src/census/plugins/http.ts - About 2 hrs to fix

                    Function prepareAggregationforShipping has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      prepareAggregationforShipping () {
                        let routes = this.cache.routes
                    
                        const normalized: Trace = {
                          routes: [],
                    Severity: Major
                    Found in src/utils/transactionAggregator.ts - About 2 hrs to fix

                      Function incomingRequest has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            return function incomingRequest (event: string, ...args: any[]): boolean {
                              // Only traces request events
                              if (event !== 'request') {
                                return original.apply(this, arguments)
                              }
                      Severity: Major
                      Found in src/census/plugins/http.ts - About 2 hrs to fix

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

                          init (config?: EventLoopMetricOption | boolean) {
                            if (config === false) return
                            if (config === undefined) {
                              config = defaultOptions
                            }
                        Severity: Minor
                        Found in src/metrics/eventLoopMetrics.ts - 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 init has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          static init (conf, doNotTellPm2?) {
                            const packageFilepath = Configuration.findPackageJson()
                            let packageJson
                        
                            if (!conf.module_conf) {
                        Severity: Major
                        Found in src/configuration.ts - About 2 hrs to fix

                          Function getPatchOutgoingRequestFunction has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            protected getPatchOutgoingRequestFunction () {
                              return (original: Func<httpModule.ClientRequest>): Func<
                                         httpModule.ClientRequest> => {
                                const plugin = this
                                const kind = plugin.moduleName === 'https' ? 'HTTPS' : 'HTTP'
                          Severity: Major
                          Found in src/census/plugins/http.ts - About 2 hrs to fix

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

                              static init (conf, doNotTellPm2?) {
                                const packageFilepath = Configuration.findPackageJson()
                                let packageJson
                            
                                if (!conf.module_conf) {
                            Severity: Minor
                            Found in src/configuration.ts - 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

                            Severity
                            Category
                            Status
                            Source
                            Language