{"action":"created","issue":{"url":"https://api.github.com/repos/bem/bem-xjst/issues/377","repository_url":"https://api.github.com/repos/bem/bem-xjst","labels_url":"https://api.github.com/repos/bem/bem-xjst/issues/377/labels{/name}","comments_url":"https://api.github.com/repos/bem/bem-xjst/issues/377/comments","events_url":"https://api.github.com/repos/bem/bem-xjst/issues/377/events","html_url":"https://github.com/bem/bem-xjst/pull/377","id":185380878,"number":377,"title":"Static analyzer","user":{"login":"miripiruni","id":144537,"avatar_url":"https://avatars.githubusercontent.com/u/144537?v=3","gravatar_id":"","url":"https://api.github.com/users/miripiruni","html_url":"https://github.com/miripiruni","followers_url":"https://api.github.com/users/miripiruni/followers","following_url":"https://api.github.com/users/miripiruni/following{/other_user}","gists_url":"https://api.github.com/users/miripiruni/gists{/gist_id}","starred_url":"https://api.github.com/users/miripiruni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miripiruni/subscriptions","organizations_url":"https://api.github.com/users/miripiruni/orgs","repos_url":"https://api.github.com/users/miripiruni/repos","events_url":"https://api.github.com/users/miripiruni/events{/privacy}","received_events_url":"https://api.github.com/users/miripiruni/received_events","type":"User","site_admin":false},"labels":[{"id":339364120,"url":"https://api.github.com/repos/bem/bem-xjst/labels/scope:%20debuggability","name":"scope: debuggability","color":"ededed","default":false},{"id":246376959,"url":"https://api.github.com/repos/bem/bem-xjst/labels/semver:%20minor","name":"semver: minor","color":"ededed","default":false},{"id":263491866,"url":"https://api.github.com/repos/bem/bem-xjst/labels/status:%20review","name":"status: review","color":"ededed","default":false},{"id":371482377,"url":"https://api.github.com/repos/bem/bem-xjst/labels/type:%20new%20feature","name":"type: new feature","color":"f2efe5","default":false}],"state":"open","locked":false,"assignee":{"login":"miripiruni","id":144537,"avatar_url":"https://avatars.githubusercontent.com/u/144537?v=3","gravatar_id":"","url":"https://api.github.com/users/miripiruni","html_url":"https://github.com/miripiruni","followers_url":"https://api.github.com/users/miripiruni/followers","following_url":"https://api.github.com/users/miripiruni/following{/other_user}","gists_url":"https://api.github.com/users/miripiruni/gists{/gist_id}","starred_url":"https://api.github.com/users/miripiruni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miripiruni/subscriptions","organizations_url":"https://api.github.com/users/miripiruni/orgs","repos_url":"https://api.github.com/users/miripiruni/repos","events_url":"https://api.github.com/users/miripiruni/events{/privacy}","received_events_url":"https://api.github.com/users/miripiruni/received_events","type":"User","site_admin":false},"assignees":[{"login":"miripiruni","id":144537,"avatar_url":"https://avatars.githubusercontent.com/u/144537?v=3","gravatar_id":"","url":"https://api.github.com/users/miripiruni","html_url":"https://github.com/miripiruni","followers_url":"https://api.github.com/users/miripiruni/followers","following_url":"https://api.github.com/users/miripiruni/following{/other_user}","gists_url":"https://api.github.com/users/miripiruni/gists{/gist_id}","starred_url":"https://api.github.com/users/miripiruni/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miripiruni/subscriptions","organizations_url":"https://api.github.com/users/miripiruni/orgs","repos_url":"https://api.github.com/users/miripiruni/repos","events_url":"https://api.github.com/users/miripiruni/events{/privacy}","received_events_url":"https://api.github.com/users/miripiruni/received_events","type":"User","site_admin":false}],"milestone":null,"comments":10,"created_at":"2016-10-26T12:35:34Z","updated_at":"2016-12-01T13:05:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/bem/bem-xjst/pulls/377","html_url":"https://github.com/bem/bem-xjst/pull/377","diff_url":"https://github.com/bem/bem-xjst/pull/377.diff","patch_url":"https://github.com/bem/bem-xjst/pull/377.patch"},"body":"Fixes \r\n- [Static lint](https://github.com/bem/bem-xjst/issues/49) (Issue 49)\r\n- [Migration script for every major version](https://github.com/bem/bem-xjst/issues/353) (Issue 353)\r\n### Changes proposed in this pull request\r\n\r\nI introduce two features:\r\n1. Static linter\r\n2. Mirgation scripts\r\n\r\nBoth of them on jscodeshift + my boilerplate code for logging and AST checking.\r\n### How static lint work?\r\n\r\n`$ ./bin/bem-xjst-lint ./path-to-templates/ 7 8` \r\n\r\n7 — current major version of bem-xjst templates\r\n8 — version to check for\r\n\r\nExample:\r\n\r\n```\r\n$ ./bin/bem-xjst-lint ./migration/tmpls/ 1 8\r\nSTATIC LINT MODE\r\nProcessing 1 files...\r\nSpawning 1 workers...\r\nSending 1 files to free worker...\r\nBEM-XJST WARNING:\r\n>>>> Function that returns a literal can be replaced with literal itself.\r\n>>>> migration/tmpls/template.js:1:17\r\n>>>> function() { return 'abc'; }\r\n\r\n\r\nBEM-XJST WARNING:\r\n>>>> Function that returns a literal can be replaced with literal itself.\r\n>>>> migration/tmpls/template.js:8:17\r\n>>>> function() { return 42; }\r\n\r\n\r\nAll done.\r\nResults:\r\n0 errors\r\n0 unmodified\r\n1 skipped\r\n0 ok\r\nTime elapsed: 7.805seconds\r\n```\r\n### How migrate tool work?\r\n\r\n`./bin/bem-xjst-migrate /path-to-tamplates/ 7 8`\r\n\r\n7 — current major version of bem-xjst templates\r\n8 — version to check for\r\n\r\nExample:\r\n\r\n```\r\n$ ./bin/bem-xjst-migrate ./migration/tmpls/ 7 8\r\n\r\nProcessing 2 files...\r\nSpawning 2 workers...\r\nSending 1 files to free worker...\r\nSending 1 files to free worker...\r\nAll done.\r\nResults:\r\n0 errors\r\n1 unmodified\r\n0 skipped\r\n1 ok\r\nTime elapsed: 3.896seconds\r\n```\r\n\r\n\r\n### TODO\r\n- [x] Documentation changed\r\n- [x] Tests\r\n- [x] Collect list of transformers/linters (see below)\r\n\r\nTransformers:\r\nfor v7 to v8\r\n- [x] `mix()` to `addMix()`\r\n- [x] `attrs()` to `addAttrs()`\r\n\r\nfor v6 to v7\r\n- [x] `this.isArray(argument)` to `Array.isArray(argument)`\r\n- [x] `once()` to `def()`\r\n- [x] For safety: modifiers value should be String type. In BEMJSON and in template. If not so - we must warn you. Comare sandbox example in v6.x and v7.x https://goo.gl/auhOOV\r\n- [x] for backwards capability use xhtml: true option value in all bemxjst.compile() functions.\r\n\r\nfor v5 to v6\r\n- [x] There is nothing to rewrite in templates. (Really?)\r\n\r\nfor v4 to v5\r\n- [x] Replace `elemMatch(argument)` to `elem('*').match(function() { ... })`.\r\n- [x] `mods` for `elem` (instead of `elemMods`). behavior `mods` and `elemMods` BEMJSON fields are changed. bem-xjst should not treat `elemMods` as `mods`. See [qfox’s comment](https://nda.ya.ru/3S82Z9) — [BEMJSON tested in runtime lint](https://github.com/bem/bem-xjst/blob/master/runtime-lint/index.js#L123).\r\n- [x] API changed: require('bem-xjst') now returns two engines bemhtml and bemtree. Replace require('bem-xjst') to require('bem-xjst').bemhtml.\r\n\r\nfor v2 to v3\r\n- [x] Do not use `apply.call(BEMJSON)`. Use `apply(BEMJSON)`.\r\n\r\nfor v1 to v2\r\n- [x] Default (def()) mode of templates MUST return a string now.\r\n- [x] this._ no more\r\n- [x] mode('') no more\r\n\r\nSome common checks:\r\n- [x] Function that returns a literal can be replaced with literal itself.\r\n- [x] warn about this.mods && this.mods.some should be this.mods.some\r\n- [x] `mix()([])` to function generator instead: `function() { return []; }`.\r\n- [x] warn about html entities. Suggest UTF-8 symbols.\r\n- [x] assignment to `ctx.mods` (instead of `this.mods`) — checked in runtime linter \r\n"},"comment":{"url":"https://api.github.com/repos/bem/bem-xjst/issues/comments/264168706","html_url":"https://github.com/bem/bem-xjst/pull/377#issuecomment-264168706","issue_url":"https://api.github.com/repos/bem/bem-xjst/issues/377","id":264168706,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars.githubusercontent.com/u/2354108?v=3","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2016-12-01T13:05:42Z","updated_at":"2016-12-01T13:05:42Z","body":"\n[![Coverage Status](https://coveralls.io/builds/9080879/badge)](https://coveralls.io/builds/9080879)\n\nCoverage remained the same at 97.024% when pulling **b2520f01787c25eb7883e4596492080ce95212cc on static-analyze** into **99fa7425d497c802f17f6b81f664fd87209cd935 on master**.\n"}}
{"actor":{"display_login":"coveralls"}}