{"action":"created","issue":{"url":"https://api.github.com/repos/mozilla/chronicle/issues/322","labels_url":"https://api.github.com/repos/mozilla/chronicle/issues/322/labels{/name}","comments_url":"https://api.github.com/repos/mozilla/chronicle/issues/322/comments","events_url":"https://api.github.com/repos/mozilla/chronicle/issues/322/events","html_url":"https://github.com/mozilla/chronicle/issues/322","id":57258608,"number":322,"title":"git pre-commit linter should only run on files in the git index","user":{"login":"6a68","id":96396,"avatar_url":"https://avatars.githubusercontent.com/u/96396?v=3","gravatar_id":"","url":"https://api.github.com/users/6a68","html_url":"https://github.com/6a68","followers_url":"https://api.github.com/users/6a68/followers","following_url":"https://api.github.com/users/6a68/following{/other_user}","gists_url":"https://api.github.com/users/6a68/gists{/gist_id}","starred_url":"https://api.github.com/users/6a68/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/6a68/subscriptions","organizations_url":"https://api.github.com/users/6a68/orgs","repos_url":"https://api.github.com/users/6a68/repos","events_url":"https://api.github.com/users/6a68/events{/privacy}","received_events_url":"https://api.github.com/users/6a68/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-02-11T00:10:20Z","updated_at":"2015-02-12T19:10:41Z","closed_at":null,"body":"The linter is slow because it lints every file in the repo, every time. The point of the git commit hook is to avoid checking in code with syntax errors. So, we should get the list of about-to-be-committed files from git (aka the git index), and only run the linter on those."},"comment":{"url":"https://api.github.com/repos/mozilla/chronicle/issues/comments/74132361","html_url":"https://github.com/mozilla/chronicle/issues/322#issuecomment-74132361","issue_url":"https://api.github.com/repos/mozilla/chronicle/issues/322","id":74132361,"user":{"login":"pdehaan","id":557895,"avatar_url":"https://avatars.githubusercontent.com/u/557895?v=3","gravatar_id":"","url":"https://api.github.com/users/pdehaan","html_url":"https://github.com/pdehaan","followers_url":"https://api.github.com/users/pdehaan/followers","following_url":"https://api.github.com/users/pdehaan/following{/other_user}","gists_url":"https://api.github.com/users/pdehaan/gists{/gist_id}","starred_url":"https://api.github.com/users/pdehaan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pdehaan/subscriptions","organizations_url":"https://api.github.com/users/pdehaan/orgs","repos_url":"https://api.github.com/users/pdehaan/repos","events_url":"https://api.github.com/users/pdehaan/events{/privacy}","received_events_url":"https://api.github.com/users/pdehaan/received_events","type":"User","site_admin":false},"created_at":"2015-02-12T19:10:41Z","updated_at":"2015-02-12T19:10:41Z","body":"I was actually randomly thinking about this today and did find [**husky**](https://github.com/typicode/husky) which seems pretty sweet and lets you easily do `precommit`, `prepush`, and `postmerge` hooks.\r\n\r\nIt seems to be a lot better at letting you easily do hooks, so maybe moving linting from `precommit` to `premerge` will save you untold minutes per day (if we combine with **grunt-newer** so we're only linting a minimal number of files).\r\n\r\n```js\r\n    \"precommit\": \"echo 'hey gurl'\",\r\n    \"prepush\": \"npm run lint\",\r\n```\r\n\r\nYour solution sounds really solid too, I can try Googling and see how easy it'd be to lint an arbitrary list of files. I'd be interesting to see a comparison between your proposed solution and something like **grunt-newer** and see how much time is spent on file globbing/searching vs just Grunt infrastructure."}}