Permalink
Browse files

Added haml-lint and fix warnings (#2773)

* add haml_lint to Gemfile

* add .haml-lint.yml

* fix warnings of haml_lint
  • Loading branch information...
yhirano55 authored and Gargron committed May 8, 2017
1 parent b18504a commit 48594b18e6285d87ee2f58daa08d356b571c8aa6
Showing with 207 additions and 90 deletions.
  1. +108 −0 .haml-lint.yml
  2. +1 −0 Gemfile
  3. +9 −0 Gemfile.lock
  4. +1 −1 app/views/about/_contact.html.haml
  5. +2 −2 app/views/about/_registration.html.haml
  6. +2 −2 app/views/about/more.html.haml
  7. +3 −3 app/views/about/show.html.haml
  8. +1 −1 app/views/accounts/_grid_card.html.haml
  9. +2 −2 app/views/accounts/_header.html.haml
  10. +1 −1 app/views/admin/accounts/_card.html.haml
  11. +3 −3 app/views/admin/reports/_report.html.haml
  12. +1 −1 app/views/admin/settings/edit.html.haml
  13. +1 −1 app/views/application/_flashes.html.haml
  14. +1 −1 app/views/auth/confirmations/new.html.haml
  15. +3 −3 app/views/auth/passwords/edit.html.haml
  16. +1 −1 app/views/auth/passwords/new.html.haml
  17. +3 −3 app/views/auth/registrations/edit.html.haml
  18. +3 −3 app/views/auth/registrations/new.html.haml
  19. +1 −1 app/views/auth/sessions/new.html.haml
  20. +1 −1 app/views/auth/sessions/two_factor.html.haml
  21. +1 −1 app/views/authorize_follows/_card.html.haml
  22. +1 −1 app/views/errors/403.html.haml
  23. +1 −1 app/views/errors/404.html.haml
  24. +2 −2 app/views/home/index.html.haml
  25. +1 −1 app/views/layouts/admin.html.haml
  26. +11 −12 app/views/layouts/application.html.haml
  27. +1 −1 app/views/layouts/auth.html.haml
  28. +2 −2 app/views/layouts/embedded.html.haml
  29. +6 −6 app/views/layouts/error.html.haml
  30. +3 −3 app/views/layouts/public.html.haml
  31. +1 −1 app/views/oauth/authorizations/new.html.haml
  32. +1 −1 app/views/oauth/authorized_applications/index.html.haml
  33. +2 −2 app/views/settings/profiles/show.html.haml
  34. +1 −1 app/views/settings/two_factor_authentication/confirmations/new.html.haml
  35. +5 −5 app/views/stream_entries/_detailed_status.html.haml
  36. +1 −1 app/views/stream_entries/_media.html.haml
  37. +2 −2 app/views/stream_entries/_simple_status.html.haml
  38. +16 −16 app/views/stream_entries/_status.html.haml
  39. +1 −1 app/views/tags/show.html.haml
@@ -0,0 +1,108 @@
# Whether to ignore frontmatter at the beginning of HAML documents for
# frameworks such as Jekyll/Middleman
skip_frontmatter: false
exclude:
- 'vendor/**/*'
- 'spec/**/*'
- 'lib/templates/**/*'
- 'app/views/kaminari/**/*'
linters:
AltText:
enabled: false
ClassAttributeWithStaticValue:
enabled: true
ClassesBeforeIds:
enabled: true
ConsecutiveComments:
enabled: true
ConsecutiveSilentScripts:
enabled: true
max_consecutive: 2
EmptyObjectReference:
enabled: true
EmptyScript:
enabled: true
FinalNewline:
enabled: true
present: true
HtmlAttributes:
enabled: true
ImplicitDiv:
enabled: true
LeadingCommentSpace:
enabled: true
LineLength:
enabled: false
max: 80
MultilinePipe:
enabled: true
MultilineScript:
enabled: true
ObjectReferenceAttributes:
enabled: true
RuboCop:
enabled: true
# These cops are incredibly noisy when it comes to HAML templates, so we
# ignore them.
ignored_cops:
- Lint/BlockAlignment
- Lint/EndAlignment
- Lint/Void
- Metrics/BlockLength
- Metrics/LineLength
- Style/AlignParameters
- Style/BlockNesting
- Style/ElseAlignment
- Style/EndOfLine
- Style/FileName
- Style/FinalNewline
- Style/FrozenStringLiteralComment
- Style/IfUnlessModifier
- Style/IndentationWidth
- Style/Next
- Style/TrailingBlankLines
- Style/TrailingWhitespace
- Style/WhileUntilModifier
RubyComments:
enabled: true
SpaceBeforeScript:
enabled: true
SpaceInsideHashAttributes:
enabled: true
style: space
Indentation:
enabled: true
character: space # or tab
TagName:
enabled: true
TrailingWhitespace:
enabled: true
UnnecessaryInterpolation:
enabled: true
UnnecessaryStringOutput:
enabled: true
@@ -89,6 +89,7 @@ group :development do
gem 'brakeman', '~> 3.6.0', require: false
gem 'bundler-audit', '~> 0.4.0', require: false
gem 'scss_lint', '0.42.2', require: false
gem 'haml_lint', '~> 0.19.0', require: false
gem 'capistrano', '3.8.0'
gem 'capistrano-rails'
@@ -157,6 +157,13 @@ GEM
addressable (~> 2.4)
http (~> 2.0)
nokogiri (~> 1.6)
haml (4.0.7)
tilt
haml_lint (0.19.0)
haml (~> 4.0)
rake (>= 10, < 13)
rubocop (>= 0.36.0)
sysexits (~> 1.1)
hamlit (2.8.1)
temple (>= 0.8.0)
thor
@@ -431,6 +438,7 @@ GEM
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
statsd-instrument (2.1.2)
sysexits (1.2.0)
temple (0.8.0)
terminal-table (1.7.3)
unicode-display_width (~> 1.1.1)
@@ -495,6 +503,7 @@ DEPENDENCIES
fast_blank
fuubar
goldfinger
haml_lint (~> 0.19.0)
hamlit-rails
hiredis
htmlentities
@@ -7,7 +7,7 @@
.name
= link_to TagManager.instance.url_for(contact.contact_account) do
%span.display_name.emojify= display_name(contact.contact_account)
%span.username= "@#{contact.contact_account.acct}"
%span.username @#{contact.contact_account.acct}
- if contact.site_contact_email
.contact-email
@@ -11,12 +11,12 @@
required: true,
input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
= f.input :password,
autocomplete: "off",
autocomplete: 'off',
placeholder: t('simple_form.labels.defaults.password'),
required: true,
input_html: { 'aria-label' => t('simple_form.labels.defaults.password') }
= f.input :password_confirmation,
autocomplete: "off",
autocomplete: 'off',
placeholder: t('simple_form.labels.defaults.confirm_password'),
required: true,
input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password') }
@@ -8,7 +8,7 @@
%h2= site_hostname
- unless @instance_presenter.site_description.blank?
%p= @instance_presenter.site_description.html_safe
%p!= @instance_presenter.site_description
.information-board
.section
@@ -25,7 +25,7 @@
%span= t 'about.domain_count_after'
- unless @instance_presenter.site_extended_description.blank?
.panel= @instance_presenter.site_extended_description.html_safe
.panel!= @instance_presenter.site_extended_description
.sidebar
= render 'contact', contact: @instance_presenter
@@ -20,7 +20,7 @@
= image_tag asset_pack_path('logo.png')
= Setting.site_title
%p= t('about.about_mastodon').html_safe
%p!= t('about.about_mastodon')
.screenshot-with-signup
.mascot= image_tag asset_pack_path('fluffy-elephant-friend.png')
@@ -32,7 +32,7 @@
- if @instance_presenter.closed_registrations_message.blank?
%p= t('about.closed_registrations')
- else
= @instance_presenter.closed_registrations_message.html_safe
!= @instance_presenter.closed_registrations_message
.info
= link_to t('auth.login'), new_user_session_path, class: 'webapp-btn'
·
@@ -74,7 +74,7 @@
- unless @instance_presenter.site_description.blank?
%h3= t('about.description_headline', domain: site_hostname)
%p= @instance_presenter.site_description.html_safe
%p!= @instance_presenter.site_description
.actions
.info
@@ -4,5 +4,5 @@
.name
= link_to TagManager.instance.url_for(account) do
%span.display_name.emojify= display_name(account)
%span.username= "@#{account.acct}"
%span.username @#{account.acct}
%p.note.emojify= truncate(strip_tags(account.note), length: 150)
@@ -1,4 +1,4 @@
.card.h-card.p-author{ style: "background-image: url(#{account.header.url( :original)})" }
.card.h-card.p-author{ style: "background-image: url(#{account.header.url(:original)})" }
- if user_signed_in? && current_account.id != account.id && !current_account.requested?(account)
.controls
- if current_account.following?(account)
@@ -13,7 +13,7 @@
%h1.name
%span.p-name.emojify= display_name(account)
%small
%span= "@#{account.username}"
%span @#{account.username}
= fa_icon('lock') if account.locked?
.details
.bio
@@ -6,7 +6,7 @@
%tr
%td= t('admin.accounts.show.targeted_reports')
%td= link_to pluralize(account.targeted_reports.count, t('admin.accounts.show.report')), admin_reports_path(target_account_id: account.id)
- if account.silenced? or account.suspended?
- if account.silenced? || account.suspended?
%tr
%td= t('admin.accounts.moderation.title')
%td
@@ -6,15 +6,15 @@
%td.reporter
= link_to report.account.acct, admin_account_path(report.account.id)
%td.comment
%span{title: report.comment}
%span{ title: report.comment }
= truncate(report.comment, length: 30, separator: ' ')
%td.stats
- unless report.statuses.empty?
%span{title: t('admin.accounts.statuses')}
%span{ title: t('admin.accounts.statuses') }
= fa_icon('comment')
= report.statuses.count
- unless report.media_attachments.empty?
%span{title: t('admin.accounts.media_attachments')}
%span{ title: t('admin.accounts.media_attachments') }
= fa_icon('camera')
= report.media_attachments.count
%td
@@ -5,7 +5,7 @@
%table.table
%thead
%tr
%th{width: '40%'}
%th{ width: '40%' }
= t('admin.settings.setting')
%th
%tbody
@@ -1,3 +1,3 @@
- user_facing_flashes.each do |key, value|
.flash-message{class: key}
.flash-message{ class: key }
%strong= value
@@ -9,4 +9,4 @@
.actions
= f.button :button, t('auth.resend_confirmation'), type: :submit
.form-footer= render "auth/shared/links"
.form-footer= render 'auth/shared/links'
@@ -5,10 +5,10 @@
= render 'shared/error_messages', object: resource
= f.input :reset_password_token, as: :hidden
= f.input :password, autofocus: true, autocomplete: "off", placeholder: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.new_password') }
= f.input :password_confirmation, autocomplete: "off", placeholder: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_new_password') }
= f.input :password, autofocus: true, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.new_password') }
= f.input :password_confirmation, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_new_password') }
.actions
= f.button :button, t('auth.set_new_password'), type: :submit
.form-footer= render "devise/shared/links"
.form-footer= render 'devise/shared/links'
@@ -9,4 +9,4 @@
.actions
= f.button :button, t('auth.reset_password'), type: :submit
.form-footer= render "auth/shared/links"
.form-footer= render 'auth/shared/links'
@@ -5,9 +5,9 @@
= render 'shared/error_messages', object: resource
= f.input :email, placeholder: t('simple_form.labels.defaults.email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
= f.input :password, autocomplete: "off", placeholder: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.new_password') }
= f.input :password_confirmation, autocomplete: "off", placeholder: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_new_password') }
= f.input :current_password, autocomplete: "off", placeholder: t('simple_form.labels.defaults.current_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.current_password') }
= f.input :password, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.new_password') }
= f.input :password_confirmation, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.confirm_new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_new_password') }
= f.input :current_password, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.current_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.current_password') }
.actions
= f.button :button, t('generic.save_changes'), type: :submit
@@ -8,10 +8,10 @@
= ff.input :username, autofocus: true, placeholder: t('simple_form.labels.defaults.username'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username') }
= f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
= f.input :password, autocomplete: "off", placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password') }
= f.input :password_confirmation, autocomplete: "off", placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password') }
= f.input :password, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password') }
= f.input :password_confirmation, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password') }
.actions
= f.button :button, t('auth.register'), type: :submit
.form-footer= render "auth/shared/links"
.form-footer= render 'auth/shared/links'
@@ -8,4 +8,4 @@
.actions
= f.button :button, t('auth.login'), type: :submit
.form-footer= render "auth/shared/links"
.form-footer= render 'auth/shared/links'
@@ -9,4 +9,4 @@
.actions
= f.button :button, t('auth.login'), type: :submit
.form-footer= render "auth/shared/links"
.form-footer= render 'auth/shared/links'
@@ -6,7 +6,7 @@
%span.display-name
= link_to TagManager.instance.url_for(account), class: 'detailed-status__display-name p-author h-card', target: '_blank', rel: 'noopener' do
%strong.emojify= display_name(account)
%span= "@#{account.acct}"
%span @#{account.acct}
- if account.note?
.account__header__content.emojify= Formatter.instance.simplified_format(account)
@@ -2,4 +2,4 @@
= t('errors.403')
- content_for :content do
= t('errors.403')
= t('errors.403')
@@ -2,4 +2,4 @@
= t('errors.404')
- content_for :content do
= t('errors.404')
= t('errors.404')
@@ -1,6 +1,6 @@
- content_for :header_tags do
%script#initial-state{:type => 'application/json'}!= json_escape(render(file: 'home/initial_state', formats: :json))
%script#initial-state{ type: 'application/json' }!= json_escape(render(file: 'home/initial_state', formats: :json))
= javascript_pack_tag 'application', integrity: true, crossorigin: 'anonymous'
.app-holder#mastodon{ data: { props: Oj.dump(default_props) }}
.app-holder#mastodon{ data: { props: Oj.dump(default_props) } }
@@ -17,4 +17,4 @@
= yield
= render template: "layouts/application", locals: { body_classes: 'admin' }
= render template: 'layouts/application', locals: { body_classes: 'admin' }
Oops, something went wrong.

0 comments on commit 48594b1

Please sign in to comment.