Skip to content

Commit 247bad8

Browse files
committed
setting up ERB linting (ACTION WILL NOT PASS)
1 parent 67321e8 commit 247bad8

6 files changed

Lines changed: 66 additions & 1 deletion

File tree

.better-html.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://github.com/Shopify/better-html#configuration
2+
3+
allow_single_quoted_attributes: false

.erb_lint.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# configuration reference: https://github.com/Shopify/erb_lint?tab=readme-ov-file#configuration
2+
3+
EnableDefaultLinters: false
4+
5+
exclude:
6+
- 'config/**/*'
7+
- 'db/**/*'
8+
- 'scripts/**/*'
9+
- 'bin/**/*'
10+
- 'lib/namespaced_env_cache.rb'
11+
- 'vendor/bundle/**/*'
12+
glob: '**/*.{html,text,js}{+*,}.erb'
13+
14+
linters:
15+
ErbSafety:
16+
enabled: true
17+
better_html_config: .better-html.yml
18+
Rubocop:
19+
enabled: true
20+
rubocop_config:
21+
inherit_from:
22+
- .rubocop.yml

.github/workflows/ci-cd.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@ env:
1212
RAILS_ENV: test
1313

1414
jobs:
15+
erb_lint:
16+
name: ERB checking
17+
runs-on: ubuntu-latest
18+
19+
strategy:
20+
matrix:
21+
ruby_version: [3.1, 3.2]
22+
23+
steps:
24+
- name: Checkout repo
25+
uses: actions/checkout@v3
26+
- name: Setup dependencies
27+
run: |
28+
sudo apt-get update -qq
29+
sudo apt-get install -yqq libmagickwand-dev
30+
- name: Setup Ruby
31+
uses: ruby/setup-ruby@v1
32+
with:
33+
ruby-version: ${{ matrix.ruby_version }}
34+
bundler-cache: true
35+
- run: bundle exec erb_lint --lint-all
36+
1537
rubocop:
1638
name: Rubocop checking
1739
runs-on: ubuntu-latest
@@ -118,6 +140,7 @@ jobs:
118140
runs-on: ubuntu-latest
119141
if: ${{ github.event_name == 'push' && github.actor != 'dependabot[bot]' }}
120142
needs:
143+
- erb_lint
121144
- rubocop
122145
- typescript
123146
- tests

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ gem 'whenever', '~> 1.0', require: false
5151

5252
# Debugging, linting, testing.
5353
gem 'awesome_print', '~> 1.9'
54+
gem 'erb_lint', '~> 0.9.0'
5455
gem 'rubocop', '~> 1'
5556
gem 'rubocop-rails', '~> 2.15'
5657
gem 'rubocop-rake', '~> 0.7.1'

Gemfile.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,13 @@ GEM
105105
base64 (0.3.0)
106106
bcrypt (3.1.20)
107107
benchmark (0.4.1)
108+
better_html (2.1.1)
109+
actionview (>= 6.0)
110+
activesupport (>= 6.0)
111+
ast (~> 2.0)
112+
erubi (~> 1.4)
113+
parser (>= 2.4)
114+
smart_properties
108115
bigdecimal (3.2.2)
109116
bindex (0.8.1)
110117
builder (3.3.0)
@@ -157,6 +164,13 @@ GEM
157164
e2mmap (0.1.0)
158165
erb (4.0.4)
159166
cgi (>= 0.3.3)
167+
erb_lint (0.9.0)
168+
activesupport
169+
better_html (>= 2.0.1)
170+
parser (>= 2.7.1.4)
171+
rainbow
172+
rubocop (>= 1)
173+
smart_properties
160174
erubi (1.13.1)
161175
execjs (2.10.0)
162176
fastimage (2.4.0)
@@ -405,6 +419,7 @@ GEM
405419
simplecov_json_formatter (~> 0.1)
406420
simplecov-html (0.13.1)
407421
simplecov_json_formatter (0.1.4)
422+
smart_properties (1.17.0)
408423
spring (4.3.0)
409424
sprockets (4.1.1)
410425
concurrent-ruby (~> 1.0)
@@ -483,6 +498,7 @@ DEPENDENCIES
483498
devise_saml_authenticatable (~> 1.9)
484499
diffy (~> 3.4)
485500
e2mmap (~> 0.1)
501+
erb_lint (~> 0.9.0)
486502
fastimage (~> 2.2)
487503
flamegraph (~> 0.9)
488504
groupdate (~> 6.1)

app/views/admin/create_site.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
<p>Once you are ready, click on the following button:</p>
1818

19-
<a href="//<%= @new_community.host %>/admin/setup" class="button is-filled is-very-large">To new site</a>
19+
<a href="//<%= @new_community.host %>/admin/setup" class="button is-filled is-very-large">To new site</a>

0 commit comments

Comments
 (0)