Skip to content

Commit

Permalink
add erblint and run with set linters
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcwood committed Nov 5, 2020
1 parent 657eab4 commit 3702ef3
Show file tree
Hide file tree
Showing 80 changed files with 180 additions and 143 deletions.
20 changes: 20 additions & 0 deletions .erb-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
glob: "**/*.html.erb"
linters:
ErbSafety:
enabled: false
Rubocop:
enabled: false
FinalNewline:
enabled: true
RightTrim:
enabled: false
SpaceAroundErbTag:
enabled: true
NoJavascriptTagHelper:
enabled: true
correction_style: 'plain'
SelfClosingTag:
enabled: true
enforced_style: 'never'
AllowedScriptType:
enabled: false
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ group :development do
gem 'letter_opener'
# Static security testing
gem 'brakeman'
# Lint erb
gem "erb_lint", "~> 0.0.35"
end

group :test do
Expand All @@ -84,3 +86,5 @@ group :test do
# Clean up the messy database during tests
gem 'database_cleaner-active_record', '>= 1.8.0', require: false
end


19 changes: 19 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ GEM
aws-sigv4 (1.2.2)
aws-eventstream (~> 1, >= 1.0.2)
bcrypt (3.1.16)
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
bindex (0.8.1)
brakeman (4.10.0)
builder (3.2.4)
Expand Down Expand Up @@ -110,6 +118,14 @@ GEM
database_cleaner (~> 1.8.0)
diff-lcs (1.4.4)
docile (1.3.2)
erb_lint (0.0.35)
activesupport
better_html (~> 1.0.7)
html_tokenizer
parser (>= 2.7.1.4)
rainbow
rubocop (~> 0.79)
smart_properties
erubi (1.9.0)
factory_bot (6.1.0)
activesupport (>= 5.0.0)
Expand All @@ -123,6 +139,7 @@ GEM
globalid (0.4.2)
activesupport (>= 4.2.0)
hashdiff (1.0.1)
html_tokenizer (0.0.7)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
image_processing (1.12.0)
Expand Down Expand Up @@ -267,6 +284,7 @@ GEM
simplecov
terminal-table
simplecov-html (0.10.2)
smart_properties (1.15.0)
spring (2.1.1)
spring-watcher-listen (2.0.1)
listen (>= 2.7, < 4.0)
Expand Down Expand Up @@ -341,6 +359,7 @@ DEPENDENCIES
capybara (>= 2.15)
coveralls (~> 0.8.23)
database_cleaner-active_record (>= 1.8.0)
erb_lint (~> 0.0.35)
factory_bot_rails
faraday
image_processing
Expand Down
4 changes: 2 additions & 2 deletions app/views/abouts/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

<%= render partial: 'partials/contact_details', locals: { model: @about, contact_link: true } %>

<%= markdown_admin(@about.about_me)%>
</section>
<%= markdown_admin(@about.about_me) %>
</section>
6 changes: 3 additions & 3 deletions app/views/admin/abouts/_edit_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= form_with(model: [:admin, about], method: "put", class: 'section-form', id: 'admin-abouts-edit-form') do |f| %>

<%= render partial: 'partials/system_messages'%>
<%= render partial: 'partials/system_messages' %>

<%= render partial: 'layouts/images/profile_image_upload', locals: {image: about.profile_image, form: f} %>

Expand Down Expand Up @@ -41,12 +41,12 @@
<div class="embedded-form-entry-container">
<%= f.text_area(:about_me, class: 'input-box embedded-text-area', placeholder: 'Add about me text (you can use markdown)...') %>
</div>

<div class="embedded-form-entry-container submit-right">
<div class="form-submit-container">
<%= f.submit("Update About", class: 'input-submit') %>
</div>
<div class="default-loader"></div>
</div>

<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/admin/abouts/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% end %>

<div class='dashboard-item-container'>
<h3>
<h3>
Update About and Contact details
</h3>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/code_snippets/_edit_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
<%= form_with(model: [:admin, code_snippet], method: 'delete') do |r| %>
<%= r.submit("Remove", class: 'input-submit destroy-button') %>
<% end %>
</div>
</div>
4 changes: 2 additions & 2 deletions app/views/admin/code_snippets/_form_components.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<%= render partial: 'partials/system_messages'%>
<%= render partial: 'partials/system_messages' %>

<div class="embedded-form-entry-container">
<%= f.label(:title, 'Title', class: 'input-label embedded-label') %>
Expand Down Expand Up @@ -34,4 +34,4 @@

<div class="embedded-form-entry-container submit-right">
<%= f.submit("Submit", class: 'input-submit') %>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/admin/code_snippets/_new_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

<div class="embedded-form-button-container">
<%= link_to('Return', admin_code_snippets_path, class: 'standard-button input-submit') %>
</div>
</div>
4 changes: 2 additions & 2 deletions app/views/admin/code_snippets/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</div>

<div class='dashboard-item-container'>
<%= render partial: 'partials/system_messages'%>
<%= render partial: 'partials/system_messages' %>
</div>

<% if @code_snippets.empty? %>
Expand All @@ -18,4 +18,4 @@
<%= render partial: 'code_snippets/code_snippet_overview', locals: {code_snippet: code_snippet, path: edit_admin_code_snippet_path(code_snippet), index: index} %>
<% end %>
</section>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/admin/code_snippets/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

<section class='reading-pane'>
<%= render partial: 'admin/code_snippets/new_form', locals: { code_snippet: @code_snippet } %>
</section>
</section>
6 changes: 3 additions & 3 deletions app/views/admin/gallery_images/_edit_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
</div>

<div class="embedded-form-entry-container">
<%= image_tag(image_path_helper(image_model: gallery_image), class: 'embedded-full-width embedded-cover-image')%>
<%= image_tag(image_path_helper(image_model: gallery_image), class: 'embedded-full-width embedded-cover-image') %>
</div>

<%= form_with(model: [:admin, gallery_image], class: 'section-form', id: 'admin-gallery-images-edit-form') do |f| %>

<%= render partial: 'admin/gallery_images/form_components', locals: { f: f } %>

<% end %>
Expand All @@ -22,4 +22,4 @@
<%= form_with(model: [:admin, gallery_image], method: 'delete') do |r| %>
<%= r.submit("Remove", class: 'input-submit destroy-button') %>
<% end %>
</div>
</div>
4 changes: 2 additions & 2 deletions app/views/admin/gallery_images/_form_components.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render partial: 'partials/system_messages'%>
<%= render partial: 'partials/system_messages' %>

<div class="embedded-form-entry-container">
<%= f.label(:image_file, 'Upload image', class: 'input-label embedded-label') %>
Expand Down Expand Up @@ -27,4 +27,4 @@

<div class="embedded-form-entry-container submit-right">
<%= f.submit("Submit", class: 'input-submit') %>
</div>
</div>
4 changes: 2 additions & 2 deletions app/views/admin/gallery_images/_image_container.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li class='gallery-image-container'>
<a href="<%= edit_admin_gallery_image_path(gallery_image) %>" class='view-gallery-image'>
<%= render(partial: 'gallery_images/image_thumbnail', locals: {gallery_image: gallery_image})%>
<%= render(partial: 'gallery_images/image_thumbnail', locals: {gallery_image: gallery_image}) %>
</a>
</li>
</li>
2 changes: 1 addition & 1 deletion app/views/admin/gallery_images/_new_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

<div class="embedded-form-button-container">
<%= link_to('Return', admin_gallery_images_path, class: 'standard-button input-submit') %>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/admin/gallery_images/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

<%= render partial: 'admin/gallery_images/edit_form', locals: { gallery_image: @gallery_image } %>

</section>
</section>
4 changes: 2 additions & 2 deletions app/views/admin/gallery_images/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<%= render partial: 'partials/admin_toolbar', locals: { model: (@gallery_images.empty? ? [GalleryImage.new] : @gallery_images) } %>

<%= render partial: 'partials/system_messages'%>
<%= render partial: 'partials/system_messages' %>

<section class='gallery-container'>

Expand All @@ -16,4 +16,4 @@
</ul>
<% end %>

</section>
</section>
2 changes: 1 addition & 1 deletion app/views/admin/gallery_images/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

<%= render partial: 'admin/gallery_images/new_form', locals: { gallery_image: @gallery_image } %>

</section>
</section>
4 changes: 2 additions & 2 deletions app/views/admin/images/_edit_image_form_entry.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>

<div class="embedded-form-entry-container">
<%= image_tag(image_path_helper(image_model: image), class: 'embedded-full-width embedded-cover-image')%>
<%= image_tag(image_path_helper(image_model: image), class: 'embedded-full-width embedded-cover-image') %>
</div>

<div class="embedded-form-entry-container">
Expand Down Expand Up @@ -59,4 +59,4 @@
<div class="default-loader"></div>
</div>

<% end %>
<% end %>
6 changes: 3 additions & 3 deletions app/views/admin/images/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<% end %>

<div class='dashboard-item-container'>
<h3>
<h3>
Update site images
</h3>
</div>
<%= render partial: 'partials/system_messages'%>
<%= render partial: 'partials/system_messages' %>
<% @images.each do |image| %>
<div class='dashboard-item-container'>
<%= render partial: "admin/images/edit_image_form_entry", locals: {image: image} %>
</div>
<div class='dashboard-item-separator'></div>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/admin/posts/_edit_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
<%= form_with(model: [:admin, post], method: 'delete') do |r| %>
<%= r.submit("Remove", class: 'input-submit destroy-button') %>
<% end %>
</div>
</div>
4 changes: 2 additions & 2 deletions app/views/admin/posts/_form_components.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

<%= render partial: 'partials/system_messages'%>
<%= render partial: 'partials/system_messages' %>

<div class="embedded-form-entry-container">
<%= f.label(:title, 'Title', class: 'input-label embedded-label') %>
Expand All @@ -26,4 +26,4 @@

<div class="embedded-form-entry-container submit-right">
<%= f.submit("Submit", class: 'input-submit') %>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/admin/posts/_new_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

<div class="embedded-form-button-container">
<%= link_to('Return', admin_posts_path, class: 'standard-button input-submit') %>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/admin/posts/_post_overview.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<a href='<%= edit_admin_post_path(post) %>' class='post-overview-container show-blog-post-button' title='<%= post.title %>' tabindex='<%=post_iteration.index + 1%>'>
<a href='<%= edit_admin_post_path(post) %>' class='post-overview-container show-blog-post-button' title='<%= post.title %>' tabindex='<%= post_iteration.index + 1 %>'>
<div class='post-overview-date'>
<%= full_date(post.date_published) %>
</div>
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/posts/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
</div>

<div class='dashboard-item-container'>
<%= render partial: 'partials/system_messages'%>
<%= render partial: 'partials/system_messages' %>
</div>

<% if @posts.empty? %>
<%= render partial: 'partials/no_items', locals: {item: 'posts'} %>
<% else %>
<%= render partial: 'admin/posts/post_overview', collection: @posts, as: :post, spacer_template: "partials/standard_ruler" %>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/admin/posts/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

<section class='reading-pane'>
<%= render partial: 'admin/posts/new_form', locals: { post: @post } %>
</section>
</section>
2 changes: 1 addition & 1 deletion app/views/admin/projects/_edit_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
<%= form_with(model: [:admin, project], method: 'delete') do |r| %>
<%= r.submit("Remove", class: 'input-submit destroy-button') %>
<% end %>
</div>
</div>
5 changes: 2 additions & 3 deletions app/views/admin/projects/_form_components.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= render partial: 'partials/system_messages'%>
<%= render partial: 'partials/system_messages' %>

<div class="embedded-form-entry-container">
<%= f.label(:title, 'Title', class: 'input-label embedded-label') %>
Expand Down Expand Up @@ -43,7 +43,6 @@
<%= text_field(:snippet, :extension, class: 'input-box embedded-input-box', placeholder: 'Enter file extension such as `rb`...') %>
</div>


<div class="embedded-form-entry-container submit-right">
<%= f.submit("Submit", class: 'input-submit') %>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/admin/projects/_new_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

<div class="embedded-form-button-container">
<%= link_to('Return', admin_projects_path, class: 'standard-button input-submit') %>
</div>
</div>
Loading

0 comments on commit 3702ef3

Please sign in to comment.