{"action":"created","comment":{"url":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/comments/199512116","pull_request_review_id":133644060,"id":199512116,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTUxMjExNg==","diff_hunk":"@@ -0,0 +1,45 @@\n+#!/bin/bash\n+\n+set -e\n+\n+current_branch=${CURRENT_GIT_BRANCH:-$( git symbolic-ref --short HEAD )}\n+\n+base_branch=\"master\"\n+\n+if [[ x\"$current_branch\" == x*\"pull/\"* ]]; then\n+    # This is a PR and we need to determine the branch from the API.\n+    pr_name=\"${current_branch/pull/pulls}\"\n+\n+    if [ -z ${GIT_REPO} ]; then\n+        set -x\n+        git_repo=$( git remote get-url origin )","path":"tools/ci/checks/get_base_branch.sh","position":15,"original_position":15,"commit_id":"6b22ab6269d58de006bc8dc948dd4f00dffb0a47","original_commit_id":"6b22ab6269d58de006bc8dc948dd4f00dffb0a47","user":{"login":"mpereira","id":112426,"node_id":"MDQ6VXNlcjExMjQyNg==","avatar_url":"https://avatars3.githubusercontent.com/u/112426?v=4","gravatar_id":"","url":"https://api.github.com/users/mpereira","html_url":"https://github.com/mpereira","followers_url":"https://api.github.com/users/mpereira/followers","following_url":"https://api.github.com/users/mpereira/following{/other_user}","gists_url":"https://api.github.com/users/mpereira/gists{/gist_id}","starred_url":"https://api.github.com/users/mpereira/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpereira/subscriptions","organizations_url":"https://api.github.com/users/mpereira/orgs","repos_url":"https://api.github.com/users/mpereira/repos","events_url":"https://api.github.com/users/mpereira/events{/privacy}","received_events_url":"https://api.github.com/users/mpereira/received_events","type":"User","site_admin":false},"body":"fwiw it is also good practice to quote command substitutions, e.g. `git_repo=\"$(git remote get-url origin)\"`.","created_at":"2018-07-02T14:16:59Z","updated_at":"2018-07-02T14:16:59Z","html_url":"https://github.com/mesosphere/dcos-commons/pull/2532#discussion_r199512116","pull_request_url":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/2532","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/comments/199512116"},"html":{"href":"https://github.com/mesosphere/dcos-commons/pull/2532#discussion_r199512116"},"pull_request":{"href":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/2532"}}},"pull_request":{"url":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/2532","id":195295246,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1Mjk1MjQ2","html_url":"https://github.com/mesosphere/dcos-commons/pull/2532","diff_url":"https://github.com/mesosphere/dcos-commons/pull/2532.diff","patch_url":"https://github.com/mesosphere/dcos-commons/pull/2532.patch","issue_url":"https://api.github.com/repos/mesosphere/dcos-commons/issues/2532","number":2532,"state":"open","locked":false,"title":"[TOOLS][TESTS] Add tooling for running flake8 as a pre-commit hook and in CI","user":{"login":"elezar","id":931393,"node_id":"MDQ6VXNlcjkzMTM5Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/931393?v=4","gravatar_id":"","url":"https://api.github.com/users/elezar","html_url":"https://github.com/elezar","followers_url":"https://api.github.com/users/elezar/followers","following_url":"https://api.github.com/users/elezar/following{/other_user}","gists_url":"https://api.github.com/users/elezar/gists{/gist_id}","starred_url":"https://api.github.com/users/elezar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elezar/subscriptions","organizations_url":"https://api.github.com/users/elezar/orgs","repos_url":"https://api.github.com/users/elezar/repos","events_url":"https://api.github.com/users/elezar/events{/privacy}","received_events_url":"https://api.github.com/users/elezar/received_events","type":"User","site_admin":false},"body":"This PR was a bit of train work from my side, and is a start at getting some basic syntax / error checking into our CI for our Python files. I started with `flake8`, but would like to add `pylint -E`, `black`, and `pyre` at some point.\r\n\r\nThere have been some errors in recent PRs that increased the time to merge and at least a subset of these would have been detected by these tools.\r\n\r\nThe PR makes the following specific changes:\r\n* Adds `flake8` as a requirement in the docker image\r\n* Adds `pylint` as a requirement in the docker image\r\n* Adds a collection of scripts to drive these kinds of checks\r\n* adds a `pre-commit-config.yaml` file for enabling checks locally\r\n* Make some change to Python files in `testing/` while checking the commit hooks and scripts.\r\n\r\nNote:\r\n* Only modified files are checked. Meaning that we can gradually improve the codebase without having to check in large diffs.\r\n\r\nI am also testing a basic TeamCity jobs:\r\n\r\n* Intentional failure: https://teamcity.mesosphere.io/viewLog.html?buildId=1102872&buildTypeId=DcosIo_DcosCommons_PrJobs_TestCodeChecksPr&tab=buildLog\r\n* Intentional success: https://teamcity.mesosphere.io/viewLog.html?buildId=1102873&buildTypeId=DcosIo_DcosCommons_PrJobs_TestCodeChecksPr&tab=buildLog\r\n* A template configuration here: https://teamcity.mesosphere.io/viewType.html?buildTypeId=DcosIo_DcosCommons_PrJobs_RunCodeChecks\r\n","created_at":"2018-06-15T22:22:06Z","updated_at":"2018-07-02T14:16:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"324fd43a716a860640612564bc59e833c1fa955e","assignee":{"login":"elezar","id":931393,"node_id":"MDQ6VXNlcjkzMTM5Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/931393?v=4","gravatar_id":"","url":"https://api.github.com/users/elezar","html_url":"https://github.com/elezar","followers_url":"https://api.github.com/users/elezar/followers","following_url":"https://api.github.com/users/elezar/following{/other_user}","gists_url":"https://api.github.com/users/elezar/gists{/gist_id}","starred_url":"https://api.github.com/users/elezar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elezar/subscriptions","organizations_url":"https://api.github.com/users/elezar/orgs","repos_url":"https://api.github.com/users/elezar/repos","events_url":"https://api.github.com/users/elezar/events{/privacy}","received_events_url":"https://api.github.com/users/elezar/received_events","type":"User","site_admin":false},"assignees":[{"login":"elezar","id":931393,"node_id":"MDQ6VXNlcjkzMTM5Mw==","avatar_url":"https://avatars3.githubusercontent.com/u/931393?v=4","gravatar_id":"","url":"https://api.github.com/users/elezar","html_url":"https://github.com/elezar","followers_url":"https://api.github.com/users/elezar/followers","following_url":"https://api.github.com/users/elezar/following{/other_user}","gists_url":"https://api.github.com/users/elezar/gists{/gist_id}","starred_url":"https://api.github.com/users/elezar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elezar/subscriptions","organizations_url":"https://api.github.com/users/elezar/orgs","repos_url":"https://api.github.com/users/elezar/repos","events_url":"https://api.github.com/users/elezar/events{/privacy}","received_events_url":"https://api.github.com/users/elezar/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":649058275,"node_id":"MDU6TGFiZWw2NDkwNTgyNzU=","url":"https://api.github.com/repos/mesosphere/dcos-commons/labels/ready%20for%20review","name":"ready for review","color":"1d76db","default":false},{"id":541307607,"node_id":"MDU6TGFiZWw1NDEzMDc2MDc=","url":"https://api.github.com/repos/mesosphere/dcos-commons/labels/tools","name":"tools","color":"d4c5f9","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/2532/commits","review_comments_url":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/2532/comments","review_comment_url":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mesosphere/dcos-commons/issues/2532/comments","statuses_url":"https://api.github.com/repos/mesosphere/dcos-commons/statuses/6b22ab6269d58de006bc8dc948dd4f00dffb0a47","head":{"label":"mesosphere:enable-flake8","ref":"enable-flake8","sha":"6b22ab6269d58de006bc8dc948dd4f00dffb0a47","user":{"login":"mesosphere","id":3458585,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NTg1ODU=","avatar_url":"https://avatars0.githubusercontent.com/u/3458585?v=4","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":60286497,"node_id":"MDEwOlJlcG9zaXRvcnk2MDI4NjQ5Nw==","name":"dcos-commons","full_name":"mesosphere/dcos-commons","owner":{"login":"mesosphere","id":3458585,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NTg1ODU=","avatar_url":"https://avatars0.githubusercontent.com/u/3458585?v=4","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/dcos-commons","description":"Simplifying stateful services","fork":false,"url":"https://api.github.com/repos/mesosphere/dcos-commons","forks_url":"https://api.github.com/repos/mesosphere/dcos-commons/forks","keys_url":"https://api.github.com/repos/mesosphere/dcos-commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/dcos-commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/dcos-commons/teams","hooks_url":"https://api.github.com/repos/mesosphere/dcos-commons/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/dcos-commons/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/dcos-commons/events","assignees_url":"https://api.github.com/repos/mesosphere/dcos-commons/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/dcos-commons/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/dcos-commons/tags","blobs_url":"https://api.github.com/repos/mesosphere/dcos-commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/dcos-commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/dcos-commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/dcos-commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/dcos-commons/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/dcos-commons/languages","stargazers_url":"https://api.github.com/repos/mesosphere/dcos-commons/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/dcos-commons/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/dcos-commons/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/dcos-commons/subscription","commits_url":"https://api.github.com/repos/mesosphere/dcos-commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/dcos-commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/dcos-commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/dcos-commons/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/dcos-commons/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/dcos-commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/dcos-commons/merges","archive_url":"https://api.github.com/repos/mesosphere/dcos-commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/dcos-commons/downloads","issues_url":"https://api.github.com/repos/mesosphere/dcos-commons/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/dcos-commons/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/dcos-commons/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/dcos-commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/dcos-commons/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/dcos-commons/releases{/id}","deployments_url":"https://api.github.com/repos/mesosphere/dcos-commons/deployments","created_at":"2016-06-02T18:09:08Z","updated_at":"2018-07-01T16:39:07Z","pushed_at":"2018-07-02T13:03:45Z","git_url":"git://github.com/mesosphere/dcos-commons.git","ssh_url":"git@github.com:mesosphere/dcos-commons.git","clone_url":"https://github.com/mesosphere/dcos-commons.git","svn_url":"https://github.com/mesosphere/dcos-commons","homepage":"https://mesosphere.github.io/dcos-commons/","size":62536,"stargazers_count":129,"watchers_count":129,"language":"Java","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":143,"mirror_url":null,"archived":false,"open_issues_count":71,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":143,"open_issues":71,"watchers":129,"default_branch":"master"}},"base":{"label":"mesosphere:master","ref":"master","sha":"7c243cae5f9dd04dccd2094bb479cb6ab2d1dd1f","user":{"login":"mesosphere","id":3458585,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NTg1ODU=","avatar_url":"https://avatars0.githubusercontent.com/u/3458585?v=4","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"repo":{"id":60286497,"node_id":"MDEwOlJlcG9zaXRvcnk2MDI4NjQ5Nw==","name":"dcos-commons","full_name":"mesosphere/dcos-commons","owner":{"login":"mesosphere","id":3458585,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NTg1ODU=","avatar_url":"https://avatars0.githubusercontent.com/u/3458585?v=4","gravatar_id":"","url":"https://api.github.com/users/mesosphere","html_url":"https://github.com/mesosphere","followers_url":"https://api.github.com/users/mesosphere/followers","following_url":"https://api.github.com/users/mesosphere/following{/other_user}","gists_url":"https://api.github.com/users/mesosphere/gists{/gist_id}","starred_url":"https://api.github.com/users/mesosphere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mesosphere/subscriptions","organizations_url":"https://api.github.com/users/mesosphere/orgs","repos_url":"https://api.github.com/users/mesosphere/repos","events_url":"https://api.github.com/users/mesosphere/events{/privacy}","received_events_url":"https://api.github.com/users/mesosphere/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mesosphere/dcos-commons","description":"Simplifying stateful services","fork":false,"url":"https://api.github.com/repos/mesosphere/dcos-commons","forks_url":"https://api.github.com/repos/mesosphere/dcos-commons/forks","keys_url":"https://api.github.com/repos/mesosphere/dcos-commons/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mesosphere/dcos-commons/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mesosphere/dcos-commons/teams","hooks_url":"https://api.github.com/repos/mesosphere/dcos-commons/hooks","issue_events_url":"https://api.github.com/repos/mesosphere/dcos-commons/issues/events{/number}","events_url":"https://api.github.com/repos/mesosphere/dcos-commons/events","assignees_url":"https://api.github.com/repos/mesosphere/dcos-commons/assignees{/user}","branches_url":"https://api.github.com/repos/mesosphere/dcos-commons/branches{/branch}","tags_url":"https://api.github.com/repos/mesosphere/dcos-commons/tags","blobs_url":"https://api.github.com/repos/mesosphere/dcos-commons/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mesosphere/dcos-commons/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mesosphere/dcos-commons/git/refs{/sha}","trees_url":"https://api.github.com/repos/mesosphere/dcos-commons/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mesosphere/dcos-commons/statuses/{sha}","languages_url":"https://api.github.com/repos/mesosphere/dcos-commons/languages","stargazers_url":"https://api.github.com/repos/mesosphere/dcos-commons/stargazers","contributors_url":"https://api.github.com/repos/mesosphere/dcos-commons/contributors","subscribers_url":"https://api.github.com/repos/mesosphere/dcos-commons/subscribers","subscription_url":"https://api.github.com/repos/mesosphere/dcos-commons/subscription","commits_url":"https://api.github.com/repos/mesosphere/dcos-commons/commits{/sha}","git_commits_url":"https://api.github.com/repos/mesosphere/dcos-commons/git/commits{/sha}","comments_url":"https://api.github.com/repos/mesosphere/dcos-commons/comments{/number}","issue_comment_url":"https://api.github.com/repos/mesosphere/dcos-commons/issues/comments{/number}","contents_url":"https://api.github.com/repos/mesosphere/dcos-commons/contents/{+path}","compare_url":"https://api.github.com/repos/mesosphere/dcos-commons/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mesosphere/dcos-commons/merges","archive_url":"https://api.github.com/repos/mesosphere/dcos-commons/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mesosphere/dcos-commons/downloads","issues_url":"https://api.github.com/repos/mesosphere/dcos-commons/issues{/number}","pulls_url":"https://api.github.com/repos/mesosphere/dcos-commons/pulls{/number}","milestones_url":"https://api.github.com/repos/mesosphere/dcos-commons/milestones{/number}","notifications_url":"https://api.github.com/repos/mesosphere/dcos-commons/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mesosphere/dcos-commons/labels{/name}","releases_url":"https://api.github.com/repos/mesosphere/dcos-commons/releases{/id}","deployments_url":"https://api.github.com/repos/mesosphere/dcos-commons/deployments","created_at":"2016-06-02T18:09:08Z","updated_at":"2018-07-01T16:39:07Z","pushed_at":"2018-07-02T13:03:45Z","git_url":"git://github.com/mesosphere/dcos-commons.git","ssh_url":"git@github.com:mesosphere/dcos-commons.git","clone_url":"https://github.com/mesosphere/dcos-commons.git","svn_url":"https://github.com/mesosphere/dcos-commons","homepage":"https://mesosphere.github.io/dcos-commons/","size":62536,"stargazers_count":129,"watchers_count":129,"language":"Java","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":143,"mirror_url":null,"archived":false,"open_issues_count":71,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":143,"open_issues":71,"watchers":129,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/2532"},"html":{"href":"https://github.com/mesosphere/dcos-commons/pull/2532"},"issue":{"href":"https://api.github.com/repos/mesosphere/dcos-commons/issues/2532"},"comments":{"href":"https://api.github.com/repos/mesosphere/dcos-commons/issues/2532/comments"},"review_comments":{"href":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/2532/comments"},"review_comment":{"href":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mesosphere/dcos-commons/pulls/2532/commits"},"statuses":{"href":"https://api.github.com/repos/mesosphere/dcos-commons/statuses/6b22ab6269d58de006bc8dc948dd4f00dffb0a47"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"mpereira"}}