appsignal/appsignal

View on GitHub

Showing 84 of 84 total issues

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

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

              def send_report_to_appsignal?(options)
                puts "\nDiagnostics report"
                puts "  Do you want to send this diagnostics report to AppSignal?"
                puts "  If you share this report you will be given a link to \n" \
                  "  AppSignal.com to validate the report.\n" \
      Severity: Minor
      Found in lib/appsignal/cli/diagnose.rb - About 1 hr to fix

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

                def configure_rails_app_name(config)
                  loaded =
                    begin
                      load Appsignal::Utils::RailsHelper.application_config_path
                      true
        Severity: Minor
        Found in lib/appsignal/cli/install.rb - About 1 hr to fix

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

                def patch_perform_action
                  ActionCable::Channel::Base.class_eval do
                    alias_method :original_perform_action, :perform_action
          
                    def perform_action(*args, &block)
          Severity: Minor
          Found in lib/appsignal/hooks/action_cable.rb - About 1 hr to fix

            Method http_client has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def http_client
                  client =
                    if config[:http_proxy]
                      Net::HTTP.new(uri.host, uri.port, proxy_addr, proxy_port)
                    else
            Severity: Minor
            Found in lib/appsignal/transmitter.rb - About 55 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

            Method get_payload_action has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              def get_payload_action(request)
                # Short-circut is there's no request object to obtain information from
                return settings.name.to_s unless request
            
                # Newer versions expose the action / controller on the request class.
            Severity: Minor
            Found in lib/appsignal/integrations/padrino.rb - About 55 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

            Method http_queue_start has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def http_queue_start
                  env = environment
                  return unless env
                  env_var = env["HTTP_X_QUEUE_START".freeze] || env["HTTP_X_REQUEST_START".freeze]
                  return unless env_var
            Severity: Minor
            Found in lib/appsignal/transaction.rb - About 55 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

            Method path_stat has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                    def path_stat(path)
                      {
                        :path => path,
                        :exists => File.exist?(path)
                      }.tap do |info|
            Severity: Minor
            Found in lib/appsignal/cli/diagnose/paths.rb - About 55 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

            Method installed_frameworks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                    def installed_frameworks
                      [].tap do |out|
                        if framework_available?("rails") &&
                            File.exist?(Appsignal::Utils::RailsHelper.application_config_path)
                          out << :rails
            Severity: Minor
            Found in lib/appsignal/cli/install.rb - About 55 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

            Method set_sample_data has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def set_sample_data(key, data)
                  return unless key && data && (data.is_a?(Array) || data.is_a?(Hash))
                  @ext.set_sample_data(
                    key.to_s,
                    Appsignal::Utils::Data.generate(data)
            Severity: Minor
            Found in lib/appsignal/transaction.rb - About 45 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

            Method call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def call
                    puma_stats = fetch_puma_stats
                    return unless puma_stats
            
                    stats = JSON.parse puma_stats, :symbolize_names => true
            Severity: Minor
            Found in lib/appsignal/hooks/puma.rb - About 45 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

            Method record_event has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def record_event(name, title, body, body_format, duration, gc_duration_ms) # rubocop:disable Metrics/ParameterLists
            Severity: Minor
            Found in lib/appsignal/extension/jruby.rb - About 45 mins to fix

              Method agent_platform has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.agent_platform
                    return MUSL_TARGET if force_musl_build?
              
                    host_os = RbConfig::CONFIG["host_os"].downcase
                    local_os =
              Severity: Minor
              Found in lib/appsignal/system.rb - About 45 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

              Method extract_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def self.extract_value(object_or_hash, field, default_value = nil, convert_to_s = false)
                      value = nil
              
                      # Attempt to read value from hash
                      if object_or_hash.respond_to?(:[])
              Severity: Minor
              Found in lib/appsignal/integrations/delayed_job_plugin.rb - About 45 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

              Method set_error has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def set_error(error)
                    unless error.is_a?(Exception)
                      Appsignal.logger.error "Appsignal::Transaction#set_error: Cannot set error. " \
                        "The given value is not an exception: #{error.inspect}"
                      return
              Severity: Minor
              Found in lib/appsignal/transaction.rb - About 45 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

              Method call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                    def call(env)
                      # Ignore other paths than the error catching path.
                      return @app.call(env) unless error_cathing_endpoint?(env)
              
                      # Prevent raising a 404 not found when a non-active environment posts
              Severity: Minor
              Found in lib/appsignal/rack/js_exception_catcher.rb - About 45 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

              Method run has a Cognitive Complexity of 8 (exceeds 5 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 45 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

              Method record_event has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def record_event(name, title, body, duration, body_format = Appsignal::EventFormatter::DEFAULT)
              Severity: Minor
              Found in lib/appsignal/transaction.rb - About 35 mins to fix

                Method finish_event has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        def finish_event(name, title, body, body_format, gc_duration_ms)
                Severity: Minor
                Found in lib/appsignal/extension/jruby.rb - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language