Skip to content

Commit

Permalink
Adds erb lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bonflintstone committed Oct 31, 2024
1 parent 8bfa909 commit b0ebb2b
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 24 deletions.
26 changes: 26 additions & 0 deletions .erb_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
glob: "**/*.{html,text,js}{+*,}.erb"
exclude:
- '**/vendor/**/*'
- '**/node_modules/**/*'
linters:
Rubocop:
enabled: true
rubocop_config:
inherit_from:
- .rubocop.yml
Layout/InitialIndentation:
Enabled: false
Layout/LineLength:
Enabled: false
Layout/TrailingEmptyLines:
Enabled: false
Layout/TrailingWhitespace:
Enabled: false
Naming/FileName:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Lint/UselessAssignment:
Enabled: false
Rails/OutputSafety:
Enabled: false
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:
- name: Lint code for consistent style
run: bin/rubocop -f github

- name: Lint ERB templates
run: bundle exec erb_lint --lint-all

test:
runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ruby "3.3.5"

gem "bootsnap", require: false
gem "dotenv-rails", "~> 3.1"
gem "haml-rails", "~> 2.1"
gem "httparty", "~> 0.22.0"
gem "importmap-rails"
gem "jbuilder"
Expand All @@ -21,6 +20,7 @@ group :development, :test do
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
gem "brakeman", require: false
gem "rubocop-rails-omakase", require: false
gem "erb_lint", "~> 0.7.0"
end

group :development do
Expand Down
28 changes: 16 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ GEM
public_suffix (>= 2.0.2, < 7.0)
ast (2.4.2)
base64 (0.2.0)
better_html (2.1.1)
actionview (>= 6.0)
activesupport (>= 6.0)
ast (~> 2.0)
erubi (~> 1.4)
parser (>= 2.4)
smart_properties
bigdecimal (3.1.8)
bindex (0.8.1)
bootsnap (1.18.4)
Expand Down Expand Up @@ -104,18 +111,16 @@ GEM
dotenv (= 3.1.4)
railties (>= 6.1)
drb (2.2.1)
erb_lint (0.7.0)
activesupport
better_html (>= 2.0.1)
parser (>= 2.7.1.4)
rainbow
rubocop (>= 1)
smart_properties
erubi (1.13.0)
globalid (1.2.1)
activesupport (>= 6.1)
haml (6.3.0)
temple (>= 0.8.2)
thor
tilt
haml-rails (2.1.0)
actionpack (>= 5.1)
activesupport (>= 5.1)
haml (>= 4.0.6)
railties (>= 5.1)
httparty (0.22.0)
csv
mini_mime (>= 1.0.0)
Expand Down Expand Up @@ -267,6 +272,7 @@ GEM
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
smart_properties (1.17.0)
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
Expand All @@ -286,9 +292,7 @@ GEM
tailwindcss-ruby (3.4.14-arm64-darwin)
tailwindcss-ruby (3.4.14-x86_64-darwin)
tailwindcss-ruby (3.4.14-x86_64-linux)
temple (0.10.3)
thor (1.3.2)
tilt (2.4.0)
timeout (0.4.1)
turbo-rails (2.0.11)
actionpack (>= 6.0.0)
Expand Down Expand Up @@ -325,7 +329,7 @@ DEPENDENCIES
capybara
debug
dotenv-rails (~> 3.1)
haml-rails (~> 2.1)
erb_lint (~> 0.7.0)
httparty (~> 0.22.0)
importmap-rails
jbuilder
Expand Down
20 changes: 10 additions & 10 deletions app/views/events/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<h1 class="text-3xl font-bold">IBK Dashboard</h1>

<p class="mb-3">
Code is auf <%= link_to('Github', 'https://github.com/bonflintstone/ibk-dashboard', target: '_blank', class: 'underline') %>
<br />
Feedback and Suggestions via <%= link_to("Mail", "mailto:[email protected]", class: 'underline') %>
Code is auf <%= link_to("Github", "https://github.com/bonflintstone/ibk-dashboard", target: "_blank", class: "underline") %>
<br>
Feedback and Suggestions via <%= link_to("Mail", "mailto:[email protected]", class: "underline") %>
</p>

<p>
Expand All @@ -13,17 +13,17 @@
</p>

<div class="flex flex-wrap">
<%= link_to 'All', root_path, class: 'gap-1 rounded px-2 py-1 m-1 border' %>
<%= link_to "All", root_path, class: "gap-1 rounded px-2 py-1 m-1 border" %>
<% Event::ORGANIZATIONS_BY_TYPE.each do |type, organizations| %>
<%= link_to type, root_path(organizations:), class: 'gap-1 rounded px-2 py-1 m-1 border' %>
<%= link_to type, root_path(organizations:), class: "gap-1 rounded px-2 py-1 m-1 border" %>
<% end %>
</div>

<%= form_tag(root_path, method: 'GET', data: { controller: :form }) do |f| %>
<%= form_tag(root_path, method: "GET", data: { controller: :form }) do |f| %>
<div class="flex flex-wrap">
<% Event::ORGANIZATIONS.each do |organization| %>
<label class="flex items-center gap-1 rounded px-2 py-1 m-1 border <%= organization_color(organization) %>">
<%= check_box_tag 'organizations[]', organization, checked: @event_filter[:organizations].include?(organization), data: { action: 'form#submit' } %>
<%= check_box_tag "organizations[]", organization, checked: @event_filter[:organizations].include?(organization), data: { action: "form#submit" } %>
<%= organization %>
</label>
<% end %>
Expand All @@ -34,15 +34,15 @@
<h3 class="text-xl font-bold mt-7 mb-3"><%= l(date, format: "%A %d.%m.%Y") %></h3>

<% events.each do |event| %>
<%= link_to event.link, target: '_blank' do %>
<%= link_to event.link, target: "_blank" do %>
<div class="py-2" data-events-target="event" data-organization="<%= event.organization %>">
<p class="pl-2 py-1 <%= organization_color(event.organization) %>">
<%= event.datetime.strftime("%H:%M") %>
<span class="font-bold"><%= event.location != event.organization ? "#{event.organization}," : '' %></span>
<span class="font-bold"><%= event.location != event.organization ? "#{event.organization}," : "" %></span>
<span class="font-bold"><%= event.location %></span>
</p>
<p class="pl-1 mt-1 font-bold"><%= event.name %></p>
<p class="pl-1 mt-1"><%= event.description.truncate_words(20, omission: '...') %></p>
<p class="pl-1 mt-1"><%= event.description.truncate_words(20, omission: "...") %></p>
</div>
<% end %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<link rel="manifest" href="/manifest.json">
<link rel="apple-touch-icon" href="/icon.png">
<%= favicon_link_tag asset_path('favicon.png') %>
<%= favicon_link_tag asset_path("favicon.png") %>
<%= stylesheet_link_tag "tailwind", "inter-font", "data-turbo-track": "reload" %>
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
Expand Down

0 comments on commit b0ebb2b

Please sign in to comment.