{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/comments/35696622","id":35696622,"diff_hunk":"@@ -0,0 +1,108 @@\n+/* This Source Code Form is subject to the terms of the Mozilla Public\n+ * License, v. 2.0. If a copy of the MPL was not distributed with this\n+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */\n+\n+module.exports = function (grunt) {\n+  grunt.registerTask('scan-email-translations', 'Scan the generated emails for invalid style tags', [\n+    'generate-valid-styles',\n+    'po2json',\n+    'verify-styles'\n+    ]\n+  );\n+\n+  grunt.registerMultiTask('verify-styles', 'Verify whether the translated styles are valid', function (){\n+    var fileArray = this.files[0].src;\n+    var contents = grunt.file.read(fileArray.shift());\n+    var styleArray = JSON.parse(contents);\n+\n+    var hasErrors = 0;\n+    var styleRegex = /style=\"(.*?)\"/ig;\n+\n+    fileArray.forEach(function (src) {\n+      var json = JSON.parse(grunt.file.read(src));\n+      var styleList = [];\n+      for(var key in json) {\n+        if(key.indexOf('style') > 0) {\n+          styleList.push(key);\n+        }\n+      }\n+      // Check if there were any styles found, .match() might return null\n+      if (styleList !== null) {\n+        styleList = styleList.map(stripSpecialChars);\n+        // retrieve the style attribute and its contents and store\n+        styleList = styleList.map(function (str) {\n+          if (styleRegex.test(str)) {\n+            str = str.match(styleRegex)[0];\n+            return str;\n+          }\n+        });\n+        styleList.forEach(function (style) {\n+          if(style !== undefined){\n+            if (styleArray.indexOf(style) === -1) {\n+              grunt.log.error('Found a style which should not be there', style, src);\n+              hasErrors = hasErrors + 1;\n+            }\n+          }\n+        });\n+      }\n+    });\n+    if (hasErrors !== 0) {\n+      grunt.fail.warn('Found ' + hasErrors + ' ' + grunt.util.pluralize(hasErrors, 'error/errors') + ' in ' + fileArray.length + ' files');\n+    } else {\n+      grunt.log.writeln('Checked ' + fileArray.length + ' files for valid styles and found nothing wrong.');\n+    }\n+  });\n+\n+  grunt.config('verify-styles', {\n+    dist: {\n+      files: [\n+        {\n+          expand: false,\n+          src: [\n+            '.tmp/validStyles.json',\n+            '.tmp/l10n/*/messages.json'","path":"grunttasks/scan-email-translations.js","position":63,"original_position":63,"commit_id":"f43bfc883fea26c93cb482d12225237bef04165d","original_commit_id":"f43bfc883fea26c93cb482d12225237bef04165d","user":{"login":"pdehaan","id":557895,"avatar_url":"https://avatars.githubusercontent.com/u/557895?v=3","gravatar_id":"","url":"https://api.github.com/users/pdehaan","html_url":"https://github.com/pdehaan","followers_url":"https://api.github.com/users/pdehaan/followers","following_url":"https://api.github.com/users/pdehaan/following{/other_user}","gists_url":"https://api.github.com/users/pdehaan/gists{/gist_id}","starred_url":"https://api.github.com/users/pdehaan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdehaan/subscriptions","organizations_url":"https://api.github.com/users/pdehaan/orgs","repos_url":"https://api.github.com/users/pdehaan/repos","events_url":"https://api.github.com/users/pdehaan/events{/privacy}","received_events_url":"https://api.github.com/users/pdehaan/received_events","type":"User","site_admin":false},"body":"Do we want to lint the `.tmp/l10n/*/client.json` files as well, or just `messages.json`?\r\nAlso, do we need to verify the validStyles.json file since that was already generated via `generate-valid-styles` task?","created_at":"2015-07-28T20:30:39Z","updated_at":"2015-07-28T20:30:39Z","html_url":"https://github.com/mozilla/fxa-content-server-l10n/pull/62#discussion_r35696622","pull_request_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/62","_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/comments/35696622"},"html":{"href":"https://github.com/mozilla/fxa-content-server-l10n/pull/62#discussion_r35696622"},"pull_request":{"href":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/62"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/62","id":40959047,"html_url":"https://github.com/mozilla/fxa-content-server-l10n/pull/62","diff_url":"https://github.com/mozilla/fxa-content-server-l10n/pull/62.diff","patch_url":"https://github.com/mozilla/fxa-content-server-l10n/pull/62.patch","issue_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/issues/62","number":62,"state":"open","locked":false,"title":"feat(client): scan emails for invalid style attr","user":{"login":"TDA","id":432707,"avatar_url":"https://avatars.githubusercontent.com/u/432707?v=3","gravatar_id":"","url":"https://api.github.com/users/TDA","html_url":"https://github.com/TDA","followers_url":"https://api.github.com/users/TDA/followers","following_url":"https://api.github.com/users/TDA/following{/other_user}","gists_url":"https://api.github.com/users/TDA/gists{/gist_id}","starred_url":"https://api.github.com/users/TDA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TDA/subscriptions","organizations_url":"https://api.github.com/users/TDA/orgs","repos_url":"https://api.github.com/users/TDA/repos","events_url":"https://api.github.com/users/TDA/events{/privacy}","received_events_url":"https://api.github.com/users/TDA/received_events","type":"User","site_admin":false},"body":"Add grunt to l10n repo\r\nAdd a grunt task to scan for invalid style attributes\r\nFixes #67 in auth-mailer repo\r\nhttps://github.com/mozilla/fxa-auth-mailer/issues/67\r\n@vladikoff \r\n@pdehaan ","created_at":"2015-07-27T22:56:16Z","updated_at":"2015-07-28T20:30:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"018999da0f0a95bcf7f12fc39af3a7282e11e0c3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/62/commits","review_comments_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/62/comments","review_comment_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/issues/62/comments","statuses_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/statuses/f43bfc883fea26c93cb482d12225237bef04165d","head":{"label":"TDA:master","ref":"master","sha":"f43bfc883fea26c93cb482d12225237bef04165d","user":{"login":"TDA","id":432707,"avatar_url":"https://avatars.githubusercontent.com/u/432707?v=3","gravatar_id":"","url":"https://api.github.com/users/TDA","html_url":"https://github.com/TDA","followers_url":"https://api.github.com/users/TDA/followers","following_url":"https://api.github.com/users/TDA/following{/other_user}","gists_url":"https://api.github.com/users/TDA/gists{/gist_id}","starred_url":"https://api.github.com/users/TDA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TDA/subscriptions","organizations_url":"https://api.github.com/users/TDA/orgs","repos_url":"https://api.github.com/users/TDA/repos","events_url":"https://api.github.com/users/TDA/events{/privacy}","received_events_url":"https://api.github.com/users/TDA/received_events","type":"User","site_admin":false},"repo":{"id":39801831,"name":"fxa-content-server-l10n","full_name":"TDA/fxa-content-server-l10n","owner":{"login":"TDA","id":432707,"avatar_url":"https://avatars.githubusercontent.com/u/432707?v=3","gravatar_id":"","url":"https://api.github.com/users/TDA","html_url":"https://github.com/TDA","followers_url":"https://api.github.com/users/TDA/followers","following_url":"https://api.github.com/users/TDA/following{/other_user}","gists_url":"https://api.github.com/users/TDA/gists{/gist_id}","starred_url":"https://api.github.com/users/TDA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TDA/subscriptions","organizations_url":"https://api.github.com/users/TDA/orgs","repos_url":"https://api.github.com/users/TDA/repos","events_url":"https://api.github.com/users/TDA/events{/privacy}","received_events_url":"https://api.github.com/users/TDA/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TDA/fxa-content-server-l10n","description":"translated strings for fxa-content-server","fork":true,"url":"https://api.github.com/repos/TDA/fxa-content-server-l10n","forks_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/forks","keys_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/teams","hooks_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/hooks","issue_events_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/issues/events{/number}","events_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/events","assignees_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/assignees{/user}","branches_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/branches{/branch}","tags_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/tags","blobs_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/git/refs{/sha}","trees_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/statuses/{sha}","languages_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/languages","stargazers_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/stargazers","contributors_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/contributors","subscribers_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/subscribers","subscription_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/subscription","commits_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/commits{/sha}","git_commits_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/git/commits{/sha}","comments_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/comments{/number}","issue_comment_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/issues/comments{/number}","contents_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/contents/{+path}","compare_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/merges","archive_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/downloads","issues_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/issues{/number}","pulls_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/pulls{/number}","milestones_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/milestones{/number}","notifications_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/labels{/name}","releases_url":"https://api.github.com/repos/TDA/fxa-content-server-l10n/releases{/id}","created_at":"2015-07-27T22:54:34Z","updated_at":"2015-07-28T20:02:35Z","pushed_at":"2015-07-28T20:23:41Z","git_url":"git://github.com/TDA/fxa-content-server-l10n.git","ssh_url":"git@github.com:TDA/fxa-content-server-l10n.git","clone_url":"https://github.com/TDA/fxa-content-server-l10n.git","svn_url":"https://github.com/TDA/fxa-content-server-l10n","homepage":null,"size":9362,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"ccd87e66f68ada974edab48002584102e784b324","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":17193734,"name":"fxa-content-server-l10n","full_name":"mozilla/fxa-content-server-l10n","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/fxa-content-server-l10n","description":"translated strings for fxa-content-server","fork":false,"url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n","forks_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/forks","keys_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/teams","hooks_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/hooks","issue_events_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/events","assignees_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/tags","blobs_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/languages","stargazers_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/stargazers","contributors_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/contributors","subscribers_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/subscribers","subscription_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/subscription","commits_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/merges","archive_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/downloads","issues_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/releases{/id}","created_at":"2014-02-26T00:45:33Z","updated_at":"2015-07-22T08:42:01Z","pushed_at":"2015-07-28T20:23:41Z","git_url":"git://github.com/mozilla/fxa-content-server-l10n.git","ssh_url":"git@github.com:mozilla/fxa-content-server-l10n.git","clone_url":"https://github.com/mozilla/fxa-content-server-l10n.git","svn_url":"https://github.com/mozilla/fxa-content-server-l10n","homepage":null,"size":9362,"stargazers_count":4,"watchers_count":4,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":6,"forks":11,"open_issues":6,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/62"},"html":{"href":"https://github.com/mozilla/fxa-content-server-l10n/pull/62"},"issue":{"href":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/issues/62"},"comments":{"href":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/issues/62/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/62/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/pulls/62/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/fxa-content-server-l10n/statuses/f43bfc883fea26c93cb482d12225237bef04165d"}}}}