reevoo/sapience-rb

View on GitHub

Showing 1,401 of 1,401 total issues

Line is too long. [85/80]
Open

  #   logger.debug("Login time", user: 'Joe', duration: 100, ip_address: '127.0.0.1')
Severity: Minor
Found in lib/sapience/sapience.rb by rubocop

Line is too long. [93/80]
Open

    warn "appender #{appender} with (#{options.inspect}) is not valid" unless appender.valid?
Severity: Minor
Found in lib/sapience/sapience.rb by rubocop

Always use raise to signal exceptions.
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

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

Add an empty line after magic comments.
Open

module Sapience
Severity: Minor
Found in lib/sapience/log_methods.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

Line is too long. [113/80]
Open

      #   Sapience.metrics.event('article-published', "article #123", {aggregation_key: 'custom_aggregation_key')
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/raw.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

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

          ""
Severity: Minor
Found in lib/sapience/formatters/base.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"

Extra empty line detected at module body end.
Open


end
Severity: Minor
Found in lib/sapience/ansi_colors.rb by rubocop

This cops checks if empty lines around the bodies of modules match the configuration.

Example: EnforcedStyle: empty_lines

# good

module Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

module Foo
  module Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
module Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

module Foo
  def bar
    # ...
  end
end

Line is too long. [83/80]
Open

    # Returns [Sapience::Formatters::Default] formatter default for this subscriber
Severity: Minor
Found in lib/sapience/base.rb by rubocop

Always use raise to signal exceptions.
Open

          fail exception
Severity: Minor
Found in lib/sapience/base.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. [85/80]
Open

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

Always use raise to signal exceptions.
Open

    fail Sapience::TestException, "Sapience Test Exception"
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

Line is too long. [119/80]
Open

      #   (to override default based on `title`, only applies when :aggregation_key includes in namespaced_keys option)
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

        increment("exception", 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. [112/80]
Open

      attr_accessor :time_format, :default_time_format, :precision, :log_host, :log_application, :exclude_fields
Severity: Minor
Found in lib/sapience/formatters/base.rb by rubocop

Line is too long. [90/80]
Open

        message += "#{level_color}#{log.level_to_s}#{colors::CLEAR} [#{log.process_info}]"
Severity: Minor
Found in lib/sapience/formatters/color.rb by rubocop

Line is too long. [102/80]
Open

                       payload.ai(@ai_options) rescue payload.inspect # rubocop:disable RescueModifier
Severity: Minor
Found in lib/sapience/formatters/color.rb by rubocop

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

        message += " " + log.tags.collect { |tag| "[#{level_color}#{tag}#{colors::CLEAR}]" }.join(" ") if log.tags && !log.tags.empty? # rubocop:disable LineLength
Severity: Minor
Found in lib/sapience/formatters/color.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"

Use a guard clause instead of wrapping the code inside a conditional expression.
Open

      if @@appender_thread
Severity: Minor
Found in lib/sapience/logger.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something
  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

Line is too long. [81/80]
Open

    # Note: This level is only for this particular instance. It does not override
Severity: Minor
Found in lib/sapience/base.rb by rubocop
Severity
Category
Status
Source
Language