Sha256: d99c5c13bd19df98d247be1897b57d1960951efea3376cb051624d1857fac63d

Contents?: true

Size: 570 Bytes

Versions: 5

Compression:

Stored size: 570 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    module Rails
      # This cop checks for the use of output calls like puts and print
      class Output < Cop
        MSG = 'Do not write to stdout. ' \
              "Use Rails's logger if you want to log.".freeze

        def_node_matcher :output?, <<-PATTERN
          (send nil {:ap :p :pp :pretty_print :print :puts} ...)
        PATTERN

        def on_send(node)
          return unless output?(node) && node.arguments?

          add_offense(node, :selector)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rubocop-0.50.0 lib/rubocop/cop/rails/output.rb
rubocop-0.49.1 lib/rubocop/cop/rails/output.rb
rubocop-0.49.0 lib/rubocop/cop/rails/output.rb
rubocop-0.48.1 lib/rubocop/cop/rails/output.rb
rubocop-0.48.0 lib/rubocop/cop/rails/output.rb