blob: 81717cc3c709853a37a1b95342ca4c41dbc1d205 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# frozen_string_literal: true
module RuboCop
module Cop
module Jekyll
class NoPutsAllowed < Base
MSG = "Avoid using `puts` to print things. Use `Jekyll.logger` instead."
RESTRICT_ON_SEND = %i[puts].freeze
def_node_search :puts_called?, <<-PATTERN
(send nil? :puts _)
PATTERN
def on_send(node)
if puts_called?(node)
add_offense(node.loc.selector)
end
end
end
end
end
end
|