reevoo/sapience-rb

View on GitHub

Showing 1,401 of 1,401 total issues

Line is too long. [116/80]
Open

      #   Sapience.metrics.event('article-published', "article #123", {namespaced_keys: [:title, :aggregation_key]})
Severity: Minor
Found in lib/sapience/metrics/datadog.rb by rubocop

Prefer single-quoted strings inside interpolations.
Open

      "Unknown appender '#{appender_class}'. Supported appenders are (#{known_appenders.join(", ")})"
Severity: Minor
Found in lib/sapience/sapience.rb by rubocop

This cop checks that quotes inside the string interpolation match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
result = "Tests #{success ? "PASS" : "FAIL"}"

# good
result = "Tests #{success ? 'PASS' : 'FAIL'}"

Example: EnforcedStyle: double_quotes

# bad
result = "Tests #{success ? 'PASS' : 'FAIL'}"

# good
result = "Tests #{success ? "PASS" : "FAIL"}"

Line is too long. [96/80]
Open

      #     {namespace_prefix: 'custom_namespace',  namespaced_keys: [:title, :aggregation_key]}
Severity: Minor
Found in lib/sapience/metrics/datadog.rb by rubocop

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

require "sapience/rails/railtie"
Severity: Minor
Found in lib/sapience/rails.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Line is too long. [97/80]
Open

      VALIDATION_MESSAGE = "Statsd only supports udp. Example: '#{Sapience::DEFAULT_STATSD_URL}'"
Severity: Minor
Found in lib/sapience/metrics/datadog.rb by rubocop

Add an empty line after magic comments.
Open

require "json"
Severity: Minor
Found in lib/sapience/formatters/json.rb by rubocop

Checks for a newline after the final magic comment.

Example:

# good
# frozen_string_literal: true

# Some documentation for Person
class Person
  # Some code
end

# bad
# frozen_string_literal: true
# Some documentation for Person
class Person
  # Some code
end

Avoid comma after the last item of a hash.
Open

          tags: @tags,
Severity: Minor
Found in lib/sapience/metrics/datadog.rb by rubocop

This cop checks for trailing comma in array and hash literals.

Example: EnforcedStyleForMultiline: consistent_comma

# bad
a = [1, 2,]

# good
a = [
  1, 2,
  3,
]

# good
a = [
  1,
  2,
]

Example: EnforcedStyleForMultiline: comma

# bad
a = [1, 2,]

# good
a = [
  1,
  2,
]

Example: EnforcedStyleForMultiline: no_comma (default)

# bad
a = [1, 2,]

# good
a = [
  1,
  2
]

Line is too long. [111/80]
Open

            $stderr.write("Appender thread: Failed to flush to appender: #{appender.inspect}\n #{exc.inspect}")
Severity: Minor
Found in lib/sapience/logger.rb by rubocop

Line is too long. [88/80]
Open

        fail(ArgumentError, "Unknown options: #{options.inspect}") unless options.empty?
Severity: Minor
Found in lib/sapience/formatters/base.rb by rubocop

Line is too long. [97/80]
Open

      def call(log, _logger) # rubocop:disable AbcSize, PerceivedComplexity, CyclomaticComplexity
Severity: Minor
Found in lib/sapience/formatters/color.rb by rubocop

Line is too long. [119/80]
Open

          message += " -- Exception: #{colors::BOLD}#{log.exception.class}: #{log.exception.message}#{colors::CLEAR}\n"
Severity: Minor
Found in lib/sapience/formatters/color.rb by rubocop

Always use raise to signal exceptions.
Open

      fail "Failed to start Appender Thread" unless @@appender_thread
Severity: Minor
Found in lib/sapience/logger.rb by rubocop

This cop checks for uses of fail and raise.

Example: EnforcedStyle: only_raise (default)

# The `only_raise` style enforces the sole use of `raise`.
# bad
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  # handle it
end

Kernel.fail

# good
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  raise
rescue Exception
  # handle it
end

Kernel.raise

Example: EnforcedStyle: only_fail

# The `only_fail` style enforces the sole use of `fail`.
# bad
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  raise
rescue Exception
  # handle it
end

Kernel.raise

# good
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  # handle it
end

Kernel.fail

Example: EnforcedStyle: semantic

# The `semantic` style enforces the use of `fail` to signal an
# exception, then will use `raise` to trigger an offense after
# it has been rescued.
# bad
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  # Error thrown
rescue Exception
  fail
end

Kernel.fail
Kernel.raise

# good
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  raise 'Preferably with descriptive message'
end

explicit_receiver.fail
explicit_receiver.raise

Line is too long. [83/80]
Open

#   config.default_level     = ENV.fetch('SAPIENCE_DEFAULT_LEVEL') { :info }.to_sym
Severity: Minor
Found in lib/sapience/sapience.rb by rubocop

Line is too long. [116/80]
Open

    fail AppNameMissing, "app_name is not configured. See documentation for more information" unless config.app_name
Severity: Minor
Found in lib/sapience/sapience.rb by rubocop

Always use raise to signal exceptions.
Open

    fail MissingConfiguration, "No #{namespace_string} configured" unless config_section
Severity: Minor
Found in lib/sapience/sapience.rb by rubocop

This cop checks for uses of fail and raise.

Example: EnforcedStyle: only_raise (default)

# The `only_raise` style enforces the sole use of `raise`.
# bad
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  # handle it
end

Kernel.fail

# good
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  raise
rescue Exception
  # handle it
end

Kernel.raise

Example: EnforcedStyle: only_fail

# The `only_fail` style enforces the sole use of `fail`.
# bad
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  raise
rescue Exception
  # handle it
end

Kernel.raise

# good
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  # handle it
end

Kernel.fail

Example: EnforcedStyle: semantic

# The `semantic` style enforces the use of `fail` to signal an
# exception, then will use `raise` to trigger an offense after
# it has been rescued.
# bad
begin
  raise
rescue Exception
  # handle it
end

def watch_out
  # Error thrown
rescue Exception
  fail
end

Kernel.fail
Kernel.raise

# good
begin
  fail
rescue Exception
  # handle it
end

def watch_out
  fail
rescue Exception
  raise 'Preferably with descriptive message'
end

explicit_receiver.fail
explicit_receiver.raise

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

  DEFAULT_ENV             = "default"
Severity: Minor
Found in lib/sapience/sapience.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

    fail ArgumentError, "options should be a hash" unless options.is_a?(Hash)
Severity: Minor
Found in lib/sapience/sapience.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Line is too long. [87/80]
Open

      Sapience.capture_exception(payload, message: message) if payload.is_a?(Exception)
Severity: Minor
Found in lib/sapience/log_methods.rb by rubocop

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

        increment("error", add_tags(module_name, action, opts))
Severity: Minor
Found in lib/sapience/metrics/datadog.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Line is too long. [104/80]
Open

        message += " " + log.tags.collect { |tag| "[#{tag}]" }.join(" ") if log.tags && !log.tags.empty?
Severity: Minor
Found in lib/sapience/formatters/default.rb by rubocop
Severity
Category
Status
Source
Language