{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/smart-answers/pulls/comments/60206729","id":60206729,"diff_hunk":"@@ -35,11 +35,9 @@ def define\n         option \"2-days\"\n         option \"1-day\"\n \n-        calculate :days_worked_per_week do |response|\n-          # XXX: this is a bit nasty and takes advantage of the fact that\n-          # to_i only looks for the very first integer\n-          response.to_i\n-        end\n+        # XXX: this is a bit nasty and takes advantage of the fact that\n+        # to_i only looks for the very first integer in the string response\n+        calculate :days_worked_per_week, &:to_i","path":"lib/smart_answer_flows/calculate-agricultural-holiday-entitlement.rb","position":20,"original_position":11,"commit_id":"bd9eba8a214e1f707e080ef592e8ede615893a51","original_commit_id":"c0fc82f007d35489260ac6796f35dcac4f004427","user":{"login":"floehopper","id":3169,"avatar_url":"https://avatars.githubusercontent.com/u/3169?v=3","gravatar_id":"","url":"https://api.github.com/users/floehopper","html_url":"https://github.com/floehopper","followers_url":"https://api.github.com/users/floehopper/followers","following_url":"https://api.github.com/users/floehopper/following{/other_user}","gists_url":"https://api.github.com/users/floehopper/gists{/gist_id}","starred_url":"https://api.github.com/users/floehopper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floehopper/subscriptions","organizations_url":"https://api.github.com/users/floehopper/orgs","repos_url":"https://api.github.com/users/floehopper/repos","events_url":"https://api.github.com/users/floehopper/events{/privacy}","received_events_url":"https://api.github.com/users/floehopper/received_events","type":"User","site_admin":false},"body":"I agree this looks a bit odd. I added \"in the string response\" to try to make things clearer, but it sounds as if that wasn't enough. To address your concern I'm going to leave the code unchanged and disable the cop for these lines. Hopefully that will highlight how undesirable this code is and it will encourage us to remove the calculate block as you suggest.\r\n\r\nAddressed in 4c23b45e9db97580079e5980b9e6d9f2200ce41f.","created_at":"2016-04-19T10:23:40Z","updated_at":"2016-04-19T10:23:40Z","html_url":"https://github.com/alphagov/smart-answers/pull/2469#discussion_r60206729","pull_request_url":"https://api.github.com/repos/alphagov/smart-answers/pulls/2469","_links":{"self":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/comments/60206729"},"html":{"href":"https://github.com/alphagov/smart-answers/pull/2469#discussion_r60206729"},"pull_request":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/2469"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/smart-answers/pulls/2469","id":66894200,"html_url":"https://github.com/alphagov/smart-answers/pull/2469","diff_url":"https://github.com/alphagov/smart-answers/pull/2469.diff","patch_url":"https://github.com/alphagov/smart-answers/pull/2469.patch","issue_url":"https://api.github.com/repos/alphagov/smart-answers/issues/2469","number":2469,"state":"open","locked":false,"title":"Fix auto-correctable Rubocop violations","user":{"login":"floehopper","id":3169,"avatar_url":"https://avatars.githubusercontent.com/u/3169?v=3","gravatar_id":"","url":"https://api.github.com/users/floehopper","html_url":"https://github.com/floehopper","followers_url":"https://api.github.com/users/floehopper/followers","following_url":"https://api.github.com/users/floehopper/following{/other_user}","gists_url":"https://api.github.com/users/floehopper/gists{/gist_id}","starred_url":"https://api.github.com/users/floehopper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/floehopper/subscriptions","organizations_url":"https://api.github.com/users/floehopper/orgs","repos_url":"https://api.github.com/users/floehopper/repos","events_url":"https://api.github.com/users/floehopper/events{/privacy}","received_events_url":"https://api.github.com/users/floehopper/received_events","type":"User","site_admin":false},"body":"## Description\r\n\r\nTrello card: https://trello.com/c/BqZ8i1b6\r\n\r\nThis PR fixes all the violations of cops which are supposedly auto-correctable. There are still quite a few disabled cops, but hopefully this is a good step forward.\r\n\r\nAll the commits up to and including the one fixing the `Style/AndOr` violations were generated using only Rubocop's auto-correct functionality by running `govuk-lint-ruby --auto-correct`.\r\n\r\nThe next batch of commits up to and including the one fixing the `Lint/UnusedBlockArgument` violations were done manually. In the middle of this batch, the commit fixing the `Style/TrivialAccessors` violation was done manually, because the auto-correct option didn't seem to do anything.\r\n\r\nThe commit fixing the `Lint/UnusedMethodArgument` violations was generated using only Rubocop's auto-correct functionality, but then the subsequent 7 commits attempt to make improvements to those auto-corrections.\r\n\r\nFinally I've updated all the affected regression checksums in a single commit - no regression test artefacts needed to be changed to make the regression tests pass.\r\n\r\n## External changes\r\n\r\nNone. This is just an internal refactoring.\r\n","created_at":"2016-04-18T17:51:47Z","updated_at":"2016-04-19T10:23:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e46ed6fee029fcae647bce7ae943308ac6df90ee","assignee":{"login":"chrisroos","id":6556,"avatar_url":"https://avatars.githubusercontent.com/u/6556?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisroos","html_url":"https://github.com/chrisroos","followers_url":"https://api.github.com/users/chrisroos/followers","following_url":"https://api.github.com/users/chrisroos/following{/other_user}","gists_url":"https://api.github.com/users/chrisroos/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisroos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisroos/subscriptions","organizations_url":"https://api.github.com/users/chrisroos/orgs","repos_url":"https://api.github.com/users/chrisroos/repos","events_url":"https://api.github.com/users/chrisroos/events{/privacy}","received_events_url":"https://api.github.com/users/chrisroos/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/smart-answers/pulls/2469/commits","review_comments_url":"https://api.github.com/repos/alphagov/smart-answers/pulls/2469/comments","review_comment_url":"https://api.github.com/repos/alphagov/smart-answers/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/smart-answers/issues/2469/comments","statuses_url":"https://api.github.com/repos/alphagov/smart-answers/statuses/bd9eba8a214e1f707e080ef592e8ede615893a51","head":{"label":"alphagov:autocorrect-rubocop-violations","ref":"autocorrect-rubocop-violations","sha":"bd9eba8a214e1f707e080ef592e8ede615893a51","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":2651887,"name":"smart-answers","full_name":"alphagov/smart-answers","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/smart-answers","description":"smart-answers","fork":false,"url":"https://api.github.com/repos/alphagov/smart-answers","forks_url":"https://api.github.com/repos/alphagov/smart-answers/forks","keys_url":"https://api.github.com/repos/alphagov/smart-answers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/smart-answers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/smart-answers/teams","hooks_url":"https://api.github.com/repos/alphagov/smart-answers/hooks","issue_events_url":"https://api.github.com/repos/alphagov/smart-answers/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/smart-answers/events","assignees_url":"https://api.github.com/repos/alphagov/smart-answers/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/smart-answers/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/smart-answers/tags","blobs_url":"https://api.github.com/repos/alphagov/smart-answers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/smart-answers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/smart-answers/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/smart-answers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/smart-answers/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/smart-answers/languages","stargazers_url":"https://api.github.com/repos/alphagov/smart-answers/stargazers","contributors_url":"https://api.github.com/repos/alphagov/smart-answers/contributors","subscribers_url":"https://api.github.com/repos/alphagov/smart-answers/subscribers","subscription_url":"https://api.github.com/repos/alphagov/smart-answers/subscription","commits_url":"https://api.github.com/repos/alphagov/smart-answers/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/smart-answers/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/smart-answers/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/smart-answers/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/smart-answers/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/smart-answers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/smart-answers/merges","archive_url":"https://api.github.com/repos/alphagov/smart-answers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/smart-answers/downloads","issues_url":"https://api.github.com/repos/alphagov/smart-answers/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/smart-answers/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/smart-answers/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/smart-answers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/smart-answers/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/smart-answers/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/smart-answers/deployments","created_at":"2011-10-26T15:39:01Z","updated_at":"2016-04-19T07:13:06Z","pushed_at":"2016-04-19T10:21:23Z","git_url":"git://github.com/alphagov/smart-answers.git","ssh_url":"git@github.com:alphagov/smart-answers.git","clone_url":"https://github.com/alphagov/smart-answers.git","svn_url":"https://github.com/alphagov/smart-answers","homepage":"","size":47935,"stargazers_count":78,"watchers_count":78,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":44,"mirror_url":null,"open_issues_count":13,"forks":44,"open_issues":13,"watchers":78,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"292be35aee284ff7e661d307d05331baa824edc0","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":2651887,"name":"smart-answers","full_name":"alphagov/smart-answers","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars.githubusercontent.com/u/596977?v=3","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/smart-answers","description":"smart-answers","fork":false,"url":"https://api.github.com/repos/alphagov/smart-answers","forks_url":"https://api.github.com/repos/alphagov/smart-answers/forks","keys_url":"https://api.github.com/repos/alphagov/smart-answers/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/smart-answers/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/smart-answers/teams","hooks_url":"https://api.github.com/repos/alphagov/smart-answers/hooks","issue_events_url":"https://api.github.com/repos/alphagov/smart-answers/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/smart-answers/events","assignees_url":"https://api.github.com/repos/alphagov/smart-answers/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/smart-answers/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/smart-answers/tags","blobs_url":"https://api.github.com/repos/alphagov/smart-answers/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/smart-answers/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/smart-answers/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/smart-answers/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/smart-answers/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/smart-answers/languages","stargazers_url":"https://api.github.com/repos/alphagov/smart-answers/stargazers","contributors_url":"https://api.github.com/repos/alphagov/smart-answers/contributors","subscribers_url":"https://api.github.com/repos/alphagov/smart-answers/subscribers","subscription_url":"https://api.github.com/repos/alphagov/smart-answers/subscription","commits_url":"https://api.github.com/repos/alphagov/smart-answers/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/smart-answers/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/smart-answers/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/smart-answers/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/smart-answers/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/smart-answers/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/smart-answers/merges","archive_url":"https://api.github.com/repos/alphagov/smart-answers/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/smart-answers/downloads","issues_url":"https://api.github.com/repos/alphagov/smart-answers/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/smart-answers/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/smart-answers/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/smart-answers/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/smart-answers/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/smart-answers/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/smart-answers/deployments","created_at":"2011-10-26T15:39:01Z","updated_at":"2016-04-19T07:13:06Z","pushed_at":"2016-04-19T10:21:23Z","git_url":"git://github.com/alphagov/smart-answers.git","ssh_url":"git@github.com:alphagov/smart-answers.git","clone_url":"https://github.com/alphagov/smart-answers.git","svn_url":"https://github.com/alphagov/smart-answers","homepage":"","size":47935,"stargazers_count":78,"watchers_count":78,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":44,"mirror_url":null,"open_issues_count":13,"forks":44,"open_issues":13,"watchers":78,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/2469"},"html":{"href":"https://github.com/alphagov/smart-answers/pull/2469"},"issue":{"href":"https://api.github.com/repos/alphagov/smart-answers/issues/2469"},"comments":{"href":"https://api.github.com/repos/alphagov/smart-answers/issues/2469/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/2469/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/smart-answers/pulls/2469/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/smart-answers/statuses/bd9eba8a214e1f707e080ef592e8ede615893a51"}}}}