Skip to content

Commit

Permalink
Add ERB lint gem & corresponding Rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
odlp committed Aug 4, 2020
1 parent 572dfb2 commit b882853
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
EnableDefaultLinters: true
linters:
ErbSafety:
enabled: true
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gem 'ammeter'
gem 'appraisal'
gem 'capybara'
gem 'database_cleaner'
gem "erb_lint", require: false
gem 'factory_bot_rails'
gem 'nokogiri'
gem 'pry', require: false
Expand Down
37 changes: 37 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,16 @@ GEM
argon2 (2.0.2)
ffi (~> 1.9)
ffi-compiler (>= 0.1)
ast (2.4.1)
bcrypt (3.1.15)
better_html (1.0.15)
actionview (>= 4.0)
activesupport (>= 4.0)
ast (~> 2.0)
erubi (~> 1.4)
html_tokenizer (~> 0.0.6)
parser (>= 2.4)
smart_properties
builder (3.2.4)
capybara (3.33.0)
addressable
Expand All @@ -76,6 +85,13 @@ GEM
diff-lcs (1.4.4)
email_validator (2.0.1)
activemodel
erb_lint (0.0.34)
activesupport
better_html (~> 1.0.7)
html_tokenizer
rainbow
rubocop (~> 0.79)
smart_properties
erubi (1.9.0)
factory_bot (6.1.0)
activesupport (>= 5.0.0)
Expand All @@ -88,6 +104,7 @@ GEM
rake
globalid (0.4.2)
activesupport (>= 4.2.0)
html_tokenizer (0.0.7)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
loofah (2.6.0)
Expand All @@ -101,6 +118,9 @@ GEM
minitest (5.14.1)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
parallel (1.19.2)
parser (2.7.1.4)
ast (~> 2.4.1)
pry (0.13.1)
coderay (~> 1.1)
method_source (~> 1.0)
Expand All @@ -123,8 +143,10 @@ GEM
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
rake (13.0.1)
regexp_parser (1.7.1)
rexml (3.2.4)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
Expand All @@ -142,14 +164,28 @@ GEM
rspec-mocks (~> 3.9)
rspec-support (~> 3.9)
rspec-support (3.9.3)
rubocop (0.88.0)
parallel (~> 1.10)
parser (>= 2.7.1.1)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.7)
rexml
rubocop-ast (>= 0.1.0, < 1.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.3.0)
parser (>= 2.7.1.4)
ruby-progressbar (1.10.1)
shoulda-matchers (4.3.0)
activesupport (>= 4.2.0)
smart_properties (1.15.0)
sqlite3 (1.4.2)
thor (1.0.1)
thread_safe (0.3.6)
timecop (0.9.1)
tzinfo (1.2.7)
thread_safe (~> 0.1)
unicode-display_width (1.7.0)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.4.0)
Expand All @@ -164,6 +200,7 @@ DEPENDENCIES
capybara
clearance!
database_cleaner
erb_lint
factory_bot_rails
nokogiri
pry
Expand Down
5 changes: 5 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@ RSpec::Core::RakeTask.new("spec:acceptance") do |task|
task.verbose = false
end

desc "Lint ERB templates"
task :erb_lint do
sh("bundle", "exec", "erblint", "app/views/**/*.erb")
end

desc "Run the specs and acceptance tests"
task default: %w(spec spec:acceptance)
1 change: 1 addition & 0 deletions gemfiles/rails_5.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gem "ammeter"
gem "appraisal"
gem "capybara", ">= 2.6.2", "< 3.33.0"
gem "database_cleaner"
gem "erb_lint", require: false
gem "factory_bot_rails"
gem "nokogiri"
gem "pry", require: false
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_5.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gem "ammeter"
gem "appraisal"
gem "capybara"
gem "database_cleaner"
gem "erb_lint", require: false
gem "factory_bot_rails"
gem "nokogiri"
gem "pry", require: false
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_5.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gem "ammeter"
gem "appraisal"
gem "capybara"
gem "database_cleaner"
gem "erb_lint", require: false
gem "factory_bot_rails"
gem "nokogiri"
gem "pry", require: false
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_6.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ gem "ammeter"
gem "appraisal"
gem "capybara"
gem "database_cleaner"
gem "erb_lint", require: false
gem "factory_bot_rails"
gem "nokogiri"
gem "pry", require: false
Expand Down

0 comments on commit b882853

Please sign in to comment.