{"action":"created","comment":{"url":"https://api.github.com/repos/weaveworks/build-tools/pulls/comments/97639910","pull_request_review_id":18251002,"id":97639910,"diff_hunk":"@@ -171,6 +171,27 @@ lint_files() {\n     exit $lint_result\n }\n \n+filter_out() {\n+    local globs=\"$1\"\n+    if [ -n \"$globs\" -a -r \"$globs\" ]; then\n+        # Files to debug the regular expressions, as they get quite complex:\n+        local files_in=\"$(mktemp /tmp/lint_files_in_XXX.txt)\"\n+        local files_out=\"$(mktemp /tmp/lint_files_out_XXX.txt)\"\n+        # Globs blacklist found: filter out stdin before passing it to stdout:\n+        while read -r filename; do\n+            # Remove comments. Remove empty lines. Expand directories (e.g. \"bin/\" -> \"bin/.*\"). And then regexify globs.\n+            # These regexes are then passed to grep to filter out matching elements from stdin:\n+            echo \"${filename}\" | tee -a \"$files_in\" | grep -vEf <(sed '/^#.*$/d ; /^\\s*$/d ; s/^\\(.*\\/\\)$/\\1*/g ; s/\\([.|]\\)/\\\\\\1/g ; s/\\?/./g ; s/\\*/.*/g ; s/\\(.*\\)/\\^\\1\\$/g' \"$globs\") | tee -a \"$files_out\"\n+        done\n+        # List all files we have just filtered out:\n+        [ -n \"$DEBUG\" ] && echo >&2 \"Files not linted:\" && grep >&2 -xvFf \"$files_out\" \"$files_in\"\n+        rm -f \"$files_in\" \"$files_out\"\n+    else\n+        # No globs blacklist was provided: simply propagate stdin to stdout:\n+        while read -r filename; do echo \"${filename}\"; done","path":"lint","position":21,"original_position":21,"commit_id":"9adc07e52d8db9078b3b41225b1daa3e71d9e3eb","original_commit_id":"9adc07e52d8db9078b3b41225b1daa3e71d9e3eb","user":{"login":"ekimekim","id":570052,"avatar_url":"https://avatars.githubusercontent.com/u/570052?v=3","gravatar_id":"","url":"https://api.github.com/users/ekimekim","html_url":"https://github.com/ekimekim","followers_url":"https://api.github.com/users/ekimekim/followers","following_url":"https://api.github.com/users/ekimekim/following{/other_user}","gists_url":"https://api.github.com/users/ekimekim/gists{/gist_id}","starred_url":"https://api.github.com/users/ekimekim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ekimekim/subscriptions","organizations_url":"https://api.github.com/users/ekimekim/orgs","repos_url":"https://api.github.com/users/ekimekim/repos","events_url":"https://api.github.com/users/ekimekim/events{/privacy}","received_events_url":"https://api.github.com/users/ekimekim/received_events","type":"User","site_admin":false},"body":"you could replace this line simply with `cat`, though I suppose there's an argument that this is more readable.","created_at":"2017-01-24T20:11:09Z","updated_at":"2017-01-24T20:12:45Z","html_url":"https://github.com/weaveworks/build-tools/pull/67#discussion_r97639910","pull_request_url":"https://api.github.com/repos/weaveworks/build-tools/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/weaveworks/build-tools/pulls/comments/97639910"},"html":{"href":"https://github.com/weaveworks/build-tools/pull/67#discussion_r97639910"},"pull_request":{"href":"https://api.github.com/repos/weaveworks/build-tools/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/weaveworks/build-tools/pulls/67","id":102948010,"html_url":"https://github.com/weaveworks/build-tools/pull/67","diff_url":"https://github.com/weaveworks/build-tools/pull/67.diff","patch_url":"https://github.com/weaveworks/build-tools/pull/67.patch","issue_url":"https://api.github.com/repos/weaveworks/build-tools/issues/67","number":67,"state":"open","locked":false,"title":"Add support for .lintignore.","user":{"login":"marccarre","id":836014,"avatar_url":"https://avatars.githubusercontent.com/u/836014?v=3","gravatar_id":"","url":"https://api.github.com/users/marccarre","html_url":"https://github.com/marccarre","followers_url":"https://api.github.com/users/marccarre/followers","following_url":"https://api.github.com/users/marccarre/following{/other_user}","gists_url":"https://api.github.com/users/marccarre/gists{/gist_id}","starred_url":"https://api.github.com/users/marccarre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marccarre/subscriptions","organizations_url":"https://api.github.com/users/marccarre/orgs","repos_url":"https://api.github.com/users/marccarre/repos","events_url":"https://api.github.com/users/marccarre/events{/privacy}","received_events_url":"https://api.github.com/users/marccarre/received_events","type":"User","site_admin":false},"body":"Lint-ing all of Weave Net is currently not desirable because: \r\n\r\n* it would create conflicts on many branches,\r\n* it would pollute the git history, \r\n* etc. \r\n\r\nand because `lint` currently lints all files except `./vendor`, this breaks Weave Net's build.\r\nAs a result, Weave Net is not using the latest commit in `build-tools`'s `master` branch, which is also source of problems:\r\n\r\n* it limits standardisation of projects across Weaveworks, \r\n* it limits the ability to use the latest features of `build-tools`, \r\n* it complexifies merging changes in `build-tools` (e.g. #53 and weaveworks/weave#2694 for weaveworks/weave#2647), \r\n* etc.\r\n\r\nThis change adds the ability to optionally process a `.lintignore` file, which can contain any number of `GLOB`s then used to filter out files one does not want to lint, a-la `.gitignore`.\r\nThis, coupled with a `.lintignore` file in Weave Net will then enable Weave Net to use the latest version of `build-tools`.","created_at":"2017-01-24T16:02:40Z","updated_at":"2017-01-24T20:12:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c354dfa111e4ca3569ac13f2b298ec1865f764d","assignee":{"login":"marccarre","id":836014,"avatar_url":"https://avatars.githubusercontent.com/u/836014?v=3","gravatar_id":"","url":"https://api.github.com/users/marccarre","html_url":"https://github.com/marccarre","followers_url":"https://api.github.com/users/marccarre/followers","following_url":"https://api.github.com/users/marccarre/following{/other_user}","gists_url":"https://api.github.com/users/marccarre/gists{/gist_id}","starred_url":"https://api.github.com/users/marccarre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marccarre/subscriptions","organizations_url":"https://api.github.com/users/marccarre/orgs","repos_url":"https://api.github.com/users/marccarre/repos","events_url":"https://api.github.com/users/marccarre/events{/privacy}","received_events_url":"https://api.github.com/users/marccarre/received_events","type":"User","site_admin":false},"assignees":[{"login":"marccarre","id":836014,"avatar_url":"https://avatars.githubusercontent.com/u/836014?v=3","gravatar_id":"","url":"https://api.github.com/users/marccarre","html_url":"https://github.com/marccarre","followers_url":"https://api.github.com/users/marccarre/followers","following_url":"https://api.github.com/users/marccarre/following{/other_user}","gists_url":"https://api.github.com/users/marccarre/gists{/gist_id}","starred_url":"https://api.github.com/users/marccarre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marccarre/subscriptions","organizations_url":"https://api.github.com/users/marccarre/orgs","repos_url":"https://api.github.com/users/marccarre/repos","events_url":"https://api.github.com/users/marccarre/events{/privacy}","received_events_url":"https://api.github.com/users/marccarre/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/weaveworks/build-tools/pulls/67/commits","review_comments_url":"https://api.github.com/repos/weaveworks/build-tools/pulls/67/comments","review_comment_url":"https://api.github.com/repos/weaveworks/build-tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/weaveworks/build-tools/issues/67/comments","statuses_url":"https://api.github.com/repos/weaveworks/build-tools/statuses/9adc07e52d8db9078b3b41225b1daa3e71d9e3eb","head":{"label":"weaveworks:shfmt-ignore","ref":"shfmt-ignore","sha":"9adc07e52d8db9078b3b41225b1daa3e71d9e3eb","user":{"login":"weaveworks","id":9976052,"avatar_url":"https://avatars.githubusercontent.com/u/9976052?v=3","gravatar_id":"","url":"https://api.github.com/users/weaveworks","html_url":"https://github.com/weaveworks","followers_url":"https://api.github.com/users/weaveworks/followers","following_url":"https://api.github.com/users/weaveworks/following{/other_user}","gists_url":"https://api.github.com/users/weaveworks/gists{/gist_id}","starred_url":"https://api.github.com/users/weaveworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaveworks/subscriptions","organizations_url":"https://api.github.com/users/weaveworks/orgs","repos_url":"https://api.github.com/users/weaveworks/repos","events_url":"https://api.github.com/users/weaveworks/events{/privacy}","received_events_url":"https://api.github.com/users/weaveworks/received_events","type":"Organization","site_admin":false},"repo":{"id":39950680,"name":"build-tools","full_name":"weaveworks/build-tools","owner":{"login":"weaveworks","id":9976052,"avatar_url":"https://avatars.githubusercontent.com/u/9976052?v=3","gravatar_id":"","url":"https://api.github.com/users/weaveworks","html_url":"https://github.com/weaveworks","followers_url":"https://api.github.com/users/weaveworks/followers","following_url":"https://api.github.com/users/weaveworks/following{/other_user}","gists_url":"https://api.github.com/users/weaveworks/gists{/gist_id}","starred_url":"https://api.github.com/users/weaveworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaveworks/subscriptions","organizations_url":"https://api.github.com/users/weaveworks/orgs","repos_url":"https://api.github.com/users/weaveworks/repos","events_url":"https://api.github.com/users/weaveworks/events{/privacy}","received_events_url":"https://api.github.com/users/weaveworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/weaveworks/build-tools","description":"Collection of build & test tools shared by various Weaveworks projects","fork":false,"url":"https://api.github.com/repos/weaveworks/build-tools","forks_url":"https://api.github.com/repos/weaveworks/build-tools/forks","keys_url":"https://api.github.com/repos/weaveworks/build-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/weaveworks/build-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/weaveworks/build-tools/teams","hooks_url":"https://api.github.com/repos/weaveworks/build-tools/hooks","issue_events_url":"https://api.github.com/repos/weaveworks/build-tools/issues/events{/number}","events_url":"https://api.github.com/repos/weaveworks/build-tools/events","assignees_url":"https://api.github.com/repos/weaveworks/build-tools/assignees{/user}","branches_url":"https://api.github.com/repos/weaveworks/build-tools/branches{/branch}","tags_url":"https://api.github.com/repos/weaveworks/build-tools/tags","blobs_url":"https://api.github.com/repos/weaveworks/build-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/weaveworks/build-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/weaveworks/build-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/weaveworks/build-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/weaveworks/build-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/weaveworks/build-tools/languages","stargazers_url":"https://api.github.com/repos/weaveworks/build-tools/stargazers","contributors_url":"https://api.github.com/repos/weaveworks/build-tools/contributors","subscribers_url":"https://api.github.com/repos/weaveworks/build-tools/subscribers","subscription_url":"https://api.github.com/repos/weaveworks/build-tools/subscription","commits_url":"https://api.github.com/repos/weaveworks/build-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/weaveworks/build-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/weaveworks/build-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/weaveworks/build-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/weaveworks/build-tools/contents/{+path}","compare_url":"https://api.github.com/repos/weaveworks/build-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/weaveworks/build-tools/merges","archive_url":"https://api.github.com/repos/weaveworks/build-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/weaveworks/build-tools/downloads","issues_url":"https://api.github.com/repos/weaveworks/build-tools/issues{/number}","pulls_url":"https://api.github.com/repos/weaveworks/build-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/weaveworks/build-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/weaveworks/build-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/weaveworks/build-tools/labels{/name}","releases_url":"https://api.github.com/repos/weaveworks/build-tools/releases{/id}","deployments_url":"https://api.github.com/repos/weaveworks/build-tools/deployments","created_at":"2015-07-30T12:59:18Z","updated_at":"2016-10-25T12:32:54Z","pushed_at":"2017-01-24T19:30:43Z","git_url":"git://github.com/weaveworks/build-tools.git","ssh_url":"git@github.com:weaveworks/build-tools.git","clone_url":"https://github.com/weaveworks/build-tools.git","svn_url":"https://github.com/weaveworks/build-tools","homepage":"","size":210,"stargazers_count":4,"watchers_count":4,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":11,"forks":3,"open_issues":11,"watchers":4,"default_branch":"master"}},"base":{"label":"weaveworks:master","ref":"master","sha":"2b55c2dfd2efb8137d29591baa80c1d0afe02462","user":{"login":"weaveworks","id":9976052,"avatar_url":"https://avatars.githubusercontent.com/u/9976052?v=3","gravatar_id":"","url":"https://api.github.com/users/weaveworks","html_url":"https://github.com/weaveworks","followers_url":"https://api.github.com/users/weaveworks/followers","following_url":"https://api.github.com/users/weaveworks/following{/other_user}","gists_url":"https://api.github.com/users/weaveworks/gists{/gist_id}","starred_url":"https://api.github.com/users/weaveworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaveworks/subscriptions","organizations_url":"https://api.github.com/users/weaveworks/orgs","repos_url":"https://api.github.com/users/weaveworks/repos","events_url":"https://api.github.com/users/weaveworks/events{/privacy}","received_events_url":"https://api.github.com/users/weaveworks/received_events","type":"Organization","site_admin":false},"repo":{"id":39950680,"name":"build-tools","full_name":"weaveworks/build-tools","owner":{"login":"weaveworks","id":9976052,"avatar_url":"https://avatars.githubusercontent.com/u/9976052?v=3","gravatar_id":"","url":"https://api.github.com/users/weaveworks","html_url":"https://github.com/weaveworks","followers_url":"https://api.github.com/users/weaveworks/followers","following_url":"https://api.github.com/users/weaveworks/following{/other_user}","gists_url":"https://api.github.com/users/weaveworks/gists{/gist_id}","starred_url":"https://api.github.com/users/weaveworks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weaveworks/subscriptions","organizations_url":"https://api.github.com/users/weaveworks/orgs","repos_url":"https://api.github.com/users/weaveworks/repos","events_url":"https://api.github.com/users/weaveworks/events{/privacy}","received_events_url":"https://api.github.com/users/weaveworks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/weaveworks/build-tools","description":"Collection of build & test tools shared by various Weaveworks projects","fork":false,"url":"https://api.github.com/repos/weaveworks/build-tools","forks_url":"https://api.github.com/repos/weaveworks/build-tools/forks","keys_url":"https://api.github.com/repos/weaveworks/build-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/weaveworks/build-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/weaveworks/build-tools/teams","hooks_url":"https://api.github.com/repos/weaveworks/build-tools/hooks","issue_events_url":"https://api.github.com/repos/weaveworks/build-tools/issues/events{/number}","events_url":"https://api.github.com/repos/weaveworks/build-tools/events","assignees_url":"https://api.github.com/repos/weaveworks/build-tools/assignees{/user}","branches_url":"https://api.github.com/repos/weaveworks/build-tools/branches{/branch}","tags_url":"https://api.github.com/repos/weaveworks/build-tools/tags","blobs_url":"https://api.github.com/repos/weaveworks/build-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/weaveworks/build-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/weaveworks/build-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/weaveworks/build-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/weaveworks/build-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/weaveworks/build-tools/languages","stargazers_url":"https://api.github.com/repos/weaveworks/build-tools/stargazers","contributors_url":"https://api.github.com/repos/weaveworks/build-tools/contributors","subscribers_url":"https://api.github.com/repos/weaveworks/build-tools/subscribers","subscription_url":"https://api.github.com/repos/weaveworks/build-tools/subscription","commits_url":"https://api.github.com/repos/weaveworks/build-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/weaveworks/build-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/weaveworks/build-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/weaveworks/build-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/weaveworks/build-tools/contents/{+path}","compare_url":"https://api.github.com/repos/weaveworks/build-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/weaveworks/build-tools/merges","archive_url":"https://api.github.com/repos/weaveworks/build-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/weaveworks/build-tools/downloads","issues_url":"https://api.github.com/repos/weaveworks/build-tools/issues{/number}","pulls_url":"https://api.github.com/repos/weaveworks/build-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/weaveworks/build-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/weaveworks/build-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/weaveworks/build-tools/labels{/name}","releases_url":"https://api.github.com/repos/weaveworks/build-tools/releases{/id}","deployments_url":"https://api.github.com/repos/weaveworks/build-tools/deployments","created_at":"2015-07-30T12:59:18Z","updated_at":"2016-10-25T12:32:54Z","pushed_at":"2017-01-24T19:30:43Z","git_url":"git://github.com/weaveworks/build-tools.git","ssh_url":"git@github.com:weaveworks/build-tools.git","clone_url":"https://github.com/weaveworks/build-tools.git","svn_url":"https://github.com/weaveworks/build-tools","homepage":"","size":210,"stargazers_count":4,"watchers_count":4,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":11,"forks":3,"open_issues":11,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/weaveworks/build-tools/pulls/67"},"html":{"href":"https://github.com/weaveworks/build-tools/pull/67"},"issue":{"href":"https://api.github.com/repos/weaveworks/build-tools/issues/67"},"comments":{"href":"https://api.github.com/repos/weaveworks/build-tools/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/weaveworks/build-tools/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/weaveworks/build-tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/weaveworks/build-tools/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/weaveworks/build-tools/statuses/9adc07e52d8db9078b3b41225b1daa3e71d9e3eb"}}}}
{"actor":{"display_login":"ekimekim"}}