reevoo/sapience-rb

View on GitHub

Showing 1,401 of 1,401 total issues

Avoid comma after the last item of a hash.
Open

      fatal: RED,
Severity: Minor
Found in lib/sapience/ansi_colors.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
]

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

    SELF_PATTERN = File.join("lib", "sapience")
Severity: Minor
Found in lib/sapience/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"

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

          message += " -- " + payload
Severity: Minor
Found in lib/sapience/formatters/default.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. [106/80]
Open

  #       :bugsnag, :elasticsearch, :graylog, :http, :mongodb, :new_relic, :splunk_http, :syslog, :wrapper
Severity: Minor
Found in lib/sapience/sapience.rb by rubocop

Line is too long. [101/80]
Open

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

Line is too long. [84/80]
Open

    @@appenders.each { |appender| appender.reopen if appender.respond_to?(:reopen) }
Severity: Minor
Found in lib/sapience/sapience.rb by rubocop

Line is too long. [84/80]
Open

    def log_with_level(level, message = nil, payload = nil, exception = nil, &block)
Severity: Minor
Found in lib/sapience/log_methods.rb by rubocop

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

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

require "sapience/extensions/sinatra/middleware/logging"
Severity: Minor
Found in lib/sapience/sinatra.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"

Add an empty line after magic comments.
Open

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

      fail "Failed to start Appender Thread" unless @@appender_thread
Severity: Minor
Found in lib/sapience/logger.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"

Add an empty line after magic comments.
Open

require "uri"
Severity: Minor
Found in lib/sapience/metrics/datadog.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. [92/80]
Open

  def self.add_appender(appender_class_name, options = {}, _deprecated_level = nil, &_block)
Severity: Minor
Found in lib/sapience/sapience.rb by rubocop

Line is too long. [114/80]
Open

      # @option opts [Array] :namespaced_keys the keys we want to be namespaced. Valid: :title or :aggregation_key
Severity: Minor
Found in lib/sapience/metrics/datadog.rb by rubocop

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

    if namespace.descendants.include?(klass)
Severity: Minor
Found in lib/sapience/sapience.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

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

source "https://rubygems.org"
Severity: Minor
Found in Gemfile 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. [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

        @uri.scheme == "udp"
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. [109/80]
Open

        @exclude_fields  = options.key?(:exclude_fields) ? options.delete(:exclude_fields).map(&:to_sym) : {}
Severity: Minor
Found in lib/sapience/formatters/base.rb by rubocop

Extra blank line detected.
Open


        message = time_format.nil? ? "" : "#{format_time(log.time)} "
Severity: Minor
Found in lib/sapience/formatters/color.rb by rubocop

This cops checks for two or more consecutive blank lines.

Example:

# bad - It has two empty lines.
some_method
# one empty line
# two empty lines
some_method

# good
some_method
# one empty line
some_method
Severity
Category
Status
Source
Language