{"action":"created","comment":{"url":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments/70590521","id":70590521,"diff_hunk":"@@ -34,24 +34,22 @@\n       expect(cop.messages).to be_empty\n     end\n \n-    it 'registers an offense for a string with single quotes and what appears' \\\n-       ' to be an escape' do\n-      # There is no such thing as escapes in a %q() string\n-      # So this can just as well be written with double quotes\n-      inspect_source(cop, \"%q('hi\\\\t')\")","path":"spec/rubocop/cop/style/unneeded_percent_q_spec.rb","position":8,"original_position":8,"commit_id":"5bcbcde44538e7f1df1da98e72510bb68651dca5","original_commit_id":"5bcbcde44538e7f1df1da98e72510bb68651dca5","user":{"login":"owst","id":117234,"avatar_url":"https://avatars.githubusercontent.com/u/117234?v=3","gravatar_id":"","url":"https://api.github.com/users/owst","html_url":"https://github.com/owst","followers_url":"https://api.github.com/users/owst/followers","following_url":"https://api.github.com/users/owst/following{/other_user}","gists_url":"https://api.github.com/users/owst/gists{/gist_id}","starred_url":"https://api.github.com/users/owst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owst/subscriptions","organizations_url":"https://api.github.com/users/owst/orgs","repos_url":"https://api.github.com/users/owst/repos","events_url":"https://api.github.com/users/owst/events{/privacy}","received_events_url":"https://api.github.com/users/owst/received_events","type":"User","site_admin":false},"body":"This test was not correct. The source code string evaluates to `%q('hi\\t')`, i.e. there is an escaped `t`. Replacing `%q` here gives a different string:\r\n```\r\nirb(main):001:0> puts \"%q('hi\\\\t')\"\r\n%q('hi\\t')\r\n=> nil\r\nirb(main):002:0> puts %q('hi\\t')\r\n'hi\\t'\r\n=> nil\r\nirb(main):003:0> puts \"'hi\\t'\"\r\n'hi     '\r\n```","created_at":"2016-07-13T09:14:51Z","updated_at":"2016-07-13T09:14:51Z","html_url":"https://github.com/bbatsov/rubocop/pull/3315#discussion_r70590521","pull_request_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/3315","_links":{"self":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments/70590521"},"html":{"href":"https://github.com/bbatsov/rubocop/pull/3315#discussion_r70590521"},"pull_request":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/3315"}}},"pull_request":{"url":"https://api.github.com/repos/bbatsov/rubocop/pulls/3315","id":77254650,"html_url":"https://github.com/bbatsov/rubocop/pull/3315","diff_url":"https://github.com/bbatsov/rubocop/pull/3315.diff","patch_url":"https://github.com/bbatsov/rubocop/pull/3315.patch","issue_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3315","number":3315,"state":"open","locked":false,"title":"[Fix #3300] Do not replace `%q()`s containing escaped non-backslashes","user":{"login":"owst","id":117234,"avatar_url":"https://avatars.githubusercontent.com/u/117234?v=3","gravatar_id":"","url":"https://api.github.com/users/owst","html_url":"https://github.com/owst","followers_url":"https://api.github.com/users/owst/followers","following_url":"https://api.github.com/users/owst/following{/other_user}","gists_url":"https://api.github.com/users/owst/gists{/gist_id}","starred_url":"https://api.github.com/users/owst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owst/subscriptions","organizations_url":"https://api.github.com/users/owst/orgs","repos_url":"https://api.github.com/users/owst/repos","events_url":"https://api.github.com/users/owst/events{/privacy}","received_events_url":"https://api.github.com/users/owst/received_events","type":"User","site_admin":false},"body":"In `%q(...)` `\\\\` is the only escape (evaluating to a single \\), so if a `%q` literal contains escaped characters that are not `\\` we should not change to double quotes, since that will change the string:\r\n```\r\nirb(main):001:0> puts %q(\\\\ \\')\r\n\\ \\'\r\nirb(main):002:0> puts \"\\\\ \\'\"\r\n\\ '\r\n```\r\n\r\n-----------------\r\n\r\nBefore submitting the PR make sure the following are checked:\r\n\r\n* [x] Wrote [good commit messages][1].\r\n* [x] Commit message starts with `[Fix #issue-number]` (if the related issue exists).\r\n* [x] Used the same coding conventions as the rest of the project.\r\n* [x] Feature branch is up-to-date with `master` (if not - rebase it).\r\n* [x] Squashed related commits together.\r\n* [x] Added tests.\r\n* [x] Added an entry to the [Changelog](../blob/master/CHANGELOG.md) if the new code introduces user-observable changes. See [changelog entry format](../blob/master/CONTRIBUTING.md#changelog-entry-format).\r\n* [x] All tests are passing.\r\n* [x] The new code doesn't generate RuboCop offenses.\r\n* [x] The PR relates to *only* one subject with a clear title\r\n  and description in grammatically correct, complete sentences.\r\n\r\n[1]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html\r\n\r\n","created_at":"2016-07-13T09:12:53Z","updated_at":"2016-07-13T09:14:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3ec59d2e39cd80171f997d3fdb7f9e14d6448198","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/3315/commits","review_comments_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/3315/comments","review_comment_url":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments{/number}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/issues/3315/comments","statuses_url":"https://api.github.com/repos/bbatsov/rubocop/statuses/5bcbcde44538e7f1df1da98e72510bb68651dca5","head":{"label":"owst:do_not_replace_percent_q_containing_escaped_non-backslash","ref":"do_not_replace_percent_q_containing_escaped_non-backslash","sha":"5bcbcde44538e7f1df1da98e72510bb68651dca5","user":{"login":"owst","id":117234,"avatar_url":"https://avatars.githubusercontent.com/u/117234?v=3","gravatar_id":"","url":"https://api.github.com/users/owst","html_url":"https://github.com/owst","followers_url":"https://api.github.com/users/owst/followers","following_url":"https://api.github.com/users/owst/following{/other_user}","gists_url":"https://api.github.com/users/owst/gists{/gist_id}","starred_url":"https://api.github.com/users/owst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owst/subscriptions","organizations_url":"https://api.github.com/users/owst/orgs","repos_url":"https://api.github.com/users/owst/repos","events_url":"https://api.github.com/users/owst/events{/privacy}","received_events_url":"https://api.github.com/users/owst/received_events","type":"User","site_admin":false},"repo":{"id":50128601,"name":"rubocop","full_name":"owst/rubocop","owner":{"login":"owst","id":117234,"avatar_url":"https://avatars.githubusercontent.com/u/117234?v=3","gravatar_id":"","url":"https://api.github.com/users/owst","html_url":"https://github.com/owst","followers_url":"https://api.github.com/users/owst/followers","following_url":"https://api.github.com/users/owst/following{/other_user}","gists_url":"https://api.github.com/users/owst/gists{/gist_id}","starred_url":"https://api.github.com/users/owst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/owst/subscriptions","organizations_url":"https://api.github.com/users/owst/orgs","repos_url":"https://api.github.com/users/owst/repos","events_url":"https://api.github.com/users/owst/events{/privacy}","received_events_url":"https://api.github.com/users/owst/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/owst/rubocop","description":"A Ruby static code analyzer, based on the community Ruby style guide.","fork":true,"url":"https://api.github.com/repos/owst/rubocop","forks_url":"https://api.github.com/repos/owst/rubocop/forks","keys_url":"https://api.github.com/repos/owst/rubocop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/owst/rubocop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/owst/rubocop/teams","hooks_url":"https://api.github.com/repos/owst/rubocop/hooks","issue_events_url":"https://api.github.com/repos/owst/rubocop/issues/events{/number}","events_url":"https://api.github.com/repos/owst/rubocop/events","assignees_url":"https://api.github.com/repos/owst/rubocop/assignees{/user}","branches_url":"https://api.github.com/repos/owst/rubocop/branches{/branch}","tags_url":"https://api.github.com/repos/owst/rubocop/tags","blobs_url":"https://api.github.com/repos/owst/rubocop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/owst/rubocop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/owst/rubocop/git/refs{/sha}","trees_url":"https://api.github.com/repos/owst/rubocop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/owst/rubocop/statuses/{sha}","languages_url":"https://api.github.com/repos/owst/rubocop/languages","stargazers_url":"https://api.github.com/repos/owst/rubocop/stargazers","contributors_url":"https://api.github.com/repos/owst/rubocop/contributors","subscribers_url":"https://api.github.com/repos/owst/rubocop/subscribers","subscription_url":"https://api.github.com/repos/owst/rubocop/subscription","commits_url":"https://api.github.com/repos/owst/rubocop/commits{/sha}","git_commits_url":"https://api.github.com/repos/owst/rubocop/git/commits{/sha}","comments_url":"https://api.github.com/repos/owst/rubocop/comments{/number}","issue_comment_url":"https://api.github.com/repos/owst/rubocop/issues/comments{/number}","contents_url":"https://api.github.com/repos/owst/rubocop/contents/{+path}","compare_url":"https://api.github.com/repos/owst/rubocop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/owst/rubocop/merges","archive_url":"https://api.github.com/repos/owst/rubocop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/owst/rubocop/downloads","issues_url":"https://api.github.com/repos/owst/rubocop/issues{/number}","pulls_url":"https://api.github.com/repos/owst/rubocop/pulls{/number}","milestones_url":"https://api.github.com/repos/owst/rubocop/milestones{/number}","notifications_url":"https://api.github.com/repos/owst/rubocop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/owst/rubocop/labels{/name}","releases_url":"https://api.github.com/repos/owst/rubocop/releases{/id}","deployments_url":"https://api.github.com/repos/owst/rubocop/deployments","created_at":"2016-01-21T18:41:29Z","updated_at":"2016-01-21T18:41:32Z","pushed_at":"2016-07-13T09:09:58Z","git_url":"git://github.com/owst/rubocop.git","ssh_url":"git@github.com:owst/rubocop.git","clone_url":"https://github.com/owst/rubocop.git","svn_url":"https://github.com/owst/rubocop","homepage":"","size":12416,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"bbatsov:master","ref":"master","sha":"1437f63fdf85da4a19a77a865e99df84ddfbe1d5","user":{"login":"bbatsov","id":103882,"avatar_url":"https://avatars.githubusercontent.com/u/103882?v=3","gravatar_id":"","url":"https://api.github.com/users/bbatsov","html_url":"https://github.com/bbatsov","followers_url":"https://api.github.com/users/bbatsov/followers","following_url":"https://api.github.com/users/bbatsov/following{/other_user}","gists_url":"https://api.github.com/users/bbatsov/gists{/gist_id}","starred_url":"https://api.github.com/users/bbatsov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbatsov/subscriptions","organizations_url":"https://api.github.com/users/bbatsov/orgs","repos_url":"https://api.github.com/users/bbatsov/repos","events_url":"https://api.github.com/users/bbatsov/events{/privacy}","received_events_url":"https://api.github.com/users/bbatsov/received_events","type":"User","site_admin":false},"repo":{"id":4095287,"name":"rubocop","full_name":"bbatsov/rubocop","owner":{"login":"bbatsov","id":103882,"avatar_url":"https://avatars.githubusercontent.com/u/103882?v=3","gravatar_id":"","url":"https://api.github.com/users/bbatsov","html_url":"https://github.com/bbatsov","followers_url":"https://api.github.com/users/bbatsov/followers","following_url":"https://api.github.com/users/bbatsov/following{/other_user}","gists_url":"https://api.github.com/users/bbatsov/gists{/gist_id}","starred_url":"https://api.github.com/users/bbatsov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbatsov/subscriptions","organizations_url":"https://api.github.com/users/bbatsov/orgs","repos_url":"https://api.github.com/users/bbatsov/repos","events_url":"https://api.github.com/users/bbatsov/events{/privacy}","received_events_url":"https://api.github.com/users/bbatsov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bbatsov/rubocop","description":"A Ruby static code analyzer, based on the community Ruby style guide.","fork":false,"url":"https://api.github.com/repos/bbatsov/rubocop","forks_url":"https://api.github.com/repos/bbatsov/rubocop/forks","keys_url":"https://api.github.com/repos/bbatsov/rubocop/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bbatsov/rubocop/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bbatsov/rubocop/teams","hooks_url":"https://api.github.com/repos/bbatsov/rubocop/hooks","issue_events_url":"https://api.github.com/repos/bbatsov/rubocop/issues/events{/number}","events_url":"https://api.github.com/repos/bbatsov/rubocop/events","assignees_url":"https://api.github.com/repos/bbatsov/rubocop/assignees{/user}","branches_url":"https://api.github.com/repos/bbatsov/rubocop/branches{/branch}","tags_url":"https://api.github.com/repos/bbatsov/rubocop/tags","blobs_url":"https://api.github.com/repos/bbatsov/rubocop/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bbatsov/rubocop/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bbatsov/rubocop/git/refs{/sha}","trees_url":"https://api.github.com/repos/bbatsov/rubocop/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bbatsov/rubocop/statuses/{sha}","languages_url":"https://api.github.com/repos/bbatsov/rubocop/languages","stargazers_url":"https://api.github.com/repos/bbatsov/rubocop/stargazers","contributors_url":"https://api.github.com/repos/bbatsov/rubocop/contributors","subscribers_url":"https://api.github.com/repos/bbatsov/rubocop/subscribers","subscription_url":"https://api.github.com/repos/bbatsov/rubocop/subscription","commits_url":"https://api.github.com/repos/bbatsov/rubocop/commits{/sha}","git_commits_url":"https://api.github.com/repos/bbatsov/rubocop/git/commits{/sha}","comments_url":"https://api.github.com/repos/bbatsov/rubocop/comments{/number}","issue_comment_url":"https://api.github.com/repos/bbatsov/rubocop/issues/comments{/number}","contents_url":"https://api.github.com/repos/bbatsov/rubocop/contents/{+path}","compare_url":"https://api.github.com/repos/bbatsov/rubocop/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bbatsov/rubocop/merges","archive_url":"https://api.github.com/repos/bbatsov/rubocop/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bbatsov/rubocop/downloads","issues_url":"https://api.github.com/repos/bbatsov/rubocop/issues{/number}","pulls_url":"https://api.github.com/repos/bbatsov/rubocop/pulls{/number}","milestones_url":"https://api.github.com/repos/bbatsov/rubocop/milestones{/number}","notifications_url":"https://api.github.com/repos/bbatsov/rubocop/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bbatsov/rubocop/labels{/name}","releases_url":"https://api.github.com/repos/bbatsov/rubocop/releases{/id}","deployments_url":"https://api.github.com/repos/bbatsov/rubocop/deployments","created_at":"2012-04-21T10:09:58Z","updated_at":"2016-07-13T08:55:06Z","pushed_at":"2016-07-13T09:12:53Z","git_url":"git://github.com/bbatsov/rubocop.git","ssh_url":"git@github.com:bbatsov/rubocop.git","clone_url":"https://github.com/bbatsov/rubocop.git","svn_url":"https://github.com/bbatsov/rubocop","homepage":"http://rubocop.readthedocs.io","size":16247,"stargazers_count":6531,"watchers_count":6531,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":907,"mirror_url":null,"open_issues_count":115,"forks":907,"open_issues":115,"watchers":6531,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/3315"},"html":{"href":"https://github.com/bbatsov/rubocop/pull/3315"},"issue":{"href":"https://api.github.com/repos/bbatsov/rubocop/issues/3315"},"comments":{"href":"https://api.github.com/repos/bbatsov/rubocop/issues/3315/comments"},"review_comments":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/3315/comments"},"review_comment":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/bbatsov/rubocop/pulls/3315/commits"},"statuses":{"href":"https://api.github.com/repos/bbatsov/rubocop/statuses/5bcbcde44538e7f1df1da98e72510bb68651dca5"}}}}
{"actor":{"display_login":"owst"}}