reevoo/sapience-rb

View on GitHub
lib/sapience/appender/stream.rb

Summary

Maintainability
A
0 mins
Test Coverage

Extra empty line detected at class body end.
Open


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

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

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

Line is too long. [86/80]
Open

      #    RegExp: Only include log messages where the class name matches the supplied
Severity: Minor
Found in lib/sapience/appender/stream.rb by rubocop

Line is too long. [98/80]
Open

      #    Sapience::Logger.add_appender(:stream, file_name: 'application.log', formatter: :color)
Severity: Minor
Found in lib/sapience/appender/stream.rb by rubocop

Line is too long. [87/80]
Open

      #    An instance of a class that implements #call, or a Proc to be used to format
Severity: Minor
Found in lib/sapience/appender/stream.rb by rubocop

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

      VALIDATION_MESSAGE = "stream is not writable"
Severity: Minor
Found in lib/sapience/appender/stream.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. [117/80]
Open

        fail ArgumentError, "missing mandatory argument :file_name or :io" unless options[:io] || options[:file_name]
Severity: Minor
Found in lib/sapience/appender/stream.rb by rubocop

Line is too long. [92/80]
Open

        @log      = File.open(@file_name, (::File::WRONLY | ::File::APPEND | ::File::CREAT))
Severity: Minor
Found in lib/sapience/appender/stream.rb by rubocop

Always use raise to signal exceptions.
Open

        fail ArgumentError, "missing mandatory argument :file_name or :io" unless options[:io] || options[:file_name]
Severity: Minor
Found in lib/sapience/appender/stream.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

        fail ArgumentError, "missing mandatory argument :file_name or :io" unless options[:io] || options[:file_name]
Severity: Minor
Found in lib/sapience/appender/stream.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

# Stream appender
Severity: Minor
Found in lib/sapience/appender/stream.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

Missing top-level class documentation comment.
Open

    class Stream < Sapience::Subscriber
Severity: Minor
Found in lib/sapience/appender/stream.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

There are no issues that match your filters.

Category
Status