Upgrade erb_lint to support latest Rubocop and fix violations (#9663)

* Upgrade erb_lint to support latest Rubocop and fix violations

* Wrong template name
This commit is contained in:
rhymes 2020-08-07 15:36:48 +02:00 committed by GitHub
parent 56aea91e45
commit b94dea9b70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 49 additions and 51 deletions

View file

@ -271,10 +271,11 @@ GEM
thor (~> 0.15) thor (~> 0.15)
environs (1.1.0) environs (1.1.0)
equalizer (0.0.11) equalizer (0.0.11)
erb_lint (0.0.34) erb_lint (0.0.35)
activesupport activesupport
better_html (~> 1.0.7) better_html (~> 1.0.7)
html_tokenizer html_tokenizer
parser (>= 2.7.1.4)
rainbow rainbow
rubocop (~> 0.79) rubocop (~> 0.79)
smart_properties smart_properties
@ -668,8 +669,8 @@ GEM
rubocop-ast (>= 0.1.0, < 1.0) rubocop-ast (>= 0.1.0, < 1.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 2.0) unicode-display_width (>= 1.4.0, < 2.0)
rubocop-ast (0.2.0) rubocop-ast (0.3.0)
parser (>= 2.7.0.1) parser (>= 2.7.1.4)
rubocop-performance (1.7.1) rubocop-performance (1.7.1)
rubocop (>= 0.82.0) rubocop (>= 0.82.0)
rubocop-rails (2.7.1) rubocop-rails (2.7.1)

View file

@ -1,5 +1,5 @@
<% title_with_timeframe( <% title_with_timeframe(
page_title: @tag.capitalize + (@page.present? && @page > 1 ? " Page #{@page}" : "" ), page_title: @tag.capitalize + (@page.present? && @page > 1 ? " Page #{@page}" : ""),
timeframe: params[:timeframe], timeframe: params[:timeframe],
content_for: true, content_for: true,
) %> ) %>

View file

@ -4,7 +4,7 @@
<span class="crayons-indicator"><%= @user.articles_count %></span> <span class="crayons-indicator"><%= @user.articles_count %></span>
</a> </a>
<a class="crayons-link crayons-link--block <%= "crayons-link--current" if params[:action] == "series" && (params[:which] == "organization" || params[:which].blank?) %>" href="/<%=current_user.username%>/series"> <a class="crayons-link crayons-link--block <%= "crayons-link--current" if params[:action] == "series" && (params[:which] == "organization" || params[:which].blank?) %>" href="/<%= current_user.username %>/series">
Series Series
<span class="crayons-indicator"><%= @user.collections.count %></span> <span class="crayons-indicator"><%= @user.collections.count %></span>
</a> </a>

View file

@ -64,8 +64,8 @@
flags: "progressive", flags: "progressive",
fetch_format: "auto", fetch_format: "auto",
sign_url: true), sign_url: true),
class: "sloan mb-7", class: "sloan mb-7",
alt: "#{SiteConfig.mascot_image_description}") %> alt: SiteConfig.mascot_image_description.to_s) %>
<% end %> <% end %>
<p class="mb-6">This is where you can manage your posts, but you haven't written anything yet.</p> <p class="mb-6">This is where you can manage your posts, but you haven't written anything yet.</p>
<p><a href="/new" class="crayons-btn crayons-btn--l">Write your first post now</a></p> <p><a href="/new" class="crayons-btn crayons-btn--l">Write your first post now</a></p>

View file

@ -24,4 +24,4 @@
<%= f.submit "Change my password", class: "crayons-btn" %> <%= f.submit "Change my password", class: "crayons-btn" %>
</div> </div>
<% end %> <% end %>
</div> </div>

View file

@ -13,4 +13,4 @@
<%= f.submit "Send me reset password instructions", class: "crayons-btn" %> <%= f.submit "Send me reset password instructions", class: "crayons-btn" %>
</div> </div>
<% end %> <% end %>
</div> </div>

View file

@ -22,7 +22,7 @@
<% if Doorkeeper.configuration.native_redirect_uri %> <% if Doorkeeper.configuration.native_redirect_uri %>
<span class="form-text text-secondary"> <span class="form-text text-secondary">
<%= raw t("doorkeeper.applications.help.native_redirect_uri", native_redirect_uri: content_tag(:code, class: "bg-light") { Doorkeeper.configuration.native_redirect_uri }) %> <%= raw t("doorkeeper.applications.help.native_redirect_uri", native_redirect_uri: tag.code(class: "bg-light") { Doorkeeper.configuration.native_redirect_uri }) %>
</span> </span>
<% end %> <% end %>

View file

@ -48,7 +48,7 @@
<main role="main"> <main role="main">
<p class="h3"> <p class="h3">
<%= raw t(".prompt", client_name: content_tag(:strong, class: "text-info") { @pre_auth.client.name }) %> <%= raw t(".prompt", client_name: tag.strong(class: "text-info") { @pre_auth.client.name }) %>
</p> </p>
<% if @pre_auth.scopes.count > 0 %> <% if @pre_auth.scopes.count > 0 %>

View file

@ -11,7 +11,6 @@
</h2> </h2>
</div> </div>
<div class="row my-3" id="getStarted"> <div class="row my-3" id="getStarted">
<div class="card w-100"> <div class="card w-100">
<div class="card-header" id="getStartedHeader" data-toggle="collapse" <div class="card-header" id="getStartedHeader" data-toggle="collapse"
@ -22,23 +21,23 @@
</button> </button>
</div> </div>
<div id="getStartedBodyContainer" class="<%= VerifySetupCompleted.setup_completed? ? 'hide collapse': 'show expand' %> p-3" aria-labelledby="siteConfigHeader"> <div id="getStartedBodyContainer" class="<%= VerifySetupCompleted.setup_completed? ? "hide collapse" : "show expand" %> p-3" aria-labelledby="siteConfigHeader">
<%= form_for(SiteConfig.new, url: internal_config_path) do |f| %> <%= form_for(SiteConfig.new, url: internal_config_path) do |f| %>
<% VerifySetupCompleted::MANDATORY_CONFIGS.each do |config_key| %> <% VerifySetupCompleted::MANDATORY_CONFIGS.each do |config_key| %>
<!-- we need to list the config as separate fields if the data structure is a Hash --> <!-- we need to list the config as separate fields if the data structure is a Hash -->
<% if SiteConfig.public_send(config_key).is_a?(Hash) %> <% if SiteConfig.public_send(config_key).is_a?(Hash) %>
<%= internal_config_label "#{config_key.to_s}" %> <%= internal_config_label config_key.to_s %>
<div class="form-group"> <div class="form-group">
<%= f.fields_for config_key do |a_field| %> <%= f.fields_for config_key do |a_field| %>
<% SiteConfig.public_send(config_key).each do |key, value| %> <% SiteConfig.public_send(config_key).each do |key, value| %>
<div> <div>
<%= internal_config_label "#{key}" %> <%= internal_config_label key.to_s %>
<%= a_field.text_field key, <%= a_field.text_field key,
class: "form-control", class: "form-control",
value: SiteConfig.public_send(config_key)[key], value: SiteConfig.public_send(config_key)[key],
placeholder: Constants::SITE_CONFIG_DETAILS[config_key][:placeholder] %> placeholder: Constants::SITE_CONFIG_DETAILS[config_key][:placeholder] %>
<div class="alert alert-info"><%= "#{key} #{config_key.to_s.gsub! '_', ' '}" %></div> <div class="alert alert-info"><%= "#{key} #{config_key.to_s.tr! '_', ' '}" %></div>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>
@ -77,7 +76,6 @@
</div> </div>
</div> </div>
<div class="row my-3" id="siteConfig"> <div class="row my-3" id="siteConfig">
<div class="card w-100"> <div class="card w-100">
<div class="card-header" id="siteConfigHeader" data-toggle="collapse" <div class="card-header" id="siteConfigHeader" data-toggle="collapse"
@ -264,13 +262,11 @@
<%= price_field.number_field :small, <%= price_field.number_field :small,
class: "form-control", class: "form-control",
value: SiteConfig.credit_prices_in_cents[:small] %> value: SiteConfig.credit_prices_in_cents[:small] %>
<div class="alert alert-info">Price for small credit purchase (< 10 credits).</div> <div class="alert alert-info">Price for small credit purchase (&lt;10 credits).</div>
</div>
<div class="form-group">
<%= price_field.label "Credit price in cents (M)" %> <%= price_field.label "Credit price in cents (M)" %>
<%= price_field.number_field :medium, <%= price_field.number_field :medium,
class: "form-control", class: "form-control",
value: SiteConfig.credit_prices_in_cents[:medium] %> value: SiteConfig.credit_prices_in_cents[:medium] %>
<div class="alert alert-info">Price for medium credit purchase (10 - 99 credits).</div> <div class="alert alert-info">Price for medium credit purchase (10 - 99 credits).</div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -290,7 +286,7 @@
<% end %> <% end %>
</div> </div>
</div> </div>
<div class="card mt-3"> <div class="card mt-3">
<%= render partial: "card_header", <%= render partial: "card_header",
locals: { locals: {
@ -366,12 +362,12 @@
class: "form-control", class: "form-control",
value: SiteConfig.jobs_url, value: SiteConfig.jobs_url,
placeholder: Constants::SITE_CONFIG_DETAILS[:jobs_url][:placeholder] %> placeholder: Constants::SITE_CONFIG_DETAILS[:jobs_url][:placeholder] %>
<div class="alert alert-info"><%=Constants::SITE_CONFIG_DETAILS[:jobs_url][:description] %></div> <div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:jobs_url][:description] %></div>
</div> </div>
<div class="form-group"> <div class="form-group">
<%= internal_config_label :display_jobs_banner %> <%= internal_config_label :display_jobs_banner %>
<%= f.check_box :display_jobs_banner, checked: SiteConfig.display_jobs_banner %> <%= f.check_box :display_jobs_banner, checked: SiteConfig.display_jobs_banner %>
<div class="alert alert-info"><%=Constants::SITE_CONFIG_DETAILS[:display_jobs_banner][:description] %></div> <div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:display_jobs_banner][:description] %></div>
</div> </div>
</div> </div>
</div> </div>
@ -390,7 +386,7 @@
<%= f.text_field :ga_view_id, <%= f.text_field :ga_view_id,
class: "form-control", class: "form-control",
value: SiteConfig.ga_view_id %> value: SiteConfig.ga_view_id %>
<div class="alert alert-info"><%=Constants::SITE_CONFIG_DETAILS[:ga_view_id][:description] %></div> <div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:ga_view_id][:description] %></div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -400,7 +396,7 @@
value: SiteConfig.ga_fetch_rate, value: SiteConfig.ga_fetch_rate,
min: 1, min: 1,
placeholder: Constants::SITE_CONFIG_DETAILS[:ga_fetch_rate][:placeholder] %> placeholder: Constants::SITE_CONFIG_DETAILS[:ga_fetch_rate][:placeholder] %>
<div class="alert alert-info"><%=Constants::SITE_CONFIG_DETAILS[:ga_fetch_rate][:description] %></div> <div class="alert alert-info"><%= Constants::SITE_CONFIG_DETAILS[:ga_fetch_rate][:description] %></div>
</div> </div>
</div> </div>
</div> </div>
@ -682,7 +678,7 @@
<%= f.text_field :onboarding_background_image, <%= f.text_field :onboarding_background_image,
class: "form-control", class: "form-control",
value: SiteConfig.onboarding_background_image, value: SiteConfig.onboarding_background_image,
placeholder: Constants::SITE_CONFIG_DETAILS[:onboarding_background_image][:placeholder] %> placeholder: Constants::SITE_CONFIG_DETAILS[:onboarding_background_image][:placeholder] %>
<div class="row mt-2"> <div class="row mt-2">
<div class="col-12"> <div class="col-12">
<img alt="main social image" class="img-fluid" src="<%= SiteConfig.onboarding_background_image %>" /> <img alt="main social image" class="img-fluid" src="<%= SiteConfig.onboarding_background_image %>" />

View file

@ -22,9 +22,9 @@
<% end %> <% end %>
<div class="row mt-4 justify-content-center"> <div class="row mt-4 justify-content-center">
<%= content_tag :span, sort_link(@q, :reporter_username, "Reporter"), class: "mx-2" %> <%= tag.span(sort_link(@q, :reporter_username, "Reporter"), class: "mx-2") %>
<%= content_tag :span, sort_link(@q, :reported_url, "Reported URL"), class: "mx-2" %> <%= tag.span(sort_link(@q, :reported_url, "Reported URL"), class: "mx-2") %>
<%= content_tag :span, sort_link(@q, :created_at, "Creation Date"), class: "ml-2" %> <%= tag.span(sort_link(@q, :created_at, "Creation Date"), class: "ml-2") %>
</div> </div>
<%= paginate @feedback_messages %> <%= paginate @feedback_messages %>

View file

@ -22,7 +22,7 @@
<th scope="col">Action</th> <th scope="col">Action</th>
<th scope="col">Data</th> <th scope="col">Data</th>
<th scope="col"> <th scope="col">
<%= content_tag :span, sort_link(@q, :created_at, "Date"), class: "mx-2" %> <%= tag.span(sort_link(@q, :created_at, "Date"), class: "mx-2") %>
</th> </th>
</tr> </tr>
</thead> </thead>

View file

@ -7,7 +7,7 @@
<p>Available User Credits: <%= current_credits %></p> <p>Available User Credits: <%= current_credits %></p>
<%= form_with scope: :user, url: internal_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %> <%= form_with scope: :user, url: internal_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %>
<div class="form-group"> <div class="form-group">
<%= f.number_field :add_credits, in: 1...10000, required: true, class: "form-control mr-3", size: 5 %> <%= f.number_field :add_credits, in: 1...10_000, required: true, class: "form-control mr-3", size: 5 %>
<%= f.text_field :new_note, placeholder: "Why are you adding these credits?", size: 50, required: true, class: "form-control" %> <%= f.text_field :new_note, placeholder: "Why are you adding these credits?", size: 50, required: true, class: "form-control" %>
</div> </div>
<%= f.submit "Add Credits", class: "btn btn-primary" %> <%= f.submit "Add Credits", class: "btn btn-primary" %>
@ -28,17 +28,17 @@
<h4>Organizations</h4> <h4>Organizations</h4>
<%= form_with scope: :user, url: internal_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %> <%= form_with scope: :user, url: internal_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %>
<div class="form-group"> <div class="form-group">
<%= f.number_field :add_org_credits, in: 1...10000, required: true, class: "form-control mr-3", size: 5 %> <%= f.number_field :add_org_credits, in: 1...10_000, required: true, class: "form-control mr-3", size: 5 %>
<%= f.text_field :new_note, placeholder: "Why are you adding these credits?", size: 50, required: true, class: "form-control mr-3" %> <%= f.text_field :new_note, placeholder: "Why are you adding these credits?", size: 50, required: true, class: "form-control mr-3" %>
<%= f.select :organization_id, orgs_with_credits(@organizations), {}, { class: 'form-control' } %> <%= f.select :organization_id, orgs_with_credits(@organizations), {}, { class: "form-control" } %>
</div> </div>
<%= f.submit "Add Org Credits", class: "btn btn-primary" %> <%= f.submit "Add Org Credits", class: "btn btn-primary" %>
<% end %> <% end %>
<%= form_with scope: :user, url: internal_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %> <%= form_with scope: :user, url: internal_user_path(@user), method: :patch, local: true, html: { class: "form-inline justify-content-between mb-2" } do |f| %>
<div class="form-group"> <div class="form-group">
<%= f.number_field :remove_org_credits, in: 1...10000, required: true, class: "form-control mr-3", size: 5 %> <%= f.number_field :remove_org_credits, in: 1...10_000, required: true, class: "form-control mr-3", size: 5 %>
<%= f.text_field :new_note, placeholder: "Why are you removing these credits?", size: 50, required: true, class: "form-control mr-3" %> <%= f.text_field :new_note, placeholder: "Why are you removing these credits?", size: 50, required: true, class: "form-control mr-3" %>
<%= f.select :organization_id, orgs_with_credits(@organizations), {}, { class: 'form-control' } %> <%= f.select :organization_id, orgs_with_credits(@organizations), {}, { class: "form-control" } %>
</div> </div>
<%= f.submit "Remove Org Credits", class: "btn btn-danger" %> <%= f.submit "Remove Org Credits", class: "btn btn-danger" %>
<% end %> <% end %>

View file

@ -7,7 +7,7 @@
<p> <p>
<em> <em>
<%= note.created_at.strftime("%d %B %Y %H:%M UTC") %> by <%= User.find(note.author_id).username if note.author_id.present? %> <%= note.created_at.strftime("%d %B %Y %H:%M UTC") %> by <%= User.find(note.author_id).username if note.author_id.present? %>
</em> - </em> -
<% unless note.reason.blank? %> <% unless note.reason.blank? %>
<strong><%= note.reason %>:</strong> <strong><%= note.reason %>:</strong>
<% end %> <% end %>

View file

@ -1,6 +1,6 @@
<% if page.current? %> <% if page.current? %>
<li class="page-item active"> <li class="page-item active">
<%= content_tag :a, page, data: { remote: remote }, rel: page.rel, class: "page-link" %> <%= tag.a(page, data: { remote: remote }, rel: page.rel, class: "page-link") %>
</li> </li>
<% else %> <% else %>
<li class="page-item"> <li class="page-item">

View file

@ -40,8 +40,7 @@
data-allcategories="<%= categories_for_display.to_json %>" data-allcategories="<%= categories_for_display.to_json %>"
<% if @displayed_listing %> <% if @displayed_listing %>
data-displayedlisting="<%= @displayed_listing_json %> " data-displayedlisting="<%= @displayed_listing_json %> "
<% end %> <% end %>>
>
</div> </div>
<%= javascript_packs_with_chunks_tag "listings", defer: true %> <%= javascript_packs_with_chunks_tag "listings", defer: true %>

View file

@ -3,4 +3,4 @@ Your account deletion was requested. Please, visit this page: <%= user_request_d
Contact us at <%= SiteConfig.email_addresses[:default] %> if there is anything more we can help with. Contact us at <%= SiteConfig.email_addresses[:default] %> if there is anything more we can help with.
Thanks, Thanks,
The <%= community_name %> Team The <%= community_name %> Team

View file

@ -1,3 +1,3 @@
You are invited to the <%= community_name %> Connect channel <%= @membership.chat_channel.channel_name %> You are invited to the <%= community_name %> Connect channel <%= @membership.chat_channel.channel_name %>
View Invitation: <%= ApplicationController.helpers.app_url('connect') %> View Invitation: <%= ApplicationController.helpers.app_url("connect") %>

View file

@ -1 +1 @@
<%= @email_body %> <%= @email_body %>

View file

@ -15,9 +15,12 @@ To aid in communication, weve added you to the following <%= community_name %
- Tag Moderators <%= app_url("/connect/tag-moderators") %> - Tag Moderators <%= app_url("/connect/tag-moderators") %>
- #<%= @tag %> - #<%= @tag %>
You can use these channels to meet other tag moderators across the site and co-moderators within your tag while coordinating with the <%= community_name %> team. When in doubt about how to exercise your new privileges, please ask! If these Connect channels become too distracting, you can mute or leave any channel as you wish. You can use these channels to meet other tag moderators across the site and co-moderators within your tag while coordinating with the <%= community_name %> team.
When in doubt about how to exercise your new privileges, please ask! If these Connect channels become too distracting, you can mute or leave any channel as you wish.
Tag moderation is something we're continuously iterating on, so you can expect adjustments and expanding features over time as we receive feedback. We regularly send out a biweekly Mod Newsletter to keep mods up to date on these changes, so look out for it! Of course, don't hesitate to reach out to us at any moment if you have any feedback — feel free to write to <%= SiteConfig.email_addresses[:default] %> and share your thoughts. Tag moderation is something we're continuously iterating on, so you can expect adjustments and expanding features over time as we receive feedback.
We regularly send out a biweekly Mod Newsletter to keep mods up to date on these changes, so look out for it!
Of course, don't hesitate to reach out to us at any moment if you have any feedback — feel free to write to <%= SiteConfig.email_addresses[:default] %> and share your thoughts.
Thanks so much for volunteering your time to benefit the <%= community_qualified_name %>. We sincerely appreciate your help! Thanks so much for volunteering your time to benefit the <%= community_qualified_name %>. We sincerely appreciate your help!

View file

@ -6,7 +6,7 @@
<img src="<%= ProfileImage.new(user).get %>" alt="link to <%= json_data["user"]["username"] %>'s profile"> <img src="<%= ProfileImage.new(user).get %>" alt="link to <%= json_data["user"]["username"] %>'s profile">
</div> </div>
</a> </a>
<div class="content notification-content broadcast-content" id="<%= sanitized_broadcast_id(json_data['broadcast']['title']) %>"> <div class="content notification-content broadcast-content" id="<%= sanitized_broadcast_id(json_data["broadcast"]["title"]) %>">
<%= json_data["broadcast"]["processed_html"].html_safe %> <%= json_data["broadcast"]["processed_html"].html_safe %>
<% if notification.json_data['broadcast']['type_of'] == "Welcome" %> <% if notification.json_data['broadcast']['type_of'] == "Welcome" %>

View file

@ -16,8 +16,7 @@
data-community-name="<%= community_name %>" data-community-name="<%= community_name %>"
data-community-description="<%= SiteConfig.community_description %>" data-community-description="<%= SiteConfig.community_description %>"
data-community-logo="<%= cloudinary safe_logo_url(SiteConfig.onboarding_logo_image) %>" data-community-logo="<%= cloudinary safe_logo_url(SiteConfig.onboarding_logo_image) %>"
data-community-background="<%= cloudinary(SiteConfig.onboarding_background_image, "1680", 75) %>" data-community-background="<%= cloudinary(SiteConfig.onboarding_background_image, "1680", 75) %>">
>
<%= javascript_packs_with_chunks_tag "Onboarding", defer: true %> <%= javascript_packs_with_chunks_tag "Onboarding", defer: true %>
</div> </div>

View file

@ -12,4 +12,4 @@
<% if authentication_enabled_providers.any? %> <% if authentication_enabled_providers.any? %>
<p class="pt-6 pb-8"><em>We require social registration to prevent abuse.</em></p> <p class="pt-6 pb-8"><em>We require social registration to prevent abuse.</em></p>
<% end %> <% end %>

View file

@ -9,4 +9,4 @@
<% end %> <% end %>
<a href="/enter" <a href="/enter"
class="crayons-btn crayons-btn--secondary crayons-btn--xl m-1" class="crayons-btn crayons-btn--secondary crayons-btn--xl m-1"
data-no-instant>More Sign In Options</a> data-no-instant>More Sign In Options</a>

Binary file not shown.

BIN
vendor/cache/erb_lint-0.0.35.gem vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
vendor/cache/rubocop-ast-0.3.0.gem vendored Normal file

Binary file not shown.