Browse Source

Added haml-lint and fix warnings (#2773)

* add haml_lint to Gemfile

* add .haml-lint.yml

* fix warnings of haml_lint
yhirano 1 year ago
parent
commit
48594b18e6
39 changed files 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

+ 108
- 0
.haml-lint.yml View File

@@ -0,0 +1,108 @@
1
+# Whether to ignore frontmatter at the beginning of HAML documents for
2
+# frameworks such as Jekyll/Middleman
3
+skip_frontmatter: false
4
+
5
+exclude:
6
+  - 'vendor/**/*'
7
+  - 'spec/**/*'
8
+  - 'lib/templates/**/*'
9
+  - 'app/views/kaminari/**/*'
10
+
11
+linters:
12
+  AltText:
13
+    enabled: false
14
+
15
+  ClassAttributeWithStaticValue:
16
+    enabled: true
17
+
18
+  ClassesBeforeIds:
19
+    enabled: true
20
+
21
+  ConsecutiveComments:
22
+    enabled: true
23
+
24
+  ConsecutiveSilentScripts:
25
+    enabled: true
26
+    max_consecutive: 2
27
+
28
+  EmptyObjectReference:
29
+    enabled: true
30
+
31
+  EmptyScript:
32
+    enabled: true
33
+
34
+  FinalNewline:
35
+    enabled: true
36
+    present: true
37
+
38
+  HtmlAttributes:
39
+    enabled: true
40
+
41
+  ImplicitDiv:
42
+    enabled: true
43
+
44
+  LeadingCommentSpace:
45
+    enabled: true
46
+
47
+  LineLength:
48
+    enabled: false
49
+    max: 80
50
+
51
+  MultilinePipe:
52
+    enabled: true
53
+
54
+  MultilineScript:
55
+    enabled: true
56
+
57
+  ObjectReferenceAttributes:
58
+    enabled: true
59
+
60
+  RuboCop:
61
+    enabled: true
62
+    # These cops are incredibly noisy when it comes to HAML templates, so we
63
+    # ignore them.
64
+    ignored_cops:
65
+      - Lint/BlockAlignment
66
+      - Lint/EndAlignment
67
+      - Lint/Void
68
+      - Metrics/BlockLength
69
+      - Metrics/LineLength
70
+      - Style/AlignParameters
71
+      - Style/BlockNesting
72
+      - Style/ElseAlignment
73
+      - Style/EndOfLine
74
+      - Style/FileName
75
+      - Style/FinalNewline
76
+      - Style/FrozenStringLiteralComment
77
+      - Style/IfUnlessModifier
78
+      - Style/IndentationWidth
79
+      - Style/Next
80
+      - Style/TrailingBlankLines
81
+      - Style/TrailingWhitespace
82
+      - Style/WhileUntilModifier
83
+
84
+  RubyComments:
85
+    enabled: true
86
+
87
+  SpaceBeforeScript:
88
+    enabled: true
89
+
90
+  SpaceInsideHashAttributes:
91
+    enabled: true
92
+    style: space
93
+
94
+  Indentation:
95
+    enabled: true
96
+    character: space # or tab
97
+
98
+  TagName:
99
+    enabled: true
100
+
101
+  TrailingWhitespace:
102
+    enabled: true
103
+
104
+  UnnecessaryInterpolation:
105
+    enabled: true
106
+
107
+  UnnecessaryStringOutput:
108
+    enabled: true

+ 1
- 0
Gemfile View File

@@ -89,6 +89,7 @@ group :development do
89 89
   gem 'brakeman', '~> 3.6.0', require: false
90 90
   gem 'bundler-audit', '~> 0.4.0', require: false
91 91
   gem 'scss_lint', '0.42.2', require: false
92
+  gem 'haml_lint', '~> 0.19.0', require: false
92 93
 
93 94
   gem 'capistrano', '3.8.0'
94 95
   gem 'capistrano-rails'

+ 9
- 0
Gemfile.lock View File

@@ -157,6 +157,13 @@ GEM
157 157
       addressable (~> 2.4)
158 158
       http (~> 2.0)
159 159
       nokogiri (~> 1.6)
160
+    haml (4.0.7)
161
+      tilt
162
+    haml_lint (0.19.0)
163
+      haml (~> 4.0)
164
+      rake (>= 10, < 13)
165
+      rubocop (>= 0.36.0)
166
+      sysexits (~> 1.1)
160 167
     hamlit (2.8.1)
161 168
       temple (>= 0.8.0)
162 169
       thor
@@ -431,6 +438,7 @@ GEM
431 438
       net-scp (>= 1.1.2)
432 439
       net-ssh (>= 2.8.0)
433 440
     statsd-instrument (2.1.2)
441
+    sysexits (1.2.0)
434 442
     temple (0.8.0)
435 443
     terminal-table (1.7.3)
436 444
       unicode-display_width (~> 1.1.1)
@@ -495,6 +503,7 @@ DEPENDENCIES
495 503
   fast_blank
496 504
   fuubar
497 505
   goldfinger
506
+  haml_lint (~> 0.19.0)
498 507
   hamlit-rails
499 508
   hiredis
500 509
   htmlentities

+ 1
- 1
app/views/about/_contact.html.haml View File

@@ -7,7 +7,7 @@
7 7
         .name
8 8
           = link_to TagManager.instance.url_for(contact.contact_account) do
9 9
             %span.display_name.emojify= display_name(contact.contact_account)
10
-            %span.username= "@#{contact.contact_account.acct}"
10
+            %span.username @#{contact.contact_account.acct}
11 11
 
12 12
     - if contact.site_contact_email
13 13
       .contact-email

+ 2
- 2
app/views/about/_registration.html.haml View File

@@ -11,12 +11,12 @@
11 11
     required: true,
12 12
     input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
13 13
   = f.input :password,
14
-    autocomplete: "off",
14
+    autocomplete: 'off',
15 15
     placeholder: t('simple_form.labels.defaults.password'),
16 16
     required: true,
17 17
     input_html: { 'aria-label' => t('simple_form.labels.defaults.password') }
18 18
   = f.input :password_confirmation,
19
-    autocomplete: "off",
19
+    autocomplete: 'off',
20 20
     placeholder: t('simple_form.labels.defaults.confirm_password'),
21 21
     required: true,
22 22
     input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password') }

+ 2
- 2
app/views/about/more.html.haml View File

@@ -8,7 +8,7 @@
8 8
         %h2= site_hostname
9 9
 
10 10
         - unless @instance_presenter.site_description.blank?
11
-          %p= @instance_presenter.site_description.html_safe
11
+          %p!= @instance_presenter.site_description
12 12
 
13 13
       .information-board
14 14
         .section
@@ -25,7 +25,7 @@
25 25
           %span= t 'about.domain_count_after'
26 26
 
27 27
       - unless @instance_presenter.site_extended_description.blank?
28
-        .panel= @instance_presenter.site_extended_description.html_safe
28
+        .panel!= @instance_presenter.site_extended_description
29 29
 
30 30
     .sidebar
31 31
       = render 'contact', contact: @instance_presenter

+ 3
- 3
app/views/about/show.html.haml View File

@@ -20,7 +20,7 @@
20 20
     = image_tag asset_pack_path('logo.png')
21 21
     = Setting.site_title
22 22
 
23
-  %p= t('about.about_mastodon').html_safe
23
+  %p!= t('about.about_mastodon')
24 24
 
25 25
   .screenshot-with-signup
26 26
     .mascot= image_tag asset_pack_path('fluffy-elephant-friend.png')
@@ -32,7 +32,7 @@
32 32
         - if @instance_presenter.closed_registrations_message.blank?
33 33
           %p= t('about.closed_registrations')
34 34
         - else
35
-          = @instance_presenter.closed_registrations_message.html_safe
35
+          != @instance_presenter.closed_registrations_message
36 36
         .info
37 37
           = link_to t('auth.login'), new_user_session_path, class: 'webapp-btn'
38 38
           ·
@@ -74,7 +74,7 @@
74 74
 
75 75
   - unless @instance_presenter.site_description.blank?
76 76
     %h3= t('about.description_headline', domain: site_hostname)
77
-    %p= @instance_presenter.site_description.html_safe
77
+    %p!= @instance_presenter.site_description
78 78
 
79 79
   .actions
80 80
     .info

+ 1
- 1
app/views/accounts/_grid_card.html.haml View File

@@ -4,5 +4,5 @@
4 4
     .name
5 5
       = link_to TagManager.instance.url_for(account) do
6 6
         %span.display_name.emojify= display_name(account)
7
-        %span.username= "@#{account.acct}"
7
+        %span.username @#{account.acct}
8 8
   %p.note.emojify= truncate(strip_tags(account.note), length: 150)

+ 2
- 2
app/views/accounts/_header.html.haml View File

@@ -1,4 +1,4 @@
1
-.card.h-card.p-author{ style: "background-image: url(#{account.header.url( :original)})" }
1
+.card.h-card.p-author{ style: "background-image: url(#{account.header.url(:original)})" }
2 2
   - if user_signed_in? && current_account.id != account.id && !current_account.requested?(account)
3 3
     .controls
4 4
       - if current_account.following?(account)
@@ -13,7 +13,7 @@
13 13
   %h1.name
14 14
     %span.p-name.emojify= display_name(account)
15 15
     %small
16
-      %span= "@#{account.username}"
16
+      %span @#{account.username}
17 17
       = fa_icon('lock') if account.locked?
18 18
   .details
19 19
     .bio

+ 1
- 1
app/views/admin/accounts/_card.html.haml View File

@@ -6,7 +6,7 @@
6 6
     %tr
7 7
       %td= t('admin.accounts.show.targeted_reports')
8 8
       %td= link_to pluralize(account.targeted_reports.count, t('admin.accounts.show.report')), admin_reports_path(target_account_id: account.id)
9
-    - if account.silenced? or account.suspended?
9
+    - if account.silenced? || account.suspended?
10 10
       %tr
11 11
         %td= t('admin.accounts.moderation.title')
12 12
         %td

+ 3
- 3
app/views/admin/reports/_report.html.haml View File

@@ -6,15 +6,15 @@
6 6
   %td.reporter
7 7
     = link_to report.account.acct, admin_account_path(report.account.id)
8 8
   %td.comment
9
-    %span{title: report.comment}
9
+    %span{ title: report.comment }
10 10
       = truncate(report.comment, length: 30, separator: ' ')
11 11
   %td.stats
12 12
     - unless report.statuses.empty?
13
-      %span{title: t('admin.accounts.statuses')}
13
+      %span{ title: t('admin.accounts.statuses') }
14 14
         = fa_icon('comment')
15 15
         = report.statuses.count
16 16
     - unless report.media_attachments.empty?
17
-      %span{title: t('admin.accounts.media_attachments')}
17
+      %span{ title: t('admin.accounts.media_attachments') }
18 18
         = fa_icon('camera')
19 19
         = report.media_attachments.count
20 20
   %td

+ 1
- 1
app/views/admin/settings/edit.html.haml View File

@@ -5,7 +5,7 @@
5 5
   %table.table
6 6
     %thead
7 7
       %tr
8
-        %th{width: '40%'}
8
+        %th{ width: '40%' }
9 9
           = t('admin.settings.setting')
10 10
         %th
11 11
     %tbody

+ 1
- 1
app/views/application/_flashes.html.haml View File

@@ -1,3 +1,3 @@
1 1
 - user_facing_flashes.each do |key, value|
2
-  .flash-message{class: key}
2
+  .flash-message{ class: key }
3 3
     %strong= value

+ 1
- 1
app/views/auth/confirmations/new.html.haml View File

@@ -9,4 +9,4 @@
9 9
   .actions
10 10
     = f.button :button, t('auth.resend_confirmation'), type: :submit
11 11
 
12
-.form-footer= render "auth/shared/links"
12
+.form-footer= render 'auth/shared/links'

+ 3
- 3
app/views/auth/passwords/edit.html.haml View File

@@ -5,10 +5,10 @@
5 5
   = render 'shared/error_messages', object: resource
6 6
   = f.input :reset_password_token, as: :hidden
7 7
 
8
-  = 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') }
9
-  = 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') }
8
+  = 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') }
9
+  = 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') }
10 10
 
11 11
   .actions
12 12
     = f.button :button, t('auth.set_new_password'), type: :submit
13 13
 
14
-.form-footer= render "devise/shared/links"
14
+.form-footer= render 'devise/shared/links'

+ 1
- 1
app/views/auth/passwords/new.html.haml View File

@@ -9,4 +9,4 @@
9 9
   .actions
10 10
     = f.button :button, t('auth.reset_password'), type: :submit
11 11
 
12
-.form-footer= render "auth/shared/links"
12
+.form-footer= render 'auth/shared/links'

+ 3
- 3
app/views/auth/registrations/edit.html.haml View File

@@ -5,9 +5,9 @@
5 5
   = render 'shared/error_messages', object: resource
6 6
 
7 7
   = f.input :email, placeholder: t('simple_form.labels.defaults.email'), input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
8
-  = f.input :password, autocomplete: "off", placeholder: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.new_password') }
9
-  = 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') }
10
-  = 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') }
8
+  = f.input :password, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.new_password'), input_html: { 'aria-label' => t('simple_form.labels.defaults.new_password') }
9
+  = 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') }
10
+  = 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') }
11 11
 
12 12
   .actions
13 13
     = f.button :button, t('generic.save_changes'), type: :submit

+ 3
- 3
app/views/auth/registrations/new.html.haml View File

@@ -8,10 +8,10 @@
8 8
     = ff.input :username, autofocus: true, placeholder: t('simple_form.labels.defaults.username'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username') }
9 9
 
10 10
   = f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email') }
11
-  = f.input :password, autocomplete: "off", placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password') }
12
-  = 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') }
11
+  = f.input :password, autocomplete: 'off', placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password') }
12
+  = 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') }
13 13
 
14 14
   .actions
15 15
     = f.button :button, t('auth.register'), type: :submit
16 16
 
17
-.form-footer= render "auth/shared/links"
17
+.form-footer= render 'auth/shared/links'

+ 1
- 1
app/views/auth/sessions/new.html.haml View File

@@ -8,4 +8,4 @@
8 8
   .actions
9 9
     = f.button :button, t('auth.login'), type: :submit
10 10
 
11
-.form-footer= render "auth/shared/links"
11
+.form-footer= render 'auth/shared/links'

+ 1
- 1
app/views/auth/sessions/two_factor.html.haml View File

@@ -9,4 +9,4 @@
9 9
   .actions
10 10
     = f.button :button, t('auth.login'), type: :submit
11 11
 
12
-.form-footer= render "auth/shared/links"
12
+.form-footer= render 'auth/shared/links'

+ 1
- 1
app/views/authorize_follows/_card.html.haml View File

@@ -6,7 +6,7 @@
6 6
     %span.display-name
7 7
       = link_to TagManager.instance.url_for(account), class: 'detailed-status__display-name p-author h-card', target: '_blank', rel: 'noopener' do
8 8
         %strong.emojify= display_name(account)
9
-        %span= "@#{account.acct}"
9
+        %span @#{account.acct}
10 10
 
11 11
   - if account.note?
12 12
     .account__header__content.emojify= Formatter.instance.simplified_format(account)

+ 1
- 1
app/views/errors/403.html.haml View File

@@ -2,4 +2,4 @@
2 2
   = t('errors.403')
3 3
 
4 4
 - content_for :content do
5
-  = t('errors.403')
5
+  = t('errors.403')

+ 1
- 1
app/views/errors/404.html.haml View File

@@ -2,4 +2,4 @@
2 2
   = t('errors.404')
3 3
 
4 4
 - content_for :content do
5
-  = t('errors.404')
5
+  = t('errors.404')

+ 2
- 2
app/views/home/index.html.haml View File

@@ -1,6 +1,6 @@
1 1
 - content_for :header_tags do
2
-  %script#initial-state{:type => 'application/json'}!= json_escape(render(file: 'home/initial_state', formats: :json))
2
+  %script#initial-state{ type: 'application/json' }!= json_escape(render(file: 'home/initial_state', formats: :json))
3 3
 
4 4
   = javascript_pack_tag 'application', integrity: true, crossorigin: 'anonymous'
5 5
 
6
-.app-holder#mastodon{ data: { props: Oj.dump(default_props) }}
6
+.app-holder#mastodon{ data: { props: Oj.dump(default_props) } }

+ 1
- 1
app/views/layouts/admin.html.haml View File

@@ -17,4 +17,4 @@
17 17
 
18 18
         = yield
19 19
 
20
-= render template: "layouts/application", locals: { body_classes: 'admin' }
20
+= render template: 'layouts/application', locals: { body_classes: 'admin' }

+ 11
- 12
app/views/layouts/application.html.haml View File

@@ -1,17 +1,16 @@
1 1
 !!! 5
2
-%html{:lang => I18n.locale}
2
+%html{ lang: I18n.locale }
3 3
   %head
4
-    %meta{:charset => 'utf-8'}/
5
-    %meta{:name => 'viewport', :content => 'width=device-width, initial-scale=1'}/
6
-    %meta{'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge'}/
7
-
8
-    %link{:rel => "icon", :href => favicon_path, :type => "image/x-icon"}/
9
-    %link{:rel => "apple-touch-icon", :sizes => "180x180", :href => "/apple-touch-icon.png"}/
10
-    %link{:rel => "mask-icon", :href => "/mask-icon.svg", :color => "#2B90D9"}/
11
-    %link{:rel => "manifest", :href => "/manifest.json"}/
12
-    %meta{:name => "msapplication-config", :content => "/browserconfig.xml"}/
13
-    %meta{:name => "theme-color", :content => "#282c37"}/
14
-    %meta{:name => "apple-mobile-web-app-capable", :content => "yes"}/
4
+    %meta{ charset: 'utf-8' }/
5
+    %meta{ name: 'viewport', content: 'width=device-width, initial-scale=1' }/
6
+    %meta{ 'http-equiv' => 'X-UA-Compatible', content: 'IE=edge' }/
7
+    %link{ rel: 'icon', href: favicon_path, type: 'image/x-icon' }/
8
+    %link{ rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png' }/
9
+    %link{ rel: 'mask-icon', href: '/mask-icon.svg', color: '#2B90D9' }/
10
+    %link{ rel: 'manifest', href: '/manifest.json' }/
11
+    %meta{ name: 'msapplication-config', content: '/browserconfig.xml' }/
12
+    %meta{ name: 'theme-color', content: '#282c37' }/
13
+    %meta{ name: 'apple-mobile-web-app-capable', content: 'yes' }/
15 14
 
16 15
     %title<
17 16
       - if content_for?(:page_title)

+ 1
- 1
app/views/layouts/auth.html.haml View File

@@ -13,4 +13,4 @@
13 13
 
14 14
       = yield
15 15
 
16
-= render template: "layouts/application"
16
+= render template: 'layouts/application'

+ 2
- 2
app/views/layouts/embedded.html.haml View File

@@ -1,7 +1,7 @@
1 1
 !!! 5
2
-%html{:lang => I18n.locale}
2
+%html{ lang: I18n.locale }
3 3
   %head
4
-    %meta{:charset => 'utf-8'}/
4
+    %meta{ charset: 'utf-8' }/
5 5
     = stylesheet_link_tag 'application', media: 'all'
6 6
     = javascript_pack_tag 'public', integrity: true, crossorigin: 'anonymous'
7 7
   %body.embed

+ 6
- 6
app/views/layouts/error.html.haml View File

@@ -1,11 +1,11 @@
1 1
 !!!
2
-%html{:lang => I18n.locale}
2
+%html{ lang: I18n.locale }
3 3
   %head
4
-    %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
5
-    %meta{:charset => "utf-8"}/
4
+    %meta{ content: 'text/html; charset=UTF-8', 'http-equiv' => 'Content-Type' }/
5
+    %meta{ charset: 'utf-8' }/
6 6
     %title= yield :page_title
7
-    %meta{:content => "width=device-width,initial-scale=1", :name => "viewport"}/
8
-    %link{:href => "https://fonts.googleapis.com/css?family=Roboto:400", :rel => "stylesheet"}/
7
+    %meta{ content: 'width=device-width,initial-scale=1', name: 'viewport' }/
8
+    %link{ href: 'https://fonts.googleapis.com/css?family=Roboto:400', rel: 'stylesheet' }/
9 9
     :css
10 10
       body {
11 11
         font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
@@ -31,6 +31,6 @@
31 31
       }
32 32
   %body
33 33
     .dialog
34
-      %img{:alt => "Mastodon", :src => "/oops.png"}/
34
+      %img{ alt: 'Mastodon', src: '/oops.png' }/
35 35
       %div
36 36
         %h1= yield :content

+ 3
- 3
app/views/layouts/public.html.haml View File

@@ -7,9 +7,9 @@
7 7
     - if !user_signed_in? && single_user_mode?
8 8
       %span.single-user-login
9 9
         = link_to t('auth.login'), new_user_session_path
10
-        = "\u2014"
10
+        \u2014
11 11
     %span.domain= link_to site_hostname, root_path
12 12
     %span.powered-by
13
-      = t('generic.powered_by', link: link_to('Mastodon', 'https://github.com/tootsuite/mastodon')).html_safe
13
+      != t('generic.powered_by', link: link_to('Mastodon', 'https://github.com/tootsuite/mastodon'))
14 14
 
15
-= render template: "layouts/application"
15
+= render template: 'layouts/application'

+ 1
- 1
app/views/oauth/authorizations/new.html.haml View File

@@ -7,7 +7,7 @@
7 7
 
8 8
     %p
9 9
       = t('doorkeeper.authorizations.new.able_to')
10
-      = @pre_auth.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.map { |s| "<strong>#{s}</strong>"}.to_sentence.html_safe
10
+      != @pre_auth.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.map { |s| "<strong>#{s}</strong>" }.to_sentence
11 11
 
12 12
   = form_tag oauth_authorization_path, method: :post, class: 'simple_form' do
13 13
     = hidden_field_tag :client_id, @pre_auth.client.uid

+ 1
- 1
app/views/oauth/authorized_applications/index.html.haml View File

@@ -16,7 +16,7 @@
16 16
             = application.name
17 17
           - else
18 18
             = link_to application.name, application.website, target: '_blank', rel: 'noopener'
19
-        %th= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('<br />').html_safe
19
+        %th!= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('<br />')
20 20
         %td= l application.created_at
21 21
         %td
22 22
           - unless application.superapp?

+ 2
- 2
app/views/settings/profiles/show.html.haml View File

@@ -5,8 +5,8 @@
5 5
   = render 'shared/error_messages', object: @account
6 6
 
7 7
   .fields-group
8
-    = f.input :display_name, placeholder: t('simple_form.labels.defaults.display_name'), hint: t('simple_form.hints.defaults.display_name', counter: "<span class=\"name-counter\">#{30-@account.display_name.size}</span>").html_safe
9
-    = f.input :note, placeholder: t('simple_form.labels.defaults.note'), hint: t('simple_form.hints.defaults.note', counter: "<span class=\"note-counter\">#{160-@account.note.size}</span>").html_safe
8
+    = f.input :display_name, placeholder: t('simple_form.labels.defaults.display_name'), hint: t('simple_form.hints.defaults.display_name', counter: "<span class=\"name-counter\">#{30 - @account.display_name.size}</span>").html_safe
9
+    = f.input :note, placeholder: t('simple_form.labels.defaults.note'), hint: t('simple_form.hints.defaults.note', counter: "<span class=\"note-counter\">#{160 - @account.note.size}</span>").html_safe
10 10
     = f.input :avatar, wrapper: :with_label, hint: t('simple_form.hints.defaults.avatar')
11 11
     = f.input :header, wrapper: :with_label, hint: t('simple_form.hints.defaults.header')
12 12
 

+ 1
- 1
app/views/settings/two_factor_authentication/confirmations/new.html.haml View File

@@ -5,7 +5,7 @@
5 5
   %p.hint= t('two_factor_authentication.instructions_html')
6 6
 
7 7
   .qr-wrapper
8
-    .qr-code= raw @qrcode.as_svg(padding: 0, module_size: 4)
8
+    .qr-code!= @qrcode.as_svg(padding: 0, module_size: 4)
9 9
 
10 10
     .qr-alternative
11 11
       %p.hint= t('two_factor_authentication.manual_instructions')

+ 5
- 5
app/views/stream_entries/_detailed_status.html.haml View File

@@ -1,7 +1,7 @@
1 1
 .detailed-status.light
2 2
   = link_to TagManager.instance.url_for(status.account), class: 'detailed-status__display-name p-author h-card', target: stream_link_target, rel: 'noopener' do
3 3
     %div
4
-      %div.avatar
4
+      .avatar
5 5
         = image_tag status.account.avatar.url(:original), width: 48, height: 48, alt: '', class: 'u-photo'
6 6
     %span.display-name
7 7
       %strong.p-name.emojify= display_name(status.account)
@@ -10,16 +10,16 @@
10 10
   .status__content.p-name.emojify<
11 11
     - if status.spoiler_text?
12 12
       %p{ style: 'margin-bottom: 0' }<
13
-        %span.p-summary>= "#{status.spoiler_text} "
13
+        %span.p-summary> #{status.spoiler_text}&nbsp;
14 14
         %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more')
15
-    %div.e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
15
+    .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
16 16
 
17 17
   - unless status.media_attachments.empty?
18 18
     - if status.media_attachments.first.video?
19 19
       .video-player
20 20
         - if status.sensitive?
21 21
           = render partial: 'stream_entries/content_spoiler'
22
-        %video{ src: status.media_attachments.first.file.url(:original), loop: true, class: 'u-video' }
22
+        %video.u-video{ src: status.media_attachments.first.file.url(:original), loop: true }
23 23
     - else
24 24
       .detailed-status__attachments
25 25
         - if status.sensitive?
@@ -28,7 +28,7 @@
28 28
           - status.media_attachments.each do |media|
29 29
             = render partial: 'stream_entries/media', locals: { media: media }
30 30
 
31
-  %div.detailed-status__meta
31
+  .detailed-status__meta
32 32
     %data.dt-published{ value: status.created_at.to_time.iso8601 }
33 33
     = link_to TagManager.instance.url_for(status), class: 'detailed-status__datetime u-url u-uid', target: stream_link_target, rel: 'noopener' do
34 34
       %time{ datetime: status.created_at.iso8601, title: l(status.created_at), data: { format: t('time.formats.default') } }= l(status.created_at)

+ 1
- 1
app/views/stream_entries/_media.html.haml View File

@@ -1,4 +1,4 @@
1 1
 .media-item
2
-  = link_to media.remote_url.blank? ? media.file.url(:original) : media.remote_url, style: media.image? ? "background-image: url(#{media.file.url(:original)})" : "", target: '_blank', rel: 'noopener', class: "u-#{media.video? || media.gifv? ? 'video' : 'photo'}" do
2
+  = link_to media.remote_url.blank? ? media.file.url(:original) : media.remote_url, style: media.image? ? "background-image: url(#{media.file.url(:original)})" : '', target: '_blank', rel: 'noopener', class: "u-#{media.video? || media.gifv? ? 'video' : 'photo'}" do
3 3
     - unless media.image?
4 4
       %video{ src: media.file.url(:original), autoplay: true, loop: true }/

+ 2
- 2
app/views/stream_entries/_simple_status.html.haml View File

@@ -16,9 +16,9 @@
16 16
   .status__content.p-name.emojify<
17 17
     - if status.spoiler_text?
18 18
       %p{ style: 'margin-bottom: 0' }<
19
-        %span.p-summary>= "#{status.spoiler_text} "
19
+        %span.p-summary> #{status.spoiler_text}&nbsp;
20 20
         %a.status__content__spoiler-link{ href: '#' }= t('statuses.show_more')
21
-    %div.e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
21
+    .e-content{ lang: status.language, style: "display: #{status.spoiler_text? ? 'none' : 'block'}; direction: #{rtl?(status.content) ? 'rtl' : 'ltr'}" }= Formatter.instance.format(status)
22 22
 
23 23
   - unless status.media_attachments.empty?
24 24
     .status__attachments

+ 16
- 16
app/views/stream_entries/_status.html.haml View File

@@ -1,25 +1,25 @@
1
-- include_threads ||= false
2
-- is_predecessor  ||= false
3
-- is_successor    ||= false
4
-- direct_reply_id ||= false
5
-- parent_id       ||= false
6
-- is_direct_parent  = direct_reply_id == status.id
7
-- is_direct_child  = parent_id == status.in_reply_to_id
8
-- parent_id       ||= false
9
-- centered        ||= include_threads && !is_predecessor && !is_successor
10
-- h_class         = microformats_h_class(status, is_predecessor, is_successor, include_threads)
11
-- style_classes   = style_classes(status, is_predecessor, is_successor, include_threads)
12
-- mf_classes      = microformats_classes(status, is_direct_parent, is_direct_child)
13
-- entry_classes   = h_class + ' ' + mf_classes + ' ' + style_classes
1
+:ruby
2
+  include_threads ||= false
3
+  is_predecessor  ||= false
4
+  is_successor    ||= false
5
+  direct_reply_id ||= false
6
+  parent_id       ||= false
7
+  is_direct_parent = direct_reply_id == status.id
8
+  is_direct_child  = parent_id == status.in_reply_to_id
9
+  centered ||= include_threads && !is_predecessor && !is_successor
10
+  h_class       = microformats_h_class(status, is_predecessor, is_successor, include_threads)
11
+  style_classes = style_classes(status, is_predecessor, is_successor, include_threads)
12
+  mf_classes    = microformats_classes(status, is_direct_parent, is_direct_child)
13
+  entry_classes = h_class + ' ' + mf_classes + ' ' + style_classes
14 14
 
15 15
 - if status.reply? && include_threads
16
-  = render partial: 'stream_entries/status', collection: @ancestors, as: :status, locals: { is_predecessor: true, direct_reply_id: status.in_reply_to_id}
16
+  = render partial: 'stream_entries/status', collection: @ancestors, as: :status, locals: { is_predecessor: true, direct_reply_id: status.in_reply_to_id }
17 17
 
18 18
 .entry{ class: entry_classes }
19 19
 
20 20
   - if status.reblog?
21 21
     .pre-header
22
-      %div.pre-header__icon
22
+      .pre-header__icon
23 23
         = fa_icon('retweet fw')
24 24
       %span
25 25
         = link_to TagManager.instance.url_for(status.account), class: 'status__display-name muted' do
@@ -29,4 +29,4 @@
29 29
   = render (centered ? 'stream_entries/detailed_status' : 'stream_entries/simple_status'), status: status.proper
30 30
 
31 31
 - if include_threads
32
-  = render partial: 'stream_entries/status', collection: @descendants, as: :status, locals: { is_successor: true, parent_id: status.id}
32
+  = render partial: 'stream_entries/status', collection: @descendants, as: :status, locals: { is_successor: true, parent_id: status.id }

+ 1
- 1
app/views/tags/show.html.haml View File

@@ -4,7 +4,7 @@
4 4
 .compact-header
5 5
   %h1<
6 6
     = link_to site_title, root_path
7
-    %small= "##{@tag.name}"
7
+    %small ##{@tag.name}
8 8
 
9 9
 - if @statuses.empty?
10 10
   .accounts-grid