Skip to content

Commit

Permalink
Add ERB lint checks using erb-formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Oct 25, 2023
1 parent 8351058 commit bb8dde3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
10 changes: 9 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,17 @@ jobs:
- checkout
- run: 'bundle install'
- run:
name: Check with rubocop
name: Check Ruby
command: |
bundle exec rubocop --parallel --format junit --out "$PWD/test-results/rubocop-results.xml" --format progress
- run:
name: Check ERB
command: |
# enable recursive globbing with "**"
shopt -s globstar
# we're only interested in errors
bundle exec erb-format **/*.html.erb > /dev/null
- run:
name: Check JavaScript
command: |
Expand Down
6 changes: 6 additions & 0 deletions .format-erb-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sandbox/**
tmp/**
**/generators/**

# this file is using tail `if` checks which are not supported by erb-formatter
backend/app/views/spree/admin/shared/_product_tabs.html.erb
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ group :admin do
end

group :utils do
gem 'erb-formatter', require: false
gem 'pry'
gem 'launchy', require: false
gem 'rubocop', '~> 1', require: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
content_tag(:span, "0", "data-#{stimulus_id}-target": "selectedRowsCount"),
" #{t('.rows_selected')}.",
])), colspan: @columns.count - 1) %>
</div>
</tr>
</thead>
<% end %>

Expand Down
6 changes: 1 addition & 5 deletions backend/app/views/spree/admin/images/_image_row.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@
"spree/admin/shared/modal",
target: "modal-image-#{image.id}",
title: image.alt,
content: %{
<div class='align-center'>
#{image_tag(image.url(:large))}
</div>
}.html_safe
content: tag.div(image_tag(image.url(:large)), class: 'align-center')
) %>
</td>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</tr>
<% end %>
</table>
<p>
<p></p>
</td>
<td class="expander"></td>
</tr>
Expand Down

0 comments on commit bb8dde3

Please sign in to comment.