debian-mirror-gitlab/rubocop/cop/gitlab/change_timezone.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
517 B
Ruby
Raw Normal View History

2020-05-24 23:13:21 +05:30
# frozen_string_literal: true
module RuboCop
module Cop
module Gitlab
2022-10-11 01:57:18 +05:30
class ChangeTimezone < RuboCop::Cop::Base
2020-05-24 23:13:21 +05:30
MSG = "Do not change timezone in the runtime (application or rspec), " \
2021-04-29 21:17:54 +05:30
"it could result in silently modifying other behavior."
2020-05-24 23:13:21 +05:30
def_node_matcher :changing_timezone?, <<~PATTERN
(send (const nil? :Time) :zone= ...)
PATTERN
def on_send(node)
changing_timezone?(node) { add_offense(node) }
end
end
end
end
end