{"action":"opened","number":2509,"pull_request":{"url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2509","id":92063266,"html_url":"https://github.com/cfpb/cfgov-refresh/pull/2509","diff_url":"https://github.com/cfpb/cfgov-refresh/pull/2509.diff","patch_url":"https://github.com/cfpb/cfgov-refresh/pull/2509.patch","issue_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2509","number":2509,"state":"open","locked":false,"title":"Add flake8 Python linting","user":{"login":"willbarton","id":10562538,"avatar_url":"https://avatars.githubusercontent.com/u/10562538?v=3","gravatar_id":"","url":"https://api.github.com/users/willbarton","html_url":"https://github.com/willbarton","followers_url":"https://api.github.com/users/willbarton/followers","following_url":"https://api.github.com/users/willbarton/following{/other_user}","gists_url":"https://api.github.com/users/willbarton/gists{/gist_id}","starred_url":"https://api.github.com/users/willbarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willbarton/subscriptions","organizations_url":"https://api.github.com/users/willbarton/orgs","repos_url":"https://api.github.com/users/willbarton/repos","events_url":"https://api.github.com/users/willbarton/events{/privacy}","received_events_url":"https://api.github.com/users/willbarton/received_events","type":"User","site_admin":false},"body":"This PR adds a flake8 config file, adds flake8 to travis, and cleans up the Python style of:\r\n\r\n- cfgov/cal\r\n- cfgov/cfgov\r\n- cfgov/core\r\n- cfgov/flags\r\n- cfgov/legacy\r\n- cfgov/processors\r\n- cfgov/sheerlike\r\n- cfgov/transition_utilities\r\n\r\nIt has flake8 **explicitly ignoring**\r\n\r\n- cfgov/data_research\r\n- cfgov/jobmanager\r\n- cfgov/v1\r\n\r\nThere are a few things I want to bring up for discussion based on this:\r\n\r\n1. By ignoring data_research, jobmanager, and v1, [this configuration](https://github.com/cfpb/cfgov-refresh/blob/flake8/.flake8) will let us run flake8 in Travis and ensure that the cleanup in this PR does not regress. However, it has a very serious side-effect, in that anytime one runs `flake8` from the root of cfgov-refresh, it will ignore v1, data_research, and jobmanager. \r\n\r\n    The alternative to this is to add the ignores for those three packages to the tox `travis` env invocation of `flake8`. I'm not sure which I prefer.\r\n\r\n2. There is some pretty serious refactoring needed that this PR *does not do*, and which I *think* is out of scope, but I'm not entirely sure.  [This `if` condition is probably the worst example](https://github.com/cfpb/cfgov-refresh/blob/flake8/cfgov/sheerlike/filters.py#L58), but there are other less bad examples as well. \r\n\r\n    Do we see the scope of this effort as simply making things flake8-clean, and thereby *enabling* that refactoring at some point in the future, or should these things be refactored now? In the example above, that would involve writing a test first (because there are none), and `sheerlike` will hopefully deprecated in the next 6 months.\r\n\r\n3. Similarly, I have not attempted to address Python3-compatibility, although there are many places in this cleanup where it could be addressed. That also seems out of scope for this (although this cleanup should make that easier).\r\n\r\n4. I've also made some stylistic decisions here that I would like some input on from the rest of the back-ends that are only indirectly the result of flake8-cleaning. These mostly revolve around the use of `\\` versus `( ... )` to handle multiple lines. Do we have a consensus in this regard? Places where I've seen the need for this decision include:\r\n\r\n    - Multi-line string assignment:\r\n    - Conditional assignment (`foo = bar or feh` where `bar` might extend close to 78 char)\r\n\r\n    I realize I don't have much preference (or dislike for `\\`, though I know some people tend to).\r\n\r\n5. This still doesn't help [`urls.py` very much](https://github.com/cfpb/cfgov-refresh/blob/flake8/cfgov/cfgov/urls.py)\r\n\r\n6. I am completely ignoring [our settings files](https://github.com/cfpb/cfgov-refresh/blob/flake8/.flake8#L33). It strikes me that the readability of those might have different concerns than simply Python linting, but I'd welcome some discussion of that.\r\n\r\n7. I'd love to include a max-complexity test, but currently there are parts of the cleaned code that fail ([like this](https://github.com/cfpb/cfgov-refresh/blob/flake8/cfgov/core/management/commands/_helpers.py#L90). This goes back to the need for refactoring, above.\r\n\r\n8. Because flake**8**.\r\n\r\nSo, I'm tagging all the back-ends that are working on cfgov-refresh right now (from platform and data and research) so that we can hash out some of these.\r\n\r\n## Additions\r\n\r\n- flake8 config file\r\n- flake8 dependencies\r\n- flake8 as a default tox command\r\n\r\n## Changes\r\n\r\n- General flake8-compliant style cleanup\r\n\r\n## Testing\r\n\r\n- Run `tox` or `tox -e fast`, or run `flake8` in the root of `cfgov-refresh`. There should be no errors.\r\n\r\n## Review\r\n\r\n- @chosak \r\n- @richaagarwal \r\n- @grapesmoker \r\n- @higs4281 \r\n- @rosskarchner \r\n- @hillaryj \r\n\r\n## Checklist\r\n\r\n* [X] Changes are limited to a single goal (no scope creep)\r\n* [X] Code can be automatically merged (no conflicts)\r\n* [ ] Code follows the standards laid out in the [front end playbook](https://github.com/cfpb/front-end)\r\n* [X] Passes all existing automated tests\r\n* [ ] New functions include new tests\r\n* [ ] New functions are documented (with a description, list of inputs, and expected output)\r\n* [ ] Placeholder code is flagged\r\n* [ ] Visually tested in supported browsers and devices\r\n* [ ] Project documentation has been updated (including the \"Unreleased\" section of the CHANGELOG)\r\n\r\n","created_at":"2016-11-02T21:55:07Z","updated_at":"2016-11-02T21:55:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2509/commits","review_comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2509/comments","review_comment_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2509/comments","statuses_url":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/9b3ac27e460705b7a39546ad183b48e76b634d40","head":{"label":"cfpb:flake8","ref":"flake8","sha":"9b3ac27e460705b7a39546ad183b48e76b634d40","user":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"repo":{"id":18852566,"name":"cfgov-refresh","full_name":"cfpb/cfgov-refresh","owner":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cfpb/cfgov-refresh","description":"Django project that powers the redesigned consumerfinance.gov website.","fork":false,"url":"https://api.github.com/repos/cfpb/cfgov-refresh","forks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/forks","keys_url":"https://api.github.com/repos/cfpb/cfgov-refresh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfpb/cfgov-refresh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfpb/cfgov-refresh/teams","hooks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/hooks","issue_events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/events{/number}","events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/events","assignees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/assignees{/user}","branches_url":"https://api.github.com/repos/cfpb/cfgov-refresh/branches{/branch}","tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/tags","blobs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/{sha}","languages_url":"https://api.github.com/repos/cfpb/cfgov-refresh/languages","stargazers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/stargazers","contributors_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contributors","subscribers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscribers","subscription_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscription","commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contents/{+path}","compare_url":"https://api.github.com/repos/cfpb/cfgov-refresh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfpb/cfgov-refresh/merges","archive_url":"https://api.github.com/repos/cfpb/cfgov-refresh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfpb/cfgov-refresh/downloads","issues_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues{/number}","pulls_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls{/number}","milestones_url":"https://api.github.com/repos/cfpb/cfgov-refresh/milestones{/number}","notifications_url":"https://api.github.com/repos/cfpb/cfgov-refresh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfpb/cfgov-refresh/labels{/name}","releases_url":"https://api.github.com/repos/cfpb/cfgov-refresh/releases{/id}","deployments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/deployments","created_at":"2014-04-16T19:22:03Z","updated_at":"2016-10-31T16:10:19Z","pushed_at":"2016-11-02T21:55:07Z","git_url":"git://github.com/cfpb/cfgov-refresh.git","ssh_url":"git@github.com:cfpb/cfgov-refresh.git","clone_url":"https://github.com/cfpb/cfgov-refresh.git","svn_url":"https://github.com/cfpb/cfgov-refresh","homepage":"http://www.consumerfinance.gov/","size":131609,"stargazers_count":73,"watchers_count":73,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":41,"mirror_url":null,"open_issues_count":99,"forks":41,"open_issues":99,"watchers":73,"default_branch":"master"}},"base":{"label":"cfpb:master","ref":"master","sha":"290eab17c5a8c756f9285f348df77e33c1321ada","user":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"repo":{"id":18852566,"name":"cfgov-refresh","full_name":"cfpb/cfgov-refresh","owner":{"login":"cfpb","id":1071563,"avatar_url":"https://avatars.githubusercontent.com/u/1071563?v=3","gravatar_id":"","url":"https://api.github.com/users/cfpb","html_url":"https://github.com/cfpb","followers_url":"https://api.github.com/users/cfpb/followers","following_url":"https://api.github.com/users/cfpb/following{/other_user}","gists_url":"https://api.github.com/users/cfpb/gists{/gist_id}","starred_url":"https://api.github.com/users/cfpb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfpb/subscriptions","organizations_url":"https://api.github.com/users/cfpb/orgs","repos_url":"https://api.github.com/users/cfpb/repos","events_url":"https://api.github.com/users/cfpb/events{/privacy}","received_events_url":"https://api.github.com/users/cfpb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cfpb/cfgov-refresh","description":"Django project that powers the redesigned consumerfinance.gov website.","fork":false,"url":"https://api.github.com/repos/cfpb/cfgov-refresh","forks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/forks","keys_url":"https://api.github.com/repos/cfpb/cfgov-refresh/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfpb/cfgov-refresh/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfpb/cfgov-refresh/teams","hooks_url":"https://api.github.com/repos/cfpb/cfgov-refresh/hooks","issue_events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/events{/number}","events_url":"https://api.github.com/repos/cfpb/cfgov-refresh/events","assignees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/assignees{/user}","branches_url":"https://api.github.com/repos/cfpb/cfgov-refresh/branches{/branch}","tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/tags","blobs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/{sha}","languages_url":"https://api.github.com/repos/cfpb/cfgov-refresh/languages","stargazers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/stargazers","contributors_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contributors","subscribers_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscribers","subscription_url":"https://api.github.com/repos/cfpb/cfgov-refresh/subscription","commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfpb/cfgov-refresh/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfpb/cfgov-refresh/contents/{+path}","compare_url":"https://api.github.com/repos/cfpb/cfgov-refresh/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfpb/cfgov-refresh/merges","archive_url":"https://api.github.com/repos/cfpb/cfgov-refresh/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfpb/cfgov-refresh/downloads","issues_url":"https://api.github.com/repos/cfpb/cfgov-refresh/issues{/number}","pulls_url":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls{/number}","milestones_url":"https://api.github.com/repos/cfpb/cfgov-refresh/milestones{/number}","notifications_url":"https://api.github.com/repos/cfpb/cfgov-refresh/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfpb/cfgov-refresh/labels{/name}","releases_url":"https://api.github.com/repos/cfpb/cfgov-refresh/releases{/id}","deployments_url":"https://api.github.com/repos/cfpb/cfgov-refresh/deployments","created_at":"2014-04-16T19:22:03Z","updated_at":"2016-10-31T16:10:19Z","pushed_at":"2016-11-02T21:55:07Z","git_url":"git://github.com/cfpb/cfgov-refresh.git","ssh_url":"git@github.com:cfpb/cfgov-refresh.git","clone_url":"https://github.com/cfpb/cfgov-refresh.git","svn_url":"https://github.com/cfpb/cfgov-refresh","homepage":"http://www.consumerfinance.gov/","size":131609,"stargazers_count":73,"watchers_count":73,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":41,"mirror_url":null,"open_issues_count":99,"forks":41,"open_issues":99,"watchers":73,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2509"},"html":{"href":"https://github.com/cfpb/cfgov-refresh/pull/2509"},"issue":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2509"},"comments":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/issues/2509/comments"},"review_comments":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2509/comments"},"review_comment":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/pulls/2509/commits"},"statuses":{"href":"https://api.github.com/repos/cfpb/cfgov-refresh/statuses/9b3ac27e460705b7a39546ad183b48e76b634d40"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":663,"deletions":423,"changed_files":59}}
{"actor":{"display_login":"willbarton"}}