Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bennett <lbennett@gitlab.com>2019-04-14 01:14:27 +0300
committerLuke Bennett <lbennett@gitlab.com>2019-04-14 01:14:27 +0300
commit95f522a159800997ee94b0f98c9fdefe78572140 (patch)
tree6ee2b1544926fdada94c594fb99a4e03e3584818
parent44be329d59bc20598c2c2f310d4f3029c8dd25a9 (diff)
-rw-r--r--.haml-lint.yml6
-rw-r--r--unwrapped_plain_node.rb18
2 files changed, 24 insertions, 0 deletions
diff --git a/.haml-lint.yml b/.haml-lint.yml
index bad918ef35d..dcd64eab561 100644
--- a/.haml-lint.yml
+++ b/.haml-lint.yml
@@ -5,7 +5,13 @@ exclude:
- 'vendor/**/*'
- 'spec/**/*'
+require:
+ - './unwrapped_plain_node.rb'
+
linters:
+ UnwrappedPlainNode:
+ enabled: true
+
AltText:
enabled: true
diff --git a/unwrapped_plain_node.rb b/unwrapped_plain_node.rb
new file mode 100644
index 00000000000..9525e830304
--- /dev/null
+++ b/unwrapped_plain_node.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module HamlLint
+ # Checks for unwrapped text nodes.
+ # Useful for i18n helper methods.
+ #
+ # Fail: %tag Some text
+ # Pass: %tag= _('Some text')
+ class Linter::UnwrappedPlainNode < Linter
+ include LinterRegistry
+
+ MESSAGE = '`= "..."` should be rewritten as `...`'.freeze
+
+ def visit_plain(node)
+ record_lint(node, MESSAGE)
+ end
+ end
+end