From 9f46488805e86b1bc341ea1620b866016c2ce5ed Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Wed, 20 May 2020 14:34:42 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-0-stable-ee --- rubocop/cop/gitlab/change_timzone.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 rubocop/cop/gitlab/change_timzone.rb (limited to 'rubocop/cop/gitlab/change_timzone.rb') diff --git a/rubocop/cop/gitlab/change_timzone.rb b/rubocop/cop/gitlab/change_timzone.rb new file mode 100644 index 00000000000..63e6dd411f3 --- /dev/null +++ b/rubocop/cop/gitlab/change_timzone.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module RuboCop + module Cop + module Gitlab + class ChangeTimezone < RuboCop::Cop::Cop + MSG = "Do not change timezone in the runtime (application or rspec), " \ + "it could result in silently modifying other behavior.".freeze + + 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 -- cgit v1.2.3