{"action":"created","issue":{"url":"https://api.github.com/repos/github/linguist/issues/4134","repository_url":"https://api.github.com/repos/github/linguist","labels_url":"https://api.github.com/repos/github/linguist/issues/4134/labels{/name}","comments_url":"https://api.github.com/repos/github/linguist/issues/4134/comments","events_url":"https://api.github.com/repos/github/linguist/issues/4134/events","html_url":"https://github.com/github/linguist/pull/4134","id":323464615,"number":4134,"title":"Silence warnings being emitted when running tests","user":{"login":"Alhadis","id":2346707,"avatar_url":"https://avatars0.githubusercontent.com/u/2346707?v=4","gravatar_id":"","url":"https://api.github.com/users/Alhadis","html_url":"https://github.com/Alhadis","followers_url":"https://api.github.com/users/Alhadis/followers","following_url":"https://api.github.com/users/Alhadis/following{/other_user}","gists_url":"https://api.github.com/users/Alhadis/gists{/gist_id}","starred_url":"https://api.github.com/users/Alhadis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alhadis/subscriptions","organizations_url":"https://api.github.com/users/Alhadis/orgs","repos_url":"https://api.github.com/users/Alhadis/repos","events_url":"https://api.github.com/users/Alhadis/events{/privacy}","received_events_url":"https://api.github.com/users/Alhadis/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-16T04:25:56Z","updated_at":"2018-05-21T08:43:36Z","closed_at":"2018-05-21T08:42:49Z","author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/github/linguist/pulls/4134","html_url":"https://github.com/github/linguist/pull/4134","diff_url":"https://github.com/github/linguist/pull/4134.diff","patch_url":"https://github.com/github/linguist/pull/4134.patch"},"body":"I saw these warnings as I was running tests for #4133:\r\n\r\n~~~\r\nlib/linguist/heuristics.rb:414: warning: character class has duplicated range: /[A-Z\\.][\\w\\d\\.]*:{/\r\nlib/linguist/language.rb:504: warning: assigned but unused variable - filenames\r\n~~~\r\n\r\nThey're trivial but still unrelated to what #4133 is doing, so I siphoned these changes off to a separate PR. :-) Explanation of changes:\r\n\r\n> warning: character class has duplicated range: `/[A-Z\\.][\\w\\d\\.]*:{/`\r\n\r\nThat's happening because `\\w` already covers the character ranges that `\\d` does. Using them together in a bracketed character class is therefore redundant.\r\n\r\nI also removed the backslash from the dots too, because hold no special meaning when used within a character class. It wouldn't make sense for it to match any single character in a defined subset of specific characters you're trying to match. =)\r\n\r\n> warning: assigned but unused variable - filenames\r\n\r\nAdmittedly, I don't even know what this line is doing:\r\n\r\n~~~rb\r\nfilenames = Samples.cache['filenames']\r\n~~~\r\n\r\nBut I didn't wanna remove it in case it was there to deliberately invoke a side-effect by accessing `Samples.cache['filenames']`. But I wanted it to shut up so I found a way to make it \"used\" by sprucing up a conditional assignment:\r\n\r\n~~~rb\r\n-    if interpreters == nil\t+    interpreters = {} if interpreters.nil?\r\n-      interpreters = {}\t+    filenames    = {} if filenames.nil?\r\n-    end\r\n+    interpreters = {} if interpreters.nil?\r\n+    filenames    = {} if filenames.nil?\r\n~~~\r\n\r\nWhich inevitably lead to me polishing whitespace elsewhere in the file, as you'll see by the diffs. :grin: I'd apologise for being a neat-freak, but you guys know I'm not actually sorry. :heart: "},"comment":{"url":"https://api.github.com/repos/github/linguist/issues/comments/390591885","html_url":"https://github.com/github/linguist/pull/4134#issuecomment-390591885","issue_url":"https://api.github.com/repos/github/linguist/issues/4134","id":390591885,"user":{"login":"Alhadis","id":2346707,"avatar_url":"https://avatars0.githubusercontent.com/u/2346707?v=4","gravatar_id":"","url":"https://api.github.com/users/Alhadis","html_url":"https://github.com/Alhadis","followers_url":"https://api.github.com/users/Alhadis/followers","following_url":"https://api.github.com/users/Alhadis/following{/other_user}","gists_url":"https://api.github.com/users/Alhadis/gists{/gist_id}","starred_url":"https://api.github.com/users/Alhadis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alhadis/subscriptions","organizations_url":"https://api.github.com/users/Alhadis/orgs","repos_url":"https://api.github.com/users/Alhadis/repos","events_url":"https://api.github.com/users/Alhadis/events{/privacy}","received_events_url":"https://api.github.com/users/Alhadis/received_events","type":"User","site_admin":false},"created_at":"2018-05-21T08:43:35Z","updated_at":"2018-05-21T08:43:35Z","author_association":"COLLABORATOR","body":"Now we just need to get Charlock Holmes to STFU about that encoding variable not being initialised. 😂👌"}}
{"actor":{"display_login":"Alhadis"}}