reevoo/sapience-rb

View on GitHub

Showing 1,401 of 1,401 total issues

Class Base has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Base
    # Class name to be logged
    attr_accessor :name, :filter, :log_hooks
    include Sapience::LogMethods

Severity: Minor
Found in lib/sapience/base.rb - About 2 hrs to fix

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

              def handle_raise
                begin
                  yield
                rescue StandardError => e
                  if e.class.name =~ %r{NotFound}

    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 has too many lines. [15/10]
    Open

              def params # rubocop:disable AbcSize
                {
                  method: request.request_method,
                  request_path: request.path,
                  format: request_format(request.env),

    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 has too many lines. [14/10]
    Open

        def extract_formatter(formatter, &block)
          if formatter.is_a?(Symbol) || formatter.is_a?(String)
            Sapience.constantize_symbol(formatter, "Sapience::Formatters").new
          elsif formatter.is_a?(Hash) && !formatter.empty?
            fmt, options = formatter.first
    Severity: Minor
    Found in lib/sapience/subscriber.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 has too many lines. [14/10]
    Open

        def log(log, message = nil, progname = nil, &block)
          # Compatibility with ::Logger
          return add(log, message, progname, &block) unless log.is_a?(Sapience::Log)
          if @@appender_thread
            @@appender_thread << lambda do
    Severity: Minor
    Found in lib/sapience/logger.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 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 has too many lines. [13/10]
    Open

      def started_request_message(request) # rubocop:disable AbcSize
        {
          message: "Started #{request.request_method} #{request.filtered_path}",
          method:  request.request_method,
          path:    request.filtered_path,

    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 has too many lines. [13/10]
    Open

              def call!(env)
                @env = env
                before
    
                handle_raise do

    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 has too many lines. [13/10]
    Open

            def request(payload) # rubocop:disable AbcSize
              {
                method: payload[:method].upcase,
                request_path: request_path(payload),
                format: format(payload),

    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 has too many lines. [13/10]
    Open

        def self.flush # rubocop:disable AbcSize
          return unless appender_thread
          appender_thread << lambda do
            Sapience.appenders.each do |appender|
              next unless appender.valid?
    Severity: Minor
    Found in lib/sapience/logger.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 has too many lines. [12/10]
    Open

      def change
        create_table :posts do |t|
          t.string :title
          t.string :body
          t.belongs_to :author, foreign_key: {

    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 has too many lines. [12/10]
    Open

            def record(event) # rubocop:disable AbcSize, CyclomaticComplexity, PerceivedComplexity
              return unless record?
    
              payload = event.payload
              name    = payload[:name]

    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 has too many lines. [12/10]
    Open

          def self.included(base)
            base.class_eval do
              # Map :unknown to :error
              alias_method :unknown, :error # :nodoc:
              alias_method :unknown?, :error? # :nodoc:

    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 has too many lines. [12/10]
    Open

      def _deep_transform_keyz_in_object!(object, &block)
        case object
        when Hash
          object.keys.each do |key|
            value = object.delete(key)
    Severity: Minor
    Found in lib/sapience/core_ext/hash.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 has too many lines. [12/10]
    Open

      def self.environment
        @@environment ||=
          ENV.fetch(SAPIENCE_ENV) do
            ENV.fetch(RAILS_ENV) do
              ENV.fetch(RACK_ENV) do
    Severity: Minor
    Found in lib/sapience/sapience.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 has too many lines. [12/10]
    Open

        def self.close
          return unless appender_thread
          appender_thread << lambda do
            Sapience.appenders.each do |appender|
              next unless appender.valid?
    Severity: Minor
    Found in lib/sapience/logger.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 has too many lines. [12/10]
    Open

        def initialize(klass, level = nil, filter = nil, log_hooks = [])
          # Support filtering all messages to this logger using a Regular Expression
          # or Proc
          fail ArgumentError, ":filter must be a Regexp or Proc" unless filter.nil? || filter.is_a?(Regexp) || filter.is_a?(Proc)
    
    
    Severity: Minor
    Found in lib/sapience/base.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 has too many lines. [11/10]
    Open

      def stop_child # rubocop:disable AbcSize
        puts "Trying to stop #{start_command}, pid: #{worker_pid}"
    
        # send TERM and wait for exit
        Process.kill("TERM", worker_pid)

    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 has too many lines. [11/10]
    Open

            def exception(payload)
              if payload[:exception]
                exception, message = payload[:exception]
                message ||= exception.message
                status = ActionDispatch::ExceptionWrapper.status_code_for_exception(exception)

    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 has too many lines. [11/10]
    Open

        def level_to_index(level)
          return if level.nil?
    
          case level
          when Symbol
    Severity: Minor
    Found in lib/sapience/configuration.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.

    Severity
    Category
    Status
    Source
    Language