summaryrefslogtreecommitdiff
path: root/lib/haml_lint/inline_javascript.rb
diff options
context:
space:
mode:
authorwinh <winnie@gitlab.com>2017-08-08 09:19:44 +0200
committerwinh <winnie@gitlab.com>2017-08-08 10:36:21 +0200
commitb3537000aaf3bf0de98adec938bd19e97bf8b3d6 (patch)
tree50efb38e9c719771c3626e08a6f12c18b0c88c24 /lib/haml_lint/inline_javascript.rb
parent28299de189c4c1e9c900d68f98ecfac993cb0aed (diff)
downloadgitlab-ce-b3537000aaf3bf0de98adec938bd19e97bf8b3d6.tar.gz
Restrict InlineJavaScript for haml_lint to dev and test environmentwinh-scope-haml-linter
Diffstat (limited to 'lib/haml_lint/inline_javascript.rb')
-rw-r--r--lib/haml_lint/inline_javascript.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/haml_lint/inline_javascript.rb b/lib/haml_lint/inline_javascript.rb
index f3ddcbb9c95..05668c69006 100644
--- a/lib/haml_lint/inline_javascript.rb
+++ b/lib/haml_lint/inline_javascript.rb
@@ -1,14 +1,16 @@
-require 'haml_lint/haml_visitor'
-require 'haml_lint/linter'
-require 'haml_lint/linter_registry'
+unless Rails.env.production?
+ require 'haml_lint/haml_visitor'
+ require 'haml_lint/linter'
+ require 'haml_lint/linter_registry'
-module HamlLint
- class Linter::InlineJavaScript < Linter
- include LinterRegistry
+ module HamlLint
+ class Linter::InlineJavaScript < Linter
+ include LinterRegistry
- def visit_filter(node)
- return unless node.filter_type == 'javascript'
- record_lint(node, 'Inline JavaScript is discouraged (https://docs.gitlab.com/ee/development/gotchas.html#do-not-use-inline-javascript-in-views)')
+ def visit_filter(node)
+ return unless node.filter_type == 'javascript'
+ record_lint(node, 'Inline JavaScript is discouraged (https://docs.gitlab.com/ee/development/gotchas.html#do-not-use-inline-javascript-in-views)')
+ end
end
end
end