appsignal/appsignal

View on GitHub

Showing 76 of 84 total issues

Method install has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def install
  library_type = "static"
  report["language"]["implementation"] = "ruby"
  report["build"]["library_type"] = library_type
  return unless check_architecture
Severity: Minor
Found in ext/extconf.rb - About 1 hr to fix

    Method start has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def start
          unless extension_loaded?
            logger.info("Not starting appsignal, extension is not loaded")
            return
          end
    Severity: Minor
    Found in lib/appsignal.rb - About 1 hr to fix

      Method report has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def report
        @report ||=
          begin
            rbconfig = RbConfig::CONFIG
            {
      Severity: Minor
      Found in ext/base.rb - About 1 hr to fix

        Method download_archive has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def download_archive(type)
          report["build"]["source"] = "remote"
        
          unless ARCH_CONFIG.key?(type)
            abort_installation(
        Severity: Minor
        Found in ext/base.rb - About 1 hr to fix

          Method paths has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def paths
                    @paths ||=
                      begin
                        config = Appsignal.config
                        log_file_path = config.log_file_path
          Severity: Minor
          Found in lib/appsignal/cli/diagnose/paths.rb - About 1 hr to fix

            Method included has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def self.included(base)
                    base.class_eval do
                      def _run_with_appsignal(*)
                        local_attrs = respond_to?(:que_attrs) ? que_attrs : attrs
                        env = {
            Severity: Minor
            Found in lib/appsignal/integrations/que.rb - About 1 hr to fix

              Method maintain_backwards_compatibility has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  def maintain_backwards_compatibility(configuration)
                    configuration.tap do |config|
                      DEPRECATED_CONFIG_KEY_MAPPING.each do |old_key, new_key|
                        old_config_value = config.delete(old_key)
                        next unless old_config_value
              Severity: Minor
              Found in lib/appsignal/config.rb - 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

              Method call_with_appsignal_monitoring has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def call_with_appsignal_monitoring(env)
                      request     = ::Rack::Request.new(env)
                      transaction = Appsignal::Transaction.create(
                        SecureRandom.uuid,
                        Appsignal::Transaction::HTTP_REQUEST,
              Severity: Minor
              Found in lib/appsignal/integrations/grape.rb - About 1 hr to fix

                Method monitor_transaction has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def monitor_transaction(name, env = {})
                        # Always verify input, even when Appsignal is not active.
                        # This makes it more likely invalid arguments get flagged in test/dev
                        # environments.
                        if name.start_with?("perform_job".freeze)
                Severity: Minor
                Found in lib/appsignal/helpers/instrumentation.rb - About 1 hr to fix

                  Method invoke_with_instrumentation has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def self.invoke_with_instrumentation(job, block)
                          payload = job.payload_object
                  
                          if payload.respond_to? :job_data
                            # ActiveJob
                  Severity: Minor
                  Found in lib/appsignal/integrations/delayed_job_plugin.rb - About 1 hr to fix

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

                        def load_from_environment
                          config = {}
                    
                          # Configuration with string type
                          %w[APPSIGNAL_PUSH_API_KEY APPSIGNAL_APP_NAME APPSIGNAL_PUSH_API_ENDPOINT
                    Severity: Minor
                    Found in lib/appsignal/config.rb - About 1 hr to fix

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

                              def map_hash(hash_value)
                                map = Appsignal::Extension.data_map_new
                                hash_value.each do |key, value|
                                  key = key.to_s
                                  case value
                      Severity: Minor
                      Found in lib/appsignal/utils/data.rb - About 1 hr to fix

                        Method parse_arguments has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def parse_arguments(job)
                                args = job.fetch("args", [])
                                case job["class"]
                                when /\ASidekiq::Extensions::Delayed/
                                  safe_load(args[0], args) do |_, _, arg|
                        Severity: Minor
                        Found in lib/appsignal/hooks/sidekiq.rb - 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

                        Method call_with_appsignal_monitoring has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def call_with_appsignal_monitoring(env)
                                request     = ::Rack::Request.new(env)
                                transaction = Appsignal::Transaction.create(
                                  SecureRandom.uuid,
                                  Appsignal::Transaction::HTTP_REQUEST,
                        Severity: Minor
                        Found in lib/appsignal/integrations/grape.rb - 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

                        Method run has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                                def run(push_api_key, options) # rubocop:disable Metrics/AbcSize
                                  self.coloring = options.delete(:color) { true }
                                  $stdout.sync = true
                        
                                  puts
                        Severity: Minor
                        Found in lib/appsignal/cli/install.rb - 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

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

                                def map_array(array_value)
                                  array = Appsignal::Extension.data_array_new
                                  array_value.each do |value|
                                    case value
                                    when String
                        Severity: Minor
                        Found in lib/appsignal/utils/data.rb - About 1 hr to fix

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

                                def run(argv = ARGV)
                                  @options = {}
                                  global = global_option_parser
                                  commands = command_option_parser
                                  global.order!(argv)
                          Severity: Minor
                          Found in lib/appsignal/cli.rb - About 1 hr to fix

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

                                  def call_with_appsignal_monitoring(env)
                                    if @options[:params_method]
                                      env[:params_method] = @options[:params_method]
                                    end
                                    request = @options.fetch(:request_class, Sinatra::Request).new(env)
                            Severity: Minor
                            Found in lib/appsignal/rack/sinatra_instrumentation.rb - About 1 hr to fix

                              Method parse_arguments has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def parse_arguments(job)
                                      args = job.fetch("args", [])
                                      case job["class"]
                                      when /\ASidekiq::Extensions::Delayed/
                                        safe_load(args[0], args) do |_, _, arg|
                              Severity: Minor
                              Found in lib/appsignal/hooks/sidekiq.rb - About 1 hr to fix

                                Method write_to_environment has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def write_to_environment # rubocop:disable Metrics/AbcSize
                                      ENV["_APPSIGNAL_ACTIVE"]                       = active?.to_s
                                      ENV["_APPSIGNAL_APP_PATH"]                     = root_path.to_s
                                      ENV["_APPSIGNAL_AGENT_PATH"]                   = File.expand_path("../../../ext", __FILE__).to_s
                                      ENV["_APPSIGNAL_ENVIRONMENT"]                  = env
                                Severity: Minor
                                Found in lib/appsignal/config.rb - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language