reevoo/sapience-rb

View on GitHub
lib/sapience/formatters/default.rb

Summary

Maintainability
A
45 mins
Test Coverage

Method has too many lines. [14/10]
Open

      def call(log, _logger) # rubocop:disable AbcSize, PerceivedComplexity, CyclomaticComplexity
        # Date & time
        message = time_format.nil? ? "" : "#{format_time(log.time)} "

        # Log level and process info
Severity: Minor
Found in lib/sapience/formatters/default.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def call(log, _logger) # rubocop:disable AbcSize, PerceivedComplexity, CyclomaticComplexity
        # Date & time
        message = time_format.nil? ? "" : "#{format_time(log.time)} "

        # Log level and process info
Severity: Minor
Found in lib/sapience/formatters/default.rb - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

Prefer single-quoted strings when you don't need string interpolation or special symbols.
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

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

      #    2011-07-19 14:36:15.660235 D [1149:ScriptThreadProcess] Rails -- Hello World
Severity: Minor
Found in lib/sapience/formatters/default.rb by rubocop

Add an empty line after magic comments.
Open

module Sapience
Severity: Minor
Found in lib/sapience/formatters/default.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. [97/80]
Open

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

Missing top-level class documentation comment.
Open

    class Default < Base
Severity: Minor
Found in lib/sapience/formatters/default.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

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

        message = time_format.nil? ? "" : "#{format_time(log.time)} "
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. [88/80]
Open

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

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"

Prefer single-quoted strings when you don't need string interpolation or special symbols.
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

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"

There are no issues that match your filters.

Category
Status