diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-24 15:09:37 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-24 15:09:37 +0000 |
commit | 8a840df2e433bc39d033b20e64402fa3f56445d3 (patch) | |
tree | 92a941d06b5ddd3ad3f7ad846bf83f0c33d57dbb /rubocop | |
parent | 5c8c561ac63d7b8f372316b4409500474220fcda (diff) | |
download | gitlab-ce-8a840df2e433bc39d033b20e64402fa3f56445d3.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'rubocop')
-rw-r--r-- | rubocop/cop/gitlab/change_timzone.rb | 20 |
1 files changed, 20 insertions, 0 deletions
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 |