diff options
author | winh <winnie@gitlab.com> | 2017-08-08 09:19:44 +0200 |
---|---|---|
committer | winh <winnie@gitlab.com> | 2017-08-08 10:36:21 +0200 |
commit | b3537000aaf3bf0de98adec938bd19e97bf8b3d6 (patch) | |
tree | 50efb38e9c719771c3626e08a6f12c18b0c88c24 /lib/haml_lint/inline_javascript.rb | |
parent | 28299de189c4c1e9c900d68f98ecfac993cb0aed (diff) | |
download | gitlab-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.rb | 20 |
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 |