Introduce erb-lint for linting erb files
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 6 Mar 2019 10:30:40 +0000 (11:30 +0100)
committerTom Hughes <tom@compton.nu>
Tue, 26 Mar 2019 20:52:43 +0000 (20:52 +0000)
This also allows running rubocop on the ruby code within the erb
files.

.erb-lint.yml [new file with mode: 0644]
Gemfile
Gemfile.lock

diff --git a/.erb-lint.yml b/.erb-lint.yml
new file mode 100644 (file)
index 0000000..bc722c2
--- /dev/null
@@ -0,0 +1,55 @@
+---
+linters:
+  SelfClosingTag:
+    enabled: false
+  SpaceInHtmlTag:
+    enabled: false # TODO
+  Rubocop:
+    enabled: true
+    rubocop_config:
+      inherit_from:
+        - .rubocop.yml
+      Layout/InitialIndentation:
+        Enabled: false
+      Layout/TrailingBlankLines:
+        Enabled: false
+      Layout/TrailingWhitespace:
+        Enabled: false
+      Naming/FileName:
+        Enabled: false
+      Style/FrozenStringLiteralComment:
+        Enabled: false
+      Metrics/LineLength:
+        Enabled: false
+      Lint/UselessAssignment:
+        Enabled: false
+      Rails/OutputSafety:
+        Enabled: false
+      Style/StringLiterals:
+        Enabled: false # TODO
+      Style/BracesAroundHashParameters:
+        Enabled: false # TODO
+      Rails/DynamicFindBy:
+        Enabled: false # TODO
+      Style/AndOr:
+        Enabled: false # TODO
+      Style/WordArray:
+        Enabled: false # TODO
+      Style/MethodCallWithoutArgsParentheses:
+        Enabled: false # TODO
+      Layout/LeadingBlankLines:
+        Enabled: false # TODO
+      Style/NestedParenthesizedCalls:
+        Enabled: false # TODO
+      Rails/LinkToBlank:
+        Enabled: false # TODO
+      Style/HashSyntax:
+        Enabled: false # TODO
+      Style/SymbolProc:
+        Enabled: false # TODO
+      Style/Not:
+        Enabled: false # TODO
+      Style/NegatedIf:
+        Enabled: false # TODO
+      Style/ConditionalAssignment:
+        Enabled: false # TODO
diff --git a/Gemfile b/Gemfile
index 83f298101fcd38c2459a8ce25087333864c376d7..b0b5f495019d7f5be2ffe6713a95ce822528032b 100644 (file)
--- a/Gemfile
+++ b/Gemfile
@@ -144,6 +144,7 @@ end
 group :development, :test do
   gem "capybara", "~> 2.13"
   gem "coveralls", :require => false
+  gem "erb_lint", :require => false
   gem "factory_bot_rails"
   gem "jshint"
   gem "poltergeist"
index 57feba1fd0c4623ab2f34d99ed4f3f4c5d2ea0e3..e52ed910e24e84c52fb04c0a2a4ee23aca457212 100644 (file)
@@ -64,6 +64,14 @@ GEM
       coderay (>= 1.0.0)
       erubi (>= 1.0.0)
       rack (>= 0.9.0)
+    better_html (1.0.11)
+      actionview (>= 4.0)
+      activesupport (>= 4.0)
+      ast (~> 2.0)
+      erubi (~> 1.4)
+      html_tokenizer (~> 0.0.6)
+      parser (>= 2.4)
+      smart_properties
     bigdecimal (1.1.0)
     binding_of_caller (0.8.0)
       debug_inspector (>= 0.0.1)
@@ -145,6 +153,13 @@ GEM
       dry-logic (~> 0.5, >= 0.5.0)
       dry-types (~> 0.14, >= 0.14)
     dynamic_form (1.1.4)
+    erb_lint (0.0.28)
+      activesupport
+      better_html (~> 1.0.7)
+      html_tokenizer
+      rainbow
+      rubocop (~> 0.51)
+      smart_properties
     erubi (1.8.0)
     execjs (2.7.0)
     exifr (1.3.6)
@@ -165,6 +180,7 @@ GEM
       activesupport (>= 4.2.0)
     hashdiff (0.3.8)
     hashie (3.6.0)
+    html_tokenizer (0.0.7)
     htmlentities (4.3.4)
     http_accept_language (2.0.5)
     i18n (0.9.5)
@@ -381,6 +397,7 @@ GEM
       json (>= 1.8, < 3)
       simplecov-html (~> 0.10.0)
     simplecov-html (0.10.2)
+    smart_properties (1.13.1)
     sprockets (3.7.2)
       concurrent-ruby (~> 1.0)
       rack (> 1, < 3)
@@ -443,6 +460,7 @@ DEPENDENCIES
   dalli
   delayed_job_active_record
   dynamic_form
+  erb_lint
   factory_bot_rails
   fakefs
   faraday