lib/sapience/log_methods.rb
Method log_with_level
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def log_with_level(level, message = nil, payload = nil, exception = nil, &block)
Method log_with_exception
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def log_with_exception(level, message = nil, payload = nil, exception = nil, &block)
Add an empty line after magic comments. Open
Open
module Sapience
- Read upRead up
- Exclude checks
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
Convert if
nested inside else
to elsif
. Open
Open
yield params if block
- Read upRead up
- Exclude checks
If the else
branch of a conditional consists solely of an if
node,
it can be combined with the else
to become an elsif
.
This helps to keep the nesting level from getting too deep.
Example:
# bad
if condition_a
action_a
else
if condition_b
action_b
else
action_c
end
end
# good
if condition_a
action_a
elsif condition_b
action_b
else
action_c
end
Line is too long. [84/80] Open
Open
def log_with_level(level, message = nil, payload = nil, exception = nil, &block)
- Exclude checks
Line is too long. [87/80] Open
Open
Sapience.capture_exception(payload, message: message) if payload.is_a?(Exception)
- Exclude checks
Line is too long. [88/80] Open
Open
def log_with_exception(level, message = nil, payload = nil, exception = nil, &block)
- Exclude checks
Missing top-level module documentation comment. Open
Open
module LogMethods
- Read upRead up
- Exclude checks
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