From 71dc50f048ce5604e331f69cb50c4fa6b4a73bbb Mon Sep 17 00:00:00 2001
From: Kushal Pandya <kushal@gitlab.com>
Date: Thu, 22 Dec 2016 15:00:56 +0530
Subject: [PATCH] HAMLLint: fix `AltText` offences

---
 app/views/notify/pipeline_failed_email.html.haml   |  6 +++---
 app/views/notify/pipeline_success_email.html.haml  |  6 +++---
 app/views/profiles/show.html.haml                  |  2 +-
 app/views/projects/blob/_image.html.haml           |  4 ++--
 .../projects/boards/components/_card.html.haml     |  2 +-
 .../boards/components/sidebar/_assignee.html.haml  |  2 +-
 app/views/projects/diffs/_image.html.haml          | 14 +++++++-------
 7 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/app/views/notify/pipeline_failed_email.html.haml b/app/views/notify/pipeline_failed_email.html.haml
index 001d9c48555..751f81db1cb 100644
--- a/app/views/notify/pipeline_failed_email.html.haml
+++ b/app/views/notify/pipeline_failed_email.html.haml
@@ -90,7 +90,7 @@
                                       %tbody
                                         %tr
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;padding-right:5px;"}
-                                            %img{height: "13", src: image_url('mailers/ci_pipeline_notif_v1/icon-branch-gray.gif'), style: "display:block;", width: "13"}/
+                                            %img{height: "13", src: image_url('mailers/ci_pipeline_notif_v1/icon-branch-gray.gif'), style: "display:block;", width: "13", alt: "Branch icon"}/
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;"}
                                             %a.muted{href: commits_url(@pipeline), style: "color:#333333;text-decoration:none;"}
                                               = @pipeline.ref
@@ -101,7 +101,7 @@
                                       %tbody
                                         %tr
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;padding-right:5px;"}
-                                            %img{height: "13", src: image_url('mailers/ci_pipeline_notif_v1/icon-commit-gray.gif'), style: "display:block;", width: "13"}/
+                                            %img{height: "13", src: image_url('mailers/ci_pipeline_notif_v1/icon-commit-gray.gif'), style: "display:block;", width: "13", alt: "Commit icon"}/
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;"}
                                             %a{href: commit_url(@pipeline), style: "color:#3777b0;text-decoration:none;"}
                                               = @pipeline.short_sha
@@ -119,7 +119,7 @@
                                         %tr
                                           - commit = @pipeline.commit
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;padding-right:5px;"}
-                                            %img.avatar{height: "24", src: avatar_icon(commit.author || commit.author_email, 24), style: "display:block;border-radius:12px;margin:-2px 0;", width: "24"}/
+                                            %img.avatar{height: "24", src: avatar_icon(commit.author || commit.author_email, 24), style: "display:block;border-radius:12px;margin:-2px 0;", width: "24", alt: "Avatar"}/
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;"}
                                             - if commit.author
                                               %a.muted{href: user_url(commit.author), style: "color:#333333;text-decoration:none;"}
diff --git a/app/views/notify/pipeline_success_email.html.haml b/app/views/notify/pipeline_success_email.html.haml
index 56c1949ab2b..d64232ca8f2 100644
--- a/app/views/notify/pipeline_success_email.html.haml
+++ b/app/views/notify/pipeline_success_email.html.haml
@@ -90,7 +90,7 @@
                                       %tbody
                                         %tr
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;padding-right:5px;"}
-                                            %img{height: "13", src: image_url('mailers/ci_pipeline_notif_v1/icon-branch-gray.gif'), style: "display:block;", width: "13"}/
+                                            %img{height: "13", src: image_url('mailers/ci_pipeline_notif_v1/icon-branch-gray.gif'), style: "display:block;", width: "13", alt: "Branch icon"}/
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;"}
                                             %a.muted{href: commits_url(@pipeline), style: "color:#333333;text-decoration:none;"}
                                               = @pipeline.ref
@@ -101,7 +101,7 @@
                                       %tbody
                                         %tr
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;padding-right:5px;"}
-                                            %img{height: "13", src: image_url('mailers/ci_pipeline_notif_v1/icon-commit-gray.gif'), style: "display:block;", width: "13"}/
+                                            %img{height: "13", src: image_url('mailers/ci_pipeline_notif_v1/icon-commit-gray.gif'), style: "display:block;", width: "13", alt: "Commit icon"}/
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;"}
                                             %a{href: commit_url(@pipeline), style: "color:#3777b0;text-decoration:none;"}
                                               = @pipeline.short_sha
@@ -119,7 +119,7 @@
                                         %tr
                                           - commit = @pipeline.commit
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;padding-right:5px;"}
-                                            %img.avatar{height: "24", src: avatar_icon(commit.author || commit.author_email, 24), style: "display:block;border-radius:12px;margin:-2px 0;", width: "24"}/
+                                            %img.avatar{height: "24", src: avatar_icon(commit.author || commit.author_email, 24), style: "display:block;border-radius:12px;margin:-2px 0;", width: "24", alt: "Avatar"}/
                                           %td{style: "font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:15px;line-height:1.4;vertical-align:middle;"}
                                             - if commit.author
                                               %a.muted{href: user_url(commit.author), style: "color:#333333;text-decoration:none;"}
diff --git a/app/views/profiles/show.html.haml b/app/views/profiles/show.html.haml
index 578af9fe98d..859273ae94a 100644
--- a/app/views/profiles/show.html.haml
+++ b/app/views/profiles/show.html.haml
@@ -108,7 +108,7 @@
           Position and size your new avatar
       .modal-body
         .profile-crop-image-container
-          %img.modal-profile-crop-image
+          %img.modal-profile-crop-image{ alt: "Avatar cropper" }
         .crop-controls
           .btn-group
             %button.btn.btn-primary{ data: { method: "zoom", option: "0.1" } }
diff --git a/app/views/projects/blob/_image.html.haml b/app/views/projects/blob/_image.html.haml
index 4c356d1f07f..3d47351cec8 100644
--- a/app/views/projects/blob/_image.html.haml
+++ b/app/views/projects/blob/_image.html.haml
@@ -5,11 +5,11 @@
       - # be wrong/strange if RawController modified the data.
       - blob.load_all_data!(@repository)
       - blob = sanitize_svg(blob)
-      %img{src: "data:#{blob.mime_type};base64,#{Base64.encode64(blob.data)}"}
+      %img{src: "data:#{blob.mime_type};base64,#{Base64.encode64(blob.data)}", alt: "#{blob.name}"}
     - else
       .nothing-here-block
         The SVG could not be displayed as it is too large, you can
         #{link_to('view the raw file', namespace_project_raw_path(@project.namespace, @project, @id), target: '_blank')}
         instead.
   - else
-    %img{src: namespace_project_raw_path(@project.namespace, @project, tree_join(@commit.id, blob.path))}
+    %img{src: namespace_project_raw_path(@project.namespace, @project, tree_join(@commit.id, blob.path)), alt: "#{blob.name}"}
diff --git a/app/views/projects/boards/components/_card.html.haml b/app/views/projects/boards/components/_card.html.haml
index 1f31496e73f..e4c2aff46ec 100644
--- a/app/views/projects/boards/components/_card.html.haml
+++ b/app/views/projects/boards/components/_card.html.haml
@@ -17,7 +17,7 @@
       ":title" => '"Assigned to " + issue.assignee.name',
       "v-if" => "issue.assignee",
       data: { container: 'body' } }
-      %img.avatar.avatar-inline.s20{ ":src" => "issue.assignee.avatar", width: 20, height: 20 }
+      %img.avatar.avatar-inline.s20{ ":src" => "issue.assignee.avatar", width: 20, height: 20, alt: "Avatar" }
     %button.label.color-label.has-tooltip{ "v-for" => "label in issue.labels",
       type: "button",
       "v-if" => "(!list.label || label.id !== list.label.id)",
diff --git a/app/views/projects/boards/components/sidebar/_assignee.html.haml b/app/views/projects/boards/components/sidebar/_assignee.html.haml
index 8fe1b832071..e75ce305440 100644
--- a/app/views/projects/boards/components/sidebar/_assignee.html.haml
+++ b/app/views/projects/boards/components/sidebar/_assignee.html.haml
@@ -14,7 +14,7 @@
     %a.author_link.bold{ ":href" => "'#{root_url}' + issue.assignee.username",
       "v-if" => "issue.assignee" }
       %img.avatar.avatar-inline.s32{ ":src" => "issue.assignee.avatar",
-        width: "32" }
+        width: "32", alt: "Avatar" }
       %span.author
         {{ issue.assignee.name }}
       %span.username
diff --git a/app/views/projects/diffs/_image.html.haml b/app/views/projects/diffs/_image.html.haml
index 9ec6a7aa5cd..28fee887f4d 100644
--- a/app/views/projects/diffs/_image.html.haml
+++ b/app/views/projects/diffs/_image.html.haml
@@ -8,7 +8,7 @@
   .image
     %span.wrap
       .frame{class: image_diff_class(diff)}
-        %img{src: diff.deleted_file ? old_file_raw_path : file_raw_path}
+        %img{src: diff.deleted_file ? old_file_raw_path : file_raw_path, alt: diff.new_path}
       %p.image-info= "#{number_to_human_size file.size}"
 - else
   .image
@@ -16,7 +16,7 @@
       %span.wrap
         .frame.deleted
           %a{href: namespace_project_blob_path(@project.namespace, @project, tree_join(diff_file.old_ref, diff.old_path))}
-            %img{src: old_file_raw_path}
+            %img{src: old_file_raw_path, alt: diff.old_path}
         %p.image-info.hide
           %span.meta-filesize= "#{number_to_human_size old_file.size}"
           |
@@ -28,7 +28,7 @@
       %span.wrap
         .frame.added
           %a{href: namespace_project_blob_path(@project.namespace, @project, tree_join(diff_file.new_ref, diff.new_path))}
-            %img{src: file_raw_path}
+            %img{src: file_raw_path, alt: diff.new_path}
         %p.image-info.hide
           %span.meta-filesize= "#{number_to_human_size file.size}"
           |
@@ -41,10 +41,10 @@
     %div.swipe.view.hide
       .swipe-frame
         .frame.deleted
-          %img{src: old_file_raw_path}
+          %img{src: old_file_raw_path, alt: diff.old_path}
         .swipe-wrap
           .frame.added
-            %img{src: file_raw_path}
+            %img{src: file_raw_path, alt: diff.new_path}
         %span.swipe-bar
           %span.top-handle
           %span.bottom-handle
@@ -52,9 +52,9 @@
     %div.onion-skin.view.hide
       .onion-skin-frame
         .frame.deleted
-          %img{src: old_file_raw_path}
+          %img{src: old_file_raw_path, alt: diff.old_path}
         .frame.added
-          %img{src: file_raw_path}
+          %img{src: file_raw_path, alt: diff.new_path}
         .controls
           .transparent
           .drag-track
-- 
GitLab