{"action":"created","issue":{"url":"https://api.github.com/repos/rossPatton/stylint/issues/110","labels_url":"https://api.github.com/repos/rossPatton/stylint/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/rossPatton/stylint/issues/110/comments","events_url":"https://api.github.com/repos/rossPatton/stylint/issues/110/events","html_url":"https://github.com/rossPatton/stylint/issues/110","id":86589509,"number":110,"title":"Regex to remove comments clashing with file globbing - causing hanging process","user":{"login":"jackbrewer","id":720908,"avatar_url":"https://avatars.githubusercontent.com/u/720908?v=3","gravatar_id":"","url":"https://api.github.com/users/jackbrewer","html_url":"https://github.com/jackbrewer","followers_url":"https://api.github.com/users/jackbrewer/followers","following_url":"https://api.github.com/users/jackbrewer/following{/other_user}","gists_url":"https://api.github.com/users/jackbrewer/gists{/gist_id}","starred_url":"https://api.github.com/users/jackbrewer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jackbrewer/subscriptions","organizations_url":"https://api.github.com/users/jackbrewer/orgs","repos_url":"https://api.github.com/users/jackbrewer/repos","events_url":"https://api.github.com/users/jackbrewer/events{/privacy}","received_events_url":"https://api.github.com/users/jackbrewer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-09T12:51:41Z","updated_at":"2015-06-09T15:54:15Z","closed_at":null,"body":"### Problem\r\n\r\nI've run in to an issue when using Stylus [file globbing](https://learnboost.github.io/stylus/docs/import.html#file-globbing) for `@import` and `@require`. \r\n\r\nStylint process can hang indefinitely, using 100% CPU (depending on file length, and the location of the glob within the file).\r\n\r\nExample:\r\n`@require 'components/*'`\r\n\r\n### Diagnosis\r\n\r\nIt seems the [regex in `parse.js`](https://learnboost.github.io/stylus/docs/import.html#file-globbing) is catching the trailing `/*` of the above line and is treating it as an opening comment. As it can never find a closing comment, it keeps searching through subsequent lines, getting exponentially slower. Multiple globs in a file makes things worse.\r\n\r\nThe following gif shows a stripped back example - you can see the 'steps' in the top-right ~doubling with each new-line.\r\n\r\n![runaway-regex](https://cloud.githubusercontent.com/assets/720908/8057537/05351868-0eaa-11e5-895a-521cf6ddef8f.gif)\r\n\r\nLive Example - https://regex101.com/r/jU0eJ2/1\r\n\r\n### Solution\r\n\r\nNew regex which accounts for this edge-case. I know @benedfit is taking a look at possible fix, but we're finding it hard to find a solution which doesn't introduce another edge-case where an actual comment gets missed, so I thought I'd raise here in the meantime."},"comment":{"url":"https://api.github.com/repos/rossPatton/stylint/issues/comments/110412532","html_url":"https://github.com/rossPatton/stylint/issues/110#issuecomment-110412532","issue_url":"https://api.github.com/repos/rossPatton/stylint/issues/110","id":110412532,"user":{"login":"benedfit","id":580859,"avatar_url":"https://avatars.githubusercontent.com/u/580859?v=3","gravatar_id":"","url":"https://api.github.com/users/benedfit","html_url":"https://github.com/benedfit","followers_url":"https://api.github.com/users/benedfit/followers","following_url":"https://api.github.com/users/benedfit/following{/other_user}","gists_url":"https://api.github.com/users/benedfit/gists{/gist_id}","starred_url":"https://api.github.com/users/benedfit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benedfit/subscriptions","organizations_url":"https://api.github.com/users/benedfit/orgs","repos_url":"https://api.github.com/users/benedfit/repos","events_url":"https://api.github.com/users/benedfit/events{/privacy}","received_events_url":"https://api.github.com/users/benedfit/received_events","type":"User","site_admin":false},"created_at":"2015-06-09T15:54:15Z","updated_at":"2015-06-09T15:54:15Z","body":"https://regex101.com/r/zM0xA6/6 has cracked it. Going to submit a PR shortly"}}