exercism-analysis 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (579) hide show
  1. checksums.yaml +7 -0
  2. data/exercism-analysis.gemspec +30 -0
  3. data/lib/exercism-analysis.rb +38 -0
  4. data/lib/exercism-analysis/adapters/adapter.rb +23 -0
  5. data/lib/exercism-analysis/adapters/clojure.rb +13 -0
  6. data/lib/exercism-analysis/adapters/go.rb +19 -0
  7. data/lib/exercism-analysis/adapters/javascript.rb +13 -0
  8. data/lib/exercism-analysis/adapters/python.rb +13 -0
  9. data/lib/exercism-analysis/adapters/ruby.rb +19 -0
  10. data/lib/exercism-analysis/analysis.rb +18 -0
  11. data/lib/exercism-analysis/analyzers/analyzer.rb +54 -0
  12. data/lib/exercism-analysis/analyzers/clojure/kibit.rb +25 -0
  13. data/lib/exercism-analysis/analyzers/go/golint.rb +23 -0
  14. data/lib/exercism-analysis/analyzers/javascript/jslint.rb +24 -0
  15. data/lib/exercism-analysis/analyzers/python/pylint.rb +24 -0
  16. data/lib/exercism-analysis/analyzers/ruby/control_flow.rb +21 -0
  17. data/lib/exercism-analysis/analyzers/ruby/enumerable_condition.rb +21 -0
  18. data/lib/exercism-analysis/analyzers/ruby/for_loop.rb +29 -0
  19. data/lib/exercism-analysis/analyzers/ruby/indentation.rb +21 -0
  20. data/lib/exercism-analysis/analyzers/ruby/iter_mutation.rb +37 -0
  21. data/lib/exercism-analysis/analyzers/ruby/output.rb +20 -0
  22. data/lib/exercism-analysis/analyzers/ruby/range.rb +28 -0
  23. data/lib/exercism-analysis/analyzers/ruby/roodi.rb +19 -0
  24. data/lib/exercism-analysis/analyzers/ruby/send.rb +25 -0
  25. data/lib/exercism-analysis/analyzers/ruby/shebang.rb +23 -0
  26. data/lib/exercism-analysis/analyzers/ruby/tab.rb +38 -0
  27. data/lib/exercism-analysis/processors/call_processor.rb +39 -0
  28. data/lib/exercism-analysis/processors/control_flow_processor.rb +27 -0
  29. data/lib/exercism-analysis/processors/enumerable_condition_processor.rb +31 -0
  30. data/lib/exercism-analysis/processors/for_loop_processor.rb +21 -0
  31. data/lib/exercism-analysis/processors/indentation_processor.rb +69 -0
  32. data/lib/exercism-analysis/processors/iter_mutation_processor.rb +50 -0
  33. data/lib/exercism-analysis/processors/processor.rb +34 -0
  34. data/lib/exercism-analysis/processors/range_processor.rb +23 -0
  35. data/lib/exercism-analysis/processors/send_processor.rb +23 -0
  36. data/lib/exercism-analysis/templates/each_to_map.rb +29 -0
  37. data/lib/exercism-analysis/templates/each_to_select.rb +31 -0
  38. data/lib/exercism-analysis/templates/range_exclusive.rb +19 -0
  39. data/lib/exercism-analysis/templates/template.rb +29 -0
  40. data/vendor/clojure/kibit-runner/LICENSE +214 -0
  41. data/vendor/clojure/kibit-runner/project.clj +10 -0
  42. data/vendor/clojure/kibit-runner/src/kibit_runner/core.clj +17 -0
  43. data/vendor/clojure/kibit-runner/target/kibit-runner-0.1.0-SNAPSHOT-standalone.jar +0 -0
  44. data/vendor/clojure/kibit-runner/target/kibit-runner-0.1.0-SNAPSHOT.jar +0 -0
  45. data/vendor/clojure/kibit-runner/target/stale/extract-native.dependencies +1 -0
  46. data/vendor/go/src/github.com/golang/lint/LICENSE +27 -0
  47. data/vendor/go/src/github.com/golang/lint/README +59 -0
  48. data/vendor/go/src/github.com/golang/lint/golint/golint.go +67 -0
  49. data/vendor/go/src/github.com/golang/lint/lint.go +1061 -0
  50. data/vendor/go/src/runner/golint_runner.go +23 -0
  51. data/vendor/javascript/jshint_runner.js +6 -0
  52. data/vendor/javascript/node_modules/jshint/README.md +47 -0
  53. data/vendor/javascript/node_modules/jshint/bin/apply +6 -0
  54. data/vendor/javascript/node_modules/jshint/bin/build +36 -0
  55. data/vendor/javascript/node_modules/jshint/bin/changelog +36 -0
  56. data/vendor/javascript/node_modules/jshint/bin/jshint +3 -0
  57. data/vendor/javascript/node_modules/jshint/bin/land +34 -0
  58. data/vendor/javascript/node_modules/jshint/data/ascii-identifier-data.js +22 -0
  59. data/vendor/javascript/node_modules/jshint/data/non-ascii-identifier-part-only.js +1570 -0
  60. data/vendor/javascript/node_modules/jshint/data/non-ascii-identifier-start.js +48477 -0
  61. data/vendor/javascript/node_modules/jshint/dist/jshint-rhino.js +60642 -0
  62. data/vendor/javascript/node_modules/jshint/dist/jshint.js +60525 -0
  63. data/vendor/javascript/node_modules/jshint/node_modules/cli/README.md +196 -0
  64. data/vendor/javascript/node_modules/jshint/node_modules/cli/cli.js +1139 -0
  65. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/cat.js +17 -0
  66. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/command.js +16 -0
  67. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/echo.js +54 -0
  68. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/glob.js +6 -0
  69. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/long_desc.js +20 -0
  70. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/progress.js +11 -0
  71. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/sort.js +18 -0
  72. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/spinner.js +9 -0
  73. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/static.coffee +27 -0
  74. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/static.js +25 -0
  75. data/vendor/javascript/node_modules/jshint/node_modules/cli/index.js +1 -0
  76. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/LICENSE +27 -0
  77. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/README.md +250 -0
  78. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/examples/g.js +9 -0
  79. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/examples/usr-local.js +9 -0
  80. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/glob.js +728 -0
  81. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/LICENSE +16 -0
  82. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/README.md +42 -0
  83. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/inherits.js +1 -0
  84. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
  85. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/package.json +51 -0
  86. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/test.js +25 -0
  87. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/package.json +58 -0
  88. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/00-setup.js +176 -0
  89. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-comparison.js +63 -0
  90. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-results.json +351 -0
  91. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/cwd-test.js +55 -0
  92. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/globstar-match.js +19 -0
  93. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/mark.js +118 -0
  94. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/new-glob-optional-options.js +10 -0
  95. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/nocase-nomagic.js +113 -0
  96. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/pause-resume.js +73 -0
  97. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/readme-issue.js +36 -0
  98. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/root-nomount.js +39 -0
  99. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/root.js +46 -0
  100. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/stat.js +32 -0
  101. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/zz-cleanup.js +11 -0
  102. data/vendor/javascript/node_modules/jshint/node_modules/cli/package.json +70 -0
  103. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/LICENCE +19 -0
  104. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/README.md +33 -0
  105. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/index.js +86 -0
  106. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/LICENCE +19 -0
  107. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/README.md +45 -0
  108. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/index.js +5 -0
  109. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/package.json +89 -0
  110. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/seed.js +16 -0
  111. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/test/index.js +28 -0
  112. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/test/static/index.html +10 -0
  113. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/package.json +88 -0
  114. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/index.js +67 -0
  115. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/static/index.html +12 -0
  116. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/static/test-adapter.js +53 -0
  117. data/vendor/javascript/node_modules/jshint/node_modules/exit/Gruntfile.js +48 -0
  118. data/vendor/javascript/node_modules/jshint/node_modules/exit/LICENSE-MIT +22 -0
  119. data/vendor/javascript/node_modules/jshint/node_modules/exit/README.md +75 -0
  120. data/vendor/javascript/node_modules/jshint/node_modules/exit/lib/exit.js +41 -0
  121. data/vendor/javascript/node_modules/jshint/node_modules/exit/package.json +69 -0
  122. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/exit_test.js +121 -0
  123. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stderr.txt +10 -0
  124. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stdout-stderr.txt +20 -0
  125. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stdout.txt +10 -0
  126. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stderr.txt +100 -0
  127. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stdout-stderr.txt +200 -0
  128. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stdout.txt +100 -0
  129. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stderr.txt +1000 -0
  130. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stdout-stderr.txt +2000 -0
  131. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stdout.txt +1000 -0
  132. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/create-files.sh +8 -0
  133. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/log-broken.js +23 -0
  134. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/log.js +25 -0
  135. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/LICENSE +18 -0
  136. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/README.md +83 -0
  137. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/CollectingHandler.js +55 -0
  138. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/FeedHandler.js +95 -0
  139. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Parser.js +337 -0
  140. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/ProxyHandler.js +27 -0
  141. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Stream.js +35 -0
  142. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Tokenizer.js +891 -0
  143. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/WritableStream.js +21 -0
  144. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/index.js +68 -0
  145. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/LICENSE +11 -0
  146. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/index.js +14 -0
  147. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/package.json +40 -0
  148. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/readme.md +1 -0
  149. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/LICENSE +11 -0
  150. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/index.js +211 -0
  151. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/package.json +68 -0
  152. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/readme.md +102 -0
  153. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/01-basic.json +57 -0
  154. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/02-single_tag_1.json +21 -0
  155. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/03-single_tag_2.json +21 -0
  156. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/04-unescaped_in_script.json +27 -0
  157. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/05-tags_in_comment.json +18 -0
  158. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/06-comment_in_script.json +18 -0
  159. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/07-unescaped_in_style.json +20 -0
  160. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json +20 -0
  161. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/09-unquoted_attrib.json +20 -0
  162. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/10-singular_attribute.json +15 -0
  163. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/11-text_outside_tags.json +40 -0
  164. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/12-text_only.json +11 -0
  165. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/13-comment_in_text.json +19 -0
  166. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/14-comment_in_text_in_script.json +18 -0
  167. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/15-non-verbose.json +22 -0
  168. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/16-normalize_whitespace.json +47 -0
  169. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/17-xml_namespace.json +18 -0
  170. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/18-enforce_empty_tags.json +16 -0
  171. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/19-ignore_empty_tags.json +20 -0
  172. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/20-template_script_tags.json +20 -0
  173. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/21-conditional_comments.json +15 -0
  174. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/22-lowercase_tags.json +41 -0
  175. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/23-dom-lvl1.json +121 -0
  176. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/tests.js +58 -0
  177. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/LICENSE +11 -0
  178. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/index.js +14 -0
  179. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/helpers.js +141 -0
  180. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/legacy.js +87 -0
  181. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js +77 -0
  182. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/querying.js +94 -0
  183. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/stringify.js +93 -0
  184. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/traversal.js +24 -0
  185. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/package.json +71 -0
  186. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/readme.md +1 -0
  187. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/fixture.js +6 -0
  188. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/tests/helpers.js +89 -0
  189. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/tests/legacy.js +119 -0
  190. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/utils.js +9 -0
  191. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/LICENSE +11 -0
  192. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/index.js +31 -0
  193. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/decode.js +72 -0
  194. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.js +26 -0
  195. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/encode.js +48 -0
  196. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/decode.json +1 -0
  197. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/entities.json +1 -0
  198. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/legacy.json +1 -0
  199. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/xml.json +1 -0
  200. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/package.json +79 -0
  201. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/readme.md +31 -0
  202. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/test/mocha.opts +2 -0
  203. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/test/test.js +150 -0
  204. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/LICENSE +18 -0
  205. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/README.md +15 -0
  206. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/duplex.js +1 -0
  207. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/float.patch +923 -0
  208. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_duplex.js +89 -0
  209. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_passthrough.js +46 -0
  210. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_readable.js +944 -0
  211. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_transform.js +209 -0
  212. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_writable.js +472 -0
  213. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/README.md +3 -0
  214. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/float.patch +604 -0
  215. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +107 -0
  216. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/package.json +53 -0
  217. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/util.js +106 -0
  218. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/LICENSE +16 -0
  219. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/README.md +42 -0
  220. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/inherits.js +1 -0
  221. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/inherits_browser.js +23 -0
  222. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/package.json +51 -0
  223. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/test.js +25 -0
  224. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/README.md +54 -0
  225. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/build/build.js +209 -0
  226. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/component.json +19 -0
  227. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/index.js +3 -0
  228. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/package.json +54 -0
  229. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/LICENSE +20 -0
  230. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/README.md +7 -0
  231. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/index.js +200 -0
  232. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/package.json +53 -0
  233. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/package.json +68 -0
  234. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/passthrough.js +1 -0
  235. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/readable.js +7 -0
  236. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/transform.js +1 -0
  237. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/writable.js +1 -0
  238. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/package.json +90 -0
  239. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/01-events.js +9 -0
  240. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/02-stream.js +23 -0
  241. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/03-feed.js +19 -0
  242. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Atom_Example.xml +25 -0
  243. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Attributes.html +16 -0
  244. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Basic.html +1 -0
  245. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/RDF_Example.xml +63 -0
  246. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/RSS_Example.xml +48 -0
  247. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/01-simple.json +44 -0
  248. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/02-template.json +63 -0
  249. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/03-lowercase_tags.json +46 -0
  250. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/04-cdata.json +50 -0
  251. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/05-cdata-special.json +35 -0
  252. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/06-leading-lt.json +16 -0
  253. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/07-self-closing.json +67 -0
  254. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/08-implicit-close-tags.json +59 -0
  255. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/09-attributes.json +68 -0
  256. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/10-crazy-attrib.json +52 -0
  257. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/11-script_in_script.json +54 -0
  258. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/12-long-comment-end.json +20 -0
  259. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/13-long-cdata-end.json +22 -0
  260. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/14-implicit-open-tags.json +27 -0
  261. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/15-lt-whitespace.json +16 -0
  262. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/16-double_attribs.json +45 -0
  263. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/17-numeric_entities.json +16 -0
  264. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/18-legacy_entities.json +16 -0
  265. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/19-named_entities.json +16 -0
  266. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/20-xml_entities.json +16 -0
  267. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/21-entity_in_attribute.json +38 -0
  268. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/22-double_brackets.json +41 -0
  269. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/23-legacy_entity_fail.json +16 -0
  270. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/24-special_special.json +133 -0
  271. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/25-empty_tag_name.json +13 -0
  272. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/26-not-quite-closed.json +35 -0
  273. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/27-entities_in_attributes.json +62 -0
  274. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/28-cdata_in_html.json +9 -0
  275. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/29-comment_edge-cases.json +18 -0
  276. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/30-cdata_edge-cases.json +22 -0
  277. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/01-rss.js +34 -0
  278. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/02-atom.js +18 -0
  279. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/03-rdf.js +20 -0
  280. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/01-basic.json +83 -0
  281. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/02-RSS.json +1093 -0
  282. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/03-Atom.json +644 -0
  283. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/04-RDF.json +1399 -0
  284. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/05-Attributes.json +354 -0
  285. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/api.js +63 -0
  286. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/test-helper.js +83 -0
  287. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/LICENSE +23 -0
  288. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/README.md +218 -0
  289. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/minimatch.js +1061 -0
  290. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS +14 -0
  291. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
  292. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
  293. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +252 -0
  294. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/package.json +50 -0
  295. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/basic.js +369 -0
  296. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
  297. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
  298. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
  299. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
  300. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
  301. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/package.json +58 -0
  302. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
  303. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
  304. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/package.json +57 -0
  305. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/basic.js +399 -0
  306. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/brace-expand.js +33 -0
  307. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/caching.js +14 -0
  308. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/defaults.js +274 -0
  309. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
  310. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/LICENSE +26 -0
  311. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/README.md +569 -0
  312. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/bin/shjs +51 -0
  313. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/global.js +3 -0
  314. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/make.js +47 -0
  315. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/package.json +61 -0
  316. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/scripts/generate-docs.js +21 -0
  317. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/scripts/run-tests.js +50 -0
  318. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/shell.js +157 -0
  319. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cat.js +43 -0
  320. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cd.js +19 -0
  321. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/chmod.js +208 -0
  322. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/common.js +203 -0
  323. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cp.js +201 -0
  324. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/dirs.js +191 -0
  325. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/echo.js +20 -0
  326. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/error.js +10 -0
  327. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/exec.js +181 -0
  328. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/find.js +51 -0
  329. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/grep.js +52 -0
  330. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/ln.js +53 -0
  331. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/ls.js +126 -0
  332. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/mkdir.js +68 -0
  333. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/mv.js +80 -0
  334. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/popd.js +1 -0
  335. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/pushd.js +1 -0
  336. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/pwd.js +11 -0
  337. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/rm.js +145 -0
  338. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/sed.js +43 -0
  339. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/tempdir.js +56 -0
  340. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/test.js +85 -0
  341. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/to.js +29 -0
  342. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/toEnd.js +29 -0
  343. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/which.js +83 -0
  344. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/cli.js +41 -0
  345. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/package.json +76 -0
  346. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/readme.md +74 -0
  347. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/strip-json-comments.js +64 -0
  348. data/vendor/javascript/node_modules/jshint/node_modules/underscore/LICENSE +23 -0
  349. data/vendor/javascript/node_modules/jshint/node_modules/underscore/README.md +22 -0
  350. data/vendor/javascript/node_modules/jshint/node_modules/underscore/package.json +66 -0
  351. data/vendor/javascript/node_modules/jshint/node_modules/underscore/underscore-min.js +6 -0
  352. data/vendor/javascript/node_modules/jshint/node_modules/underscore/underscore.js +1343 -0
  353. data/vendor/javascript/node_modules/jshint/package.json +80 -0
  354. data/vendor/javascript/node_modules/jshint/src/cli.js +731 -0
  355. data/vendor/javascript/node_modules/jshint/src/jshint.js +5023 -0
  356. data/vendor/javascript/node_modules/jshint/src/lex.js +1650 -0
  357. data/vendor/javascript/node_modules/jshint/src/messages.js +223 -0
  358. data/vendor/javascript/node_modules/jshint/src/platforms/rhino.js +115 -0
  359. data/vendor/javascript/node_modules/jshint/src/reg.js +38 -0
  360. data/vendor/javascript/node_modules/jshint/src/reporters/checkstyle.js +81 -0
  361. data/vendor/javascript/node_modules/jshint/src/reporters/default.js +34 -0
  362. data/vendor/javascript/node_modules/jshint/src/reporters/jslint_xml.js +57 -0
  363. data/vendor/javascript/node_modules/jshint/src/reporters/non_error.js +52 -0
  364. data/vendor/javascript/node_modules/jshint/src/state.js +28 -0
  365. data/vendor/javascript/node_modules/jshint/src/style.js +143 -0
  366. data/vendor/javascript/node_modules/jshint/src/vars.js +658 -0
  367. data/vendor/python/astroid/COPYING +339 -0
  368. data/vendor/python/astroid/COPYING.LESSER +510 -0
  369. data/vendor/python/astroid/ChangeLog +574 -0
  370. data/vendor/python/astroid/MANIFEST.in +9 -0
  371. data/vendor/python/astroid/README +56 -0
  372. data/vendor/python/astroid/README.Python3 +26 -0
  373. data/vendor/python/astroid/__init__.py +118 -0
  374. data/vendor/python/astroid/__init__.pyc +0 -0
  375. data/vendor/python/astroid/__pkginfo__.py +48 -0
  376. data/vendor/python/astroid/__pkginfo__.pyc +0 -0
  377. data/vendor/python/astroid/announce.txt +23 -0
  378. data/vendor/python/astroid/as_string.py +496 -0
  379. data/vendor/python/astroid/as_string.pyc +0 -0
  380. data/vendor/python/astroid/bases.py +618 -0
  381. data/vendor/python/astroid/bases.pyc +0 -0
  382. data/vendor/python/astroid/brain/py2gi.py +159 -0
  383. data/vendor/python/astroid/brain/py2gi.pyc +0 -0
  384. data/vendor/python/astroid/brain/py2mechanize.py +20 -0
  385. data/vendor/python/astroid/brain/py2mechanize.pyc +0 -0
  386. data/vendor/python/astroid/brain/py2qt4.py +25 -0
  387. data/vendor/python/astroid/brain/py2qt4.pyc +0 -0
  388. data/vendor/python/astroid/brain/py2stdlib.py +252 -0
  389. data/vendor/python/astroid/brain/py2stdlib.pyc +0 -0
  390. data/vendor/python/astroid/builder.py +238 -0
  391. data/vendor/python/astroid/builder.pyc +0 -0
  392. data/vendor/python/astroid/exceptions.py +51 -0
  393. data/vendor/python/astroid/exceptions.pyc +0 -0
  394. data/vendor/python/astroid/inference.py +393 -0
  395. data/vendor/python/astroid/inference.pyc +0 -0
  396. data/vendor/python/astroid/inspector.py +275 -0
  397. data/vendor/python/astroid/manager.py +336 -0
  398. data/vendor/python/astroid/manager.pyc +0 -0
  399. data/vendor/python/astroid/mixins.py +122 -0
  400. data/vendor/python/astroid/mixins.pyc +0 -0
  401. data/vendor/python/astroid/node_classes.py +928 -0
  402. data/vendor/python/astroid/node_classes.pyc +0 -0
  403. data/vendor/python/astroid/nodes.py +73 -0
  404. data/vendor/python/astroid/nodes.pyc +0 -0
  405. data/vendor/python/astroid/protocols.py +322 -0
  406. data/vendor/python/astroid/protocols.pyc +0 -0
  407. data/vendor/python/astroid/raw_building.py +361 -0
  408. data/vendor/python/astroid/raw_building.pyc +0 -0
  409. data/vendor/python/astroid/rebuilder.py +954 -0
  410. data/vendor/python/astroid/rebuilder.pyc +0 -0
  411. data/vendor/python/astroid/scoped_nodes.py +1118 -0
  412. data/vendor/python/astroid/scoped_nodes.pyc +0 -0
  413. data/vendor/python/astroid/setup.py +184 -0
  414. data/vendor/python/astroid/tox.ini +10 -0
  415. data/vendor/python/astroid/utils.py +236 -0
  416. data/vendor/python/astroid/utils.pyc +0 -0
  417. data/vendor/python/logilab/__init__.py +0 -0
  418. data/vendor/python/logilab/__init__.pyc +0 -0
  419. data/vendor/python/logilab/common/COPYING +339 -0
  420. data/vendor/python/logilab/common/COPYING.LESSER +510 -0
  421. data/vendor/python/logilab/common/ChangeLog +1517 -0
  422. data/vendor/python/logilab/common/MANIFEST.in +13 -0
  423. data/vendor/python/logilab/common/README +185 -0
  424. data/vendor/python/logilab/common/README.Python3 +29 -0
  425. data/vendor/python/logilab/common/__init__.py +171 -0
  426. data/vendor/python/logilab/common/__init__.pyc +0 -0
  427. data/vendor/python/logilab/common/__pkginfo__.py +53 -0
  428. data/vendor/python/logilab/common/__pkginfo__.pyc +0 -0
  429. data/vendor/python/logilab/common/announce.txt +25 -0
  430. data/vendor/python/logilab/common/bin/pytest +7 -0
  431. data/vendor/python/logilab/common/bin/pytest.bat +17 -0
  432. data/vendor/python/logilab/common/cache.py +114 -0
  433. data/vendor/python/logilab/common/changelog.py +236 -0
  434. data/vendor/python/logilab/common/changelog.pyc +0 -0
  435. data/vendor/python/logilab/common/clcommands.py +332 -0
  436. data/vendor/python/logilab/common/cli.py +208 -0
  437. data/vendor/python/logilab/common/compat.py +243 -0
  438. data/vendor/python/logilab/common/compat.pyc +0 -0
  439. data/vendor/python/logilab/common/configuration.py +1094 -0
  440. data/vendor/python/logilab/common/configuration.pyc +0 -0
  441. data/vendor/python/logilab/common/contexts.py +5 -0
  442. data/vendor/python/logilab/common/corbautils.py +117 -0
  443. data/vendor/python/logilab/common/daemon.py +100 -0
  444. data/vendor/python/logilab/common/date.py +333 -0
  445. data/vendor/python/logilab/common/dbf.py +229 -0
  446. data/vendor/python/logilab/common/debugger.py +210 -0
  447. data/vendor/python/logilab/common/decorators.py +281 -0
  448. data/vendor/python/logilab/common/decorators.pyc +0 -0
  449. data/vendor/python/logilab/common/deprecation.py +188 -0
  450. data/vendor/python/logilab/common/deprecation.pyc +0 -0
  451. data/vendor/python/logilab/common/fileutils.py +402 -0
  452. data/vendor/python/logilab/common/graph.py +276 -0
  453. data/vendor/python/logilab/common/graph.pyc +0 -0
  454. data/vendor/python/logilab/common/hg.py +130 -0
  455. data/vendor/python/logilab/common/interface.py +71 -0
  456. data/vendor/python/logilab/common/interface.pyc +0 -0
  457. data/vendor/python/logilab/common/logging_ext.py +193 -0
  458. data/vendor/python/logilab/common/modutils.py +695 -0
  459. data/vendor/python/logilab/common/modutils.pyc +0 -0
  460. data/vendor/python/logilab/common/optik_ext.py +391 -0
  461. data/vendor/python/logilab/common/optik_ext.pyc +0 -0
  462. data/vendor/python/logilab/common/optparser.py +90 -0
  463. data/vendor/python/logilab/common/proc.py +277 -0
  464. data/vendor/python/logilab/common/pyro_ext.py +180 -0
  465. data/vendor/python/logilab/common/pytest.py +1177 -0
  466. data/vendor/python/logilab/common/python-logilab-common.spec +184 -0
  467. data/vendor/python/logilab/common/registry.py +1113 -0
  468. data/vendor/python/logilab/common/setup.cfg +3 -0
  469. data/vendor/python/logilab/common/setup.py +189 -0
  470. data/vendor/python/logilab/common/shellutils.py +455 -0
  471. data/vendor/python/logilab/common/sphinx_ext.py +87 -0
  472. data/vendor/python/logilab/common/sphinxutils.py +122 -0
  473. data/vendor/python/logilab/common/table.py +925 -0
  474. data/vendor/python/logilab/common/tasksqueue.py +100 -0
  475. data/vendor/python/logilab/common/textutils.py +534 -0
  476. data/vendor/python/logilab/common/textutils.pyc +0 -0
  477. data/vendor/python/logilab/common/tree.py +369 -0
  478. data/vendor/python/logilab/common/tree.pyc +0 -0
  479. data/vendor/python/logilab/common/umessage.py +190 -0
  480. data/vendor/python/logilab/common/ureports/__init__.py +174 -0
  481. data/vendor/python/logilab/common/ureports/__init__.pyc +0 -0
  482. data/vendor/python/logilab/common/ureports/docbook_writer.py +139 -0
  483. data/vendor/python/logilab/common/ureports/html_writer.py +131 -0
  484. data/vendor/python/logilab/common/ureports/html_writer.pyc +0 -0
  485. data/vendor/python/logilab/common/ureports/nodes.py +201 -0
  486. data/vendor/python/logilab/common/ureports/nodes.pyc +0 -0
  487. data/vendor/python/logilab/common/ureports/text_writer.py +140 -0
  488. data/vendor/python/logilab/common/ureports/text_writer.pyc +0 -0
  489. data/vendor/python/logilab/common/urllib2ext.py +87 -0
  490. data/vendor/python/logilab/common/vcgutils.py +216 -0
  491. data/vendor/python/logilab/common/visitor.py +107 -0
  492. data/vendor/python/logilab/common/visitor.pyc +0 -0
  493. data/vendor/python/logilab/common/xmlrpcutils.py +131 -0
  494. data/vendor/python/logilab/common/xmlutils.py +61 -0
  495. data/vendor/python/pylint/CONTRIBUTORS.txt +38 -0
  496. data/vendor/python/pylint/COPYING +340 -0
  497. data/vendor/python/pylint/ChangeLog +1437 -0
  498. data/vendor/python/pylint/DEPENDS +3 -0
  499. data/vendor/python/pylint/MANIFEST.in +14 -0
  500. data/vendor/python/pylint/README +50 -0
  501. data/vendor/python/pylint/README.Python3 +37 -0
  502. data/vendor/python/pylint/__init__.py +44 -0
  503. data/vendor/python/pylint/__init__.pyc +0 -0
  504. data/vendor/python/pylint/__main__.py +3 -0
  505. data/vendor/python/pylint/__pkginfo__.py +74 -0
  506. data/vendor/python/pylint/__pkginfo__.pyc +0 -0
  507. data/vendor/python/pylint/bin/epylint +3 -0
  508. data/vendor/python/pylint/bin/epylint.bat +5 -0
  509. data/vendor/python/pylint/bin/pylint +3 -0
  510. data/vendor/python/pylint/bin/pylint-gui +3 -0
  511. data/vendor/python/pylint/bin/pylint-gui.bat +5 -0
  512. data/vendor/python/pylint/bin/pylint.bat +5 -0
  513. data/vendor/python/pylint/bin/pyreverse +3 -0
  514. data/vendor/python/pylint/bin/pyreverse.bat +5 -0
  515. data/vendor/python/pylint/bin/symilar +3 -0
  516. data/vendor/python/pylint/bin/symilar.bat +5 -0
  517. data/vendor/python/pylint/checkers/__init__.py +145 -0
  518. data/vendor/python/pylint/checkers/__init__.pyc +0 -0
  519. data/vendor/python/pylint/checkers/base.py +1141 -0
  520. data/vendor/python/pylint/checkers/base.pyc +0 -0
  521. data/vendor/python/pylint/checkers/classes.py +792 -0
  522. data/vendor/python/pylint/checkers/classes.pyc +0 -0
  523. data/vendor/python/pylint/checkers/design_analysis.py +367 -0
  524. data/vendor/python/pylint/checkers/design_analysis.pyc +0 -0
  525. data/vendor/python/pylint/checkers/exceptions.py +306 -0
  526. data/vendor/python/pylint/checkers/exceptions.pyc +0 -0
  527. data/vendor/python/pylint/checkers/format.py +943 -0
  528. data/vendor/python/pylint/checkers/format.pyc +0 -0
  529. data/vendor/python/pylint/checkers/imports.py +394 -0
  530. data/vendor/python/pylint/checkers/imports.pyc +0 -0
  531. data/vendor/python/pylint/checkers/logging.py +213 -0
  532. data/vendor/python/pylint/checkers/logging.pyc +0 -0
  533. data/vendor/python/pylint/checkers/misc.py +90 -0
  534. data/vendor/python/pylint/checkers/misc.pyc +0 -0
  535. data/vendor/python/pylint/checkers/newstyle.py +151 -0
  536. data/vendor/python/pylint/checkers/newstyle.pyc +0 -0
  537. data/vendor/python/pylint/checkers/raw_metrics.py +129 -0
  538. data/vendor/python/pylint/checkers/raw_metrics.pyc +0 -0
  539. data/vendor/python/pylint/checkers/similar.py +365 -0
  540. data/vendor/python/pylint/checkers/similar.pyc +0 -0
  541. data/vendor/python/pylint/checkers/stdlib.py +69 -0
  542. data/vendor/python/pylint/checkers/stdlib.pyc +0 -0
  543. data/vendor/python/pylint/checkers/strings.py +304 -0
  544. data/vendor/python/pylint/checkers/strings.pyc +0 -0
  545. data/vendor/python/pylint/checkers/typecheck.py +451 -0
  546. data/vendor/python/pylint/checkers/typecheck.pyc +0 -0
  547. data/vendor/python/pylint/checkers/utils.py +416 -0
  548. data/vendor/python/pylint/checkers/utils.pyc +0 -0
  549. data/vendor/python/pylint/checkers/variables.py +741 -0
  550. data/vendor/python/pylint/checkers/variables.pyc +0 -0
  551. data/vendor/python/pylint/config.py +156 -0
  552. data/vendor/python/pylint/config.pyc +0 -0
  553. data/vendor/python/pylint/epylint.py +175 -0
  554. data/vendor/python/pylint/gui.py +508 -0
  555. data/vendor/python/pylint/interfaces.py +72 -0
  556. data/vendor/python/pylint/interfaces.pyc +0 -0
  557. data/vendor/python/pylint/lint.py +1106 -0
  558. data/vendor/python/pylint/lint.pyc +0 -0
  559. data/vendor/python/pylint/pyreverse/__init__.py +5 -0
  560. data/vendor/python/pylint/pyreverse/diadefslib.py +233 -0
  561. data/vendor/python/pylint/pyreverse/diagrams.py +247 -0
  562. data/vendor/python/pylint/pyreverse/main.py +124 -0
  563. data/vendor/python/pylint/pyreverse/utils.py +131 -0
  564. data/vendor/python/pylint/pyreverse/writer.py +199 -0
  565. data/vendor/python/pylint/reporters/__init__.py +138 -0
  566. data/vendor/python/pylint/reporters/__init__.pyc +0 -0
  567. data/vendor/python/pylint/reporters/guireporter.py +28 -0
  568. data/vendor/python/pylint/reporters/guireporter.pyc +0 -0
  569. data/vendor/python/pylint/reporters/html.py +70 -0
  570. data/vendor/python/pylint/reporters/html.pyc +0 -0
  571. data/vendor/python/pylint/reporters/text.py +143 -0
  572. data/vendor/python/pylint/reporters/text.pyc +0 -0
  573. data/vendor/python/pylint/setup.cfg +3 -0
  574. data/vendor/python/pylint/setup.py +203 -0
  575. data/vendor/python/pylint/tox.ini +10 -0
  576. data/vendor/python/pylint/utils.py +744 -0
  577. data/vendor/python/pylint/utils.pyc +0 -0
  578. data/vendor/python/pylint_runner.py +22 -0
  579. metadata +675 -0
@@ -0,0 +1,72 @@
1
+ # This program is free software; you can redistribute it and/or modify it under
2
+ # the terms of the GNU General Public License as published by the Free Software
3
+ # Foundation; either version 2 of the License, or (at your option) any later
4
+ # version.
5
+ #
6
+ # This program is distributed in the hope that it will be useful, but WITHOUT
7
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
8
+ # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
9
+ #
10
+ # You should have received a copy of the GNU General Public License along with
11
+ # this program; if not, write to the Free Software Foundation, Inc.,
12
+ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
13
+ """Interfaces for PyLint objects"""
14
+
15
+ from logilab.common.interface import Interface
16
+
17
+
18
+ class IChecker(Interface):
19
+ """This is an base interface, not designed to be used elsewhere than for
20
+ sub interfaces definition.
21
+ """
22
+
23
+ def open(self):
24
+ """called before visiting project (i.e set of modules)"""
25
+
26
+ def close(self):
27
+ """called after visiting project (i.e set of modules)"""
28
+
29
+
30
+ class IRawChecker(IChecker):
31
+ """interface for checker which need to parse the raw file
32
+ """
33
+
34
+ def process_module(self, astroid):
35
+ """ process a module
36
+
37
+ the module's content is accessible via astroid.file_stream
38
+ """
39
+
40
+
41
+ class ITokenChecker(IChecker):
42
+ """Interface for checkers that need access to the token list."""
43
+ def process_tokens(self, tokens):
44
+ """Process a module.
45
+
46
+ tokens is a list of all source code tokens in the file.
47
+ """
48
+
49
+
50
+ class IAstroidChecker(IChecker):
51
+ """ interface for checker which prefers receive events according to
52
+ statement type
53
+ """
54
+
55
+
56
+ class IReporter(Interface):
57
+ """ reporter collect messages and display results encapsulated in a layout
58
+ """
59
+ def add_message(self, msg_id, location, msg):
60
+ """add a message of a given type
61
+
62
+ msg_id is a message identifier
63
+ location is a 3-uple (module, object, line)
64
+ msg is the actual message
65
+ """
66
+
67
+ def display_results(self, layout):
68
+ """display results encapsulated in the layout tree
69
+ """
70
+
71
+
72
+ __all__ = ('IRawChecker', 'IAstroidChecker', 'ITokenChecker', 'IReporter')
@@ -0,0 +1,1106 @@
1
+ # Copyright (c) 2003-2014 LOGILAB S.A. (Paris, FRANCE).
2
+ # http://www.logilab.fr/ -- mailto:contact@logilab.fr
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify it under
5
+ # the terms of the GNU General Public License as published by the Free Software
6
+ # Foundation; either version 2 of the License, or (at your option) any later
7
+ # version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful, but WITHOUT
10
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
12
+ #
13
+ # You should have received a copy of the GNU General Public License along with
14
+ # this program; if not, write to the Free Software Foundation, Inc.,
15
+ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16
+ """ %prog [options] module_or_package
17
+
18
+ Check that a module satisfies a coding standard (and more !).
19
+
20
+ %prog --help
21
+
22
+ Display this help message and exit.
23
+
24
+ %prog --help-msg <msg-id>[,<msg-id>]
25
+
26
+ Display help messages about given message identifiers and exit.
27
+ """
28
+
29
+ # import this first to avoid builtin namespace pollution
30
+ from pylint.checkers import utils
31
+
32
+ import functools
33
+ import sys
34
+ import os
35
+ import tokenize
36
+ from warnings import warn
37
+
38
+ from logilab.common.configuration import UnsupportedAction, OptionsManagerMixIn
39
+ from logilab.common.optik_ext import check_csv
40
+ from logilab.common.modutils import load_module_from_name, get_module_part
41
+ from logilab.common.interface import implements
42
+ from logilab.common.textutils import splitstrip, unquote
43
+ from logilab.common.ureports import Table, Text, Section
44
+ from logilab.common.__pkginfo__ import version as common_version
45
+
46
+ from astroid import MANAGER, nodes, AstroidBuildingException
47
+ from astroid.__pkginfo__ import version as astroid_version
48
+
49
+ from pylint.utils import (
50
+ MSG_TYPES, OPTION_RGX,
51
+ PyLintASTWalker, UnknownMessage, MessagesHandlerMixIn, ReportsHandlerMixIn,
52
+ EmptyReport, WarningScope,
53
+ expand_modules, tokenize_module)
54
+ from pylint.interfaces import IRawChecker, ITokenChecker, IAstroidChecker
55
+ from pylint.checkers import (BaseTokenChecker,
56
+ table_lines_from_stats,
57
+ initialize as checkers_initialize)
58
+ from pylint.reporters import initialize as reporters_initialize
59
+ from pylint import config
60
+
61
+ from pylint.__pkginfo__ import version
62
+
63
+
64
+
65
+ def _get_python_path(filepath):
66
+ dirname = os.path.dirname(os.path.realpath(
67
+ os.path.expanduser(filepath)))
68
+ while True:
69
+ if not os.path.exists(os.path.join(dirname, "__init__.py")):
70
+ return dirname
71
+ old_dirname = dirname
72
+ dirname = os.path.dirname(dirname)
73
+ if old_dirname == dirname:
74
+ return os.getcwd()
75
+
76
+
77
+ # Python Linter class #########################################################
78
+
79
+ MSGS = {
80
+ 'F0001': ('%s',
81
+ 'fatal',
82
+ 'Used when an error occurred preventing the analysis of a \
83
+ module (unable to find it for instance).'),
84
+ 'F0002': ('%s: %s',
85
+ 'astroid-error',
86
+ 'Used when an unexpected error occurred while building the '
87
+ 'Astroid representation. This is usually accompanied by a '
88
+ 'traceback. Please report such errors !'),
89
+ 'F0003': ('ignored builtin module %s',
90
+ 'ignored-builtin-module',
91
+ 'Used to indicate that the user asked to analyze a builtin '
92
+ 'module which has been skipped.'),
93
+ 'F0010': ('error while code parsing: %s',
94
+ 'parse-error',
95
+ 'Used when an exception occured while building the Astroid '
96
+ 'representation which could be handled by astroid.'),
97
+
98
+ 'I0001': ('Unable to run raw checkers on built-in module %s',
99
+ 'raw-checker-failed',
100
+ 'Used to inform that a built-in module has not been checked '
101
+ 'using the raw checkers.'),
102
+
103
+ 'I0010': ('Unable to consider inline option %r',
104
+ 'bad-inline-option',
105
+ 'Used when an inline option is either badly formatted or can\'t '
106
+ 'be used inside modules.'),
107
+
108
+ 'I0011': ('Locally disabling %s (%s)',
109
+ 'locally-disabled',
110
+ 'Used when an inline option disables a message or a messages '
111
+ 'category.'),
112
+ 'I0012': ('Locally enabling %s (%s)',
113
+ 'locally-enabled',
114
+ 'Used when an inline option enables a message or a messages '
115
+ 'category.'),
116
+ 'I0013': ('Ignoring entire file',
117
+ 'file-ignored',
118
+ 'Used to inform that the file will not be checked'),
119
+ 'I0020': ('Suppressed %s (from line %d)',
120
+ 'suppressed-message',
121
+ 'A message was triggered on a line, but suppressed explicitly '
122
+ 'by a disable= comment in the file. This message is not '
123
+ 'generated for messages that are ignored due to configuration '
124
+ 'settings.'),
125
+ 'I0021': ('Useless suppression of %s',
126
+ 'useless-suppression',
127
+ 'Reported when a message is explicitly disabled for a line or '
128
+ 'a block of code, but never triggered.'),
129
+ 'I0022': ('Pragma "%s" is deprecated, use "%s" instead',
130
+ 'deprecated-pragma',
131
+ 'Some inline pylint options have been renamed or reworked, '
132
+ 'only the most recent form should be used. '
133
+ 'NOTE:skip-all is only available with pylint >= 0.26',
134
+ {'old_names': [('I0014', 'deprecated-disable-all')]}),
135
+
136
+ 'E0001': ('%s',
137
+ 'syntax-error',
138
+ 'Used when a syntax error is raised for a module.'),
139
+
140
+ 'E0011': ('Unrecognized file option %r',
141
+ 'unrecognized-inline-option',
142
+ 'Used when an unknown inline option is encountered.'),
143
+ 'E0012': ('Bad option value %r',
144
+ 'bad-option-value',
145
+ 'Used when a bad value for an inline option is encountered.'),
146
+ }
147
+
148
+
149
+ def _deprecated_option(shortname, opt_type):
150
+ def _warn_deprecated(option, optname, *args):
151
+ sys.stderr.write('Warning: option %s is deprecated and ignored.\n' % (optname,))
152
+ return {'short': shortname, 'help': 'DEPRECATED', 'hide': True,
153
+ 'type': opt_type, 'action': 'callback', 'callback': _warn_deprecated}
154
+
155
+
156
+ class PyLinter(OptionsManagerMixIn, MessagesHandlerMixIn, ReportsHandlerMixIn,
157
+ BaseTokenChecker):
158
+ """lint Python modules using external checkers.
159
+
160
+ This is the main checker controlling the other ones and the reports
161
+ generation. It is itself both a raw checker and an astroid checker in order
162
+ to:
163
+ * handle message activation / deactivation at the module level
164
+ * handle some basic but necessary stats'data (number of classes, methods...)
165
+
166
+ IDE plugins developpers: you may have to call
167
+ `astroid.builder.MANAGER.astroid_cache.clear()` accross run if you want
168
+ to ensure the latest code version is actually checked.
169
+ """
170
+
171
+ __implements__ = (ITokenChecker,)
172
+
173
+ name = 'master'
174
+ priority = 0
175
+ level = 0
176
+ msgs = MSGS
177
+ may_be_disabled = False
178
+
179
+ @staticmethod
180
+ def make_options():
181
+ return (('ignore',
182
+ {'type' : 'csv', 'metavar' : '<file>[,<file>...]',
183
+ 'dest' : 'black_list', 'default' : ('CVS',),
184
+ 'help' : 'Add files or directories to the blacklist. '
185
+ 'They should be base names, not paths.'}),
186
+ ('persistent',
187
+ {'default': True, 'type' : 'yn', 'metavar' : '<y_or_n>',
188
+ 'level': 1,
189
+ 'help' : 'Pickle collected data for later comparisons.'}),
190
+
191
+ ('load-plugins',
192
+ {'type' : 'csv', 'metavar' : '<modules>', 'default' : (),
193
+ 'level': 1,
194
+ 'help' : 'List of plugins (as comma separated values of '
195
+ 'python modules names) to load, usually to register '
196
+ 'additional checkers.'}),
197
+
198
+ ('output-format',
199
+ {'default': 'text', 'type': 'string', 'metavar' : '<format>',
200
+ 'short': 'f',
201
+ 'group': 'Reports',
202
+ 'help' : 'Set the output format. Available formats are text,'
203
+ ' parseable, colorized, msvs (visual studio) and html. You '
204
+ 'can also give a reporter class, eg mypackage.mymodule.'
205
+ 'MyReporterClass.'}),
206
+
207
+ ('files-output',
208
+ {'default': 0, 'type' : 'yn', 'metavar' : '<y_or_n>',
209
+ 'group': 'Reports', 'level': 1,
210
+ 'help' : 'Put messages in a separate file for each module / '
211
+ 'package specified on the command line instead of printing '
212
+ 'them on stdout. Reports (if any) will be written in a file '
213
+ 'name "pylint_global.[txt|html]".'}),
214
+
215
+ ('reports',
216
+ {'default': 1, 'type' : 'yn', 'metavar' : '<y_or_n>',
217
+ 'short': 'r',
218
+ 'group': 'Reports',
219
+ 'help' : 'Tells whether to display a full report or only the '
220
+ 'messages'}),
221
+
222
+ ('evaluation',
223
+ {'type' : 'string', 'metavar' : '<python_expression>',
224
+ 'group': 'Reports', 'level': 1,
225
+ 'default': '10.0 - ((float(5 * error + warning + refactor + '
226
+ 'convention) / statement) * 10)',
227
+ 'help' : 'Python expression which should return a note less \
228
+ than 10 (10 is the highest note). You have access to the variables errors \
229
+ warning, statement which respectively contain the number of errors / warnings\
230
+ messages and the total number of statements analyzed. This is used by the \
231
+ global evaluation report (RP0004).'}),
232
+
233
+ ('comment',
234
+ {'default': 0, 'type' : 'yn', 'metavar' : '<y_or_n>',
235
+ 'group': 'Reports', 'level': 1,
236
+ 'help' : 'Add a comment according to your evaluation note. '
237
+ 'This is used by the global evaluation report (RP0004).'}),
238
+
239
+ ('enable',
240
+ {'type' : 'csv', 'metavar': '<msg ids>',
241
+ 'short': 'e',
242
+ 'group': 'Messages control',
243
+ 'help' : 'Enable the message, report, category or checker with the '
244
+ 'given id(s). You can either give multiple identifier '
245
+ 'separated by comma (,) or put this option multiple time. '
246
+ 'See also the "--disable" option for examples. '}),
247
+
248
+ ('disable',
249
+ {'type' : 'csv', 'metavar': '<msg ids>',
250
+ 'short': 'd',
251
+ 'group': 'Messages control',
252
+ 'help' : 'Disable the message, report, category or checker '
253
+ 'with the given id(s). You can either give multiple identifiers'
254
+ ' separated by comma (,) or put this option multiple times '
255
+ '(only on the command line, not in the configuration file '
256
+ 'where it should appear only once).'
257
+ 'You can also use "--disable=all" to disable everything first '
258
+ 'and then reenable specific checks. For example, if you want '
259
+ 'to run only the similarities checker, you can use '
260
+ '"--disable=all --enable=similarities". '
261
+ 'If you want to run only the classes checker, but have no '
262
+ 'Warning level messages displayed, use'
263
+ '"--disable=all --enable=classes --disable=W"'}),
264
+
265
+ ('msg-template',
266
+ {'type' : 'string', 'metavar': '<template>',
267
+ #'short': 't',
268
+ 'group': 'Reports',
269
+ 'help' : ('Template used to display messages. '
270
+ 'This is a python new-style format string '
271
+ 'used to format the message information. '
272
+ 'See doc for all details')
273
+ }),
274
+
275
+ ('include-ids', _deprecated_option('i', 'yn')),
276
+ ('symbols', _deprecated_option('s', 'yn')),
277
+ )
278
+
279
+ option_groups = (
280
+ ('Messages control', 'Options controling analysis messages'),
281
+ ('Reports', 'Options related to output formating and reporting'),
282
+ )
283
+
284
+ def __init__(self, options=(), reporter=None, option_groups=(),
285
+ pylintrc=None):
286
+ # some stuff has to be done before ancestors initialization...
287
+ #
288
+ # checkers / reporter / astroid manager
289
+ self.reporter = None
290
+ self._reporter_name = None
291
+ self._reporters = {}
292
+ self._checkers = {}
293
+ self._ignore_file = False
294
+ # visit variables
295
+ self.base_name = None
296
+ self.base_file = None
297
+ self.current_name = None
298
+ self.current_file = None
299
+ self.stats = None
300
+ # init options
301
+ self.options = options + PyLinter.make_options()
302
+ self.option_groups = option_groups + PyLinter.option_groups
303
+ self._options_methods = {
304
+ 'enable': self.enable,
305
+ 'disable': self.disable}
306
+ self._bw_options_methods = {'disable-msg': self.disable,
307
+ 'enable-msg': self.enable}
308
+ full_version = '%%prog %s, \nastroid %s, common %s\nPython %s' % (
309
+ version, astroid_version, common_version, sys.version)
310
+ OptionsManagerMixIn.__init__(self, usage=__doc__,
311
+ version=full_version,
312
+ config_file=pylintrc or config.PYLINTRC)
313
+ MessagesHandlerMixIn.__init__(self)
314
+ ReportsHandlerMixIn.__init__(self)
315
+ BaseTokenChecker.__init__(self)
316
+ # provided reports
317
+ self.reports = (('RP0001', 'Messages by category',
318
+ report_total_messages_stats),
319
+ ('RP0002', '% errors / warnings by module',
320
+ report_messages_by_module_stats),
321
+ ('RP0003', 'Messages',
322
+ report_messages_stats),
323
+ ('RP0004', 'Global evaluation',
324
+ self.report_evaluation),
325
+ )
326
+ self.register_checker(self)
327
+ self._dynamic_plugins = set()
328
+ self.load_provider_defaults()
329
+ if reporter:
330
+ self.set_reporter(reporter)
331
+
332
+ def load_default_plugins(self):
333
+ checkers_initialize(self)
334
+ reporters_initialize(self)
335
+ # Make sure to load the default reporter, because
336
+ # the option has been set before the plugins had been loaded.
337
+ if not self.reporter:
338
+ self._load_reporter()
339
+
340
+ def prepare_import_path(self, args):
341
+ """Prepare sys.path for running the linter checks."""
342
+ if len(args) == 1:
343
+ sys.path.insert(0, _get_python_path(args[0]))
344
+ else:
345
+ sys.path.insert(0, os.getcwd())
346
+
347
+ def cleanup_import_path(self):
348
+ """Revert any changes made to sys.path in prepare_import_path."""
349
+ sys.path.pop(0)
350
+
351
+ def load_plugin_modules(self, modnames):
352
+ """take a list of module names which are pylint plugins and load
353
+ and register them
354
+ """
355
+ for modname in modnames:
356
+ if modname in self._dynamic_plugins:
357
+ continue
358
+ self._dynamic_plugins.add(modname)
359
+ module = load_module_from_name(modname)
360
+ module.register(self)
361
+
362
+ def _load_reporter(self):
363
+ name = self._reporter_name.lower()
364
+ if name in self._reporters:
365
+ self.set_reporter(self._reporters[name]())
366
+ else:
367
+ qname = self._reporter_name
368
+ module = load_module_from_name(get_module_part(qname))
369
+ class_name = qname.split('.')[-1]
370
+ reporter_class = getattr(module, class_name)
371
+ self.set_reporter(reporter_class())
372
+
373
+ def set_reporter(self, reporter):
374
+ """set the reporter used to display messages and reports"""
375
+ self.reporter = reporter
376
+ reporter.linter = self
377
+
378
+ def set_option(self, optname, value, action=None, optdict=None):
379
+ """overridden from configuration.OptionsProviderMixin to handle some
380
+ special options
381
+ """
382
+ if optname in self._options_methods or \
383
+ optname in self._bw_options_methods:
384
+ if value:
385
+ try:
386
+ meth = self._options_methods[optname]
387
+ except KeyError:
388
+ meth = self._bw_options_methods[optname]
389
+ warn('%s is deprecated, replace it by %s' % (
390
+ optname, optname.split('-')[0]), DeprecationWarning)
391
+ value = check_csv(None, optname, value)
392
+ if isinstance(value, (list, tuple)):
393
+ for _id in value:
394
+ meth(_id, ignore_unknown=True)
395
+ else:
396
+ meth(value)
397
+ elif optname == 'output-format':
398
+ self._reporter_name = value
399
+ # If the reporters are already available, load
400
+ # the reporter class.
401
+ if self._reporters:
402
+ self._load_reporter()
403
+ try:
404
+ BaseTokenChecker.set_option(self, optname, value, action, optdict)
405
+ except UnsupportedAction:
406
+ print >> sys.stderr, 'option %s can\'t be read from config file' % \
407
+ optname
408
+
409
+ def register_reporter(self, reporter_class):
410
+ self._reporters[reporter_class.name] = reporter_class
411
+
412
+ # checkers manipulation methods ############################################
413
+
414
+ def register_checker(self, checker):
415
+ """register a new checker
416
+
417
+ checker is an object implementing IRawChecker or / and IAstroidChecker
418
+ """
419
+ assert checker.priority <= 0, 'checker priority can\'t be >= 0'
420
+ self._checkers.setdefault(checker.name, []).append(checker)
421
+ for r_id, r_title, r_cb in checker.reports:
422
+ self.register_report(r_id, r_title, r_cb, checker)
423
+ self.register_options_provider(checker)
424
+ if hasattr(checker, 'msgs'):
425
+ self.register_messages(checker)
426
+ checker.load_defaults()
427
+
428
+ def disable_noerror_messages(self):
429
+ for msgcat, msgids in self._msgs_by_category.iteritems():
430
+ if msgcat == 'E':
431
+ for msgid in msgids:
432
+ self.enable(msgid)
433
+ else:
434
+ for msgid in msgids:
435
+ self.disable(msgid)
436
+
437
+ def disable_reporters(self):
438
+ """disable all reporters"""
439
+ for reporters in self._reports.itervalues():
440
+ for report_id, _title, _cb in reporters:
441
+ self.disable_report(report_id)
442
+
443
+ def error_mode(self):
444
+ """error mode: enable only errors; no reports, no persistent"""
445
+ self.disable_noerror_messages()
446
+ self.disable('miscellaneous')
447
+ self.set_option('reports', False)
448
+ self.set_option('persistent', False)
449
+
450
+ # block level option handling #############################################
451
+ #
452
+ # see func_block_disable_msg.py test case for expected behaviour
453
+
454
+ def process_tokens(self, tokens):
455
+ """process tokens from the current module to search for module/block
456
+ level options
457
+ """
458
+ for (tok_type, content, start, _, _) in tokens:
459
+ if tok_type != tokenize.COMMENT:
460
+ continue
461
+ match = OPTION_RGX.search(content)
462
+ if match is None:
463
+ continue
464
+ if match.group(1).strip() == "disable-all" or \
465
+ match.group(1).strip() == 'skip-file':
466
+ if match.group(1).strip() == "disable-all":
467
+ self.add_message('deprecated-pragma', line=start[0],
468
+ args=('disable-all', 'skip-file'))
469
+ self.add_message('file-ignored', line=start[0])
470
+ self._ignore_file = True
471
+ return
472
+ try:
473
+ opt, value = match.group(1).split('=', 1)
474
+ except ValueError:
475
+ self.add_message('bad-inline-option', args=match.group(1).strip(),
476
+ line=start[0])
477
+ continue
478
+ opt = opt.strip()
479
+ if opt in self._options_methods or opt in self._bw_options_methods:
480
+ try:
481
+ meth = self._options_methods[opt]
482
+ except KeyError:
483
+ meth = self._bw_options_methods[opt]
484
+ # found a "(dis|en)able-msg" pragma deprecated suppresssion
485
+ self.add_message('deprecated-pragma', line=start[0], args=(opt, opt.replace('-msg', '')))
486
+ for msgid in splitstrip(value):
487
+ try:
488
+ if (opt, msgid) == ('disable', 'all'):
489
+ self.add_message('deprecated-pragma', line=start[0], args=('disable=all', 'skip-file'))
490
+ self.add_message('file-ignored', line=start[0])
491
+ self._ignore_file = True
492
+ return
493
+ meth(msgid, 'module', start[0])
494
+ except UnknownMessage:
495
+ self.add_message('bad-option-value', args=msgid, line=start[0])
496
+ else:
497
+ self.add_message('unrecognized-inline-option', args=opt, line=start[0])
498
+
499
+ def collect_block_lines(self, node, msg_state):
500
+ """walk ast to collect block level options line numbers"""
501
+ # recurse on children (depth first)
502
+ for child in node.get_children():
503
+ self.collect_block_lines(child, msg_state)
504
+ first = node.fromlineno
505
+ last = node.tolineno
506
+ # first child line number used to distinguish between disable
507
+ # which are the first child of scoped node with those defined later.
508
+ # For instance in the code below:
509
+ #
510
+ # 1. def meth8(self):
511
+ # 2. """test late disabling"""
512
+ # 3. # pylint: disable=E1102
513
+ # 4. print self.blip
514
+ # 5. # pylint: disable=E1101
515
+ # 6. print self.bla
516
+ #
517
+ # E1102 should be disabled from line 1 to 6 while E1101 from line 5 to 6
518
+ #
519
+ # this is necessary to disable locally messages applying to class /
520
+ # function using their fromlineno
521
+ if isinstance(node, (nodes.Module, nodes.Class, nodes.Function)) and node.body:
522
+ firstchildlineno = node.body[0].fromlineno
523
+ else:
524
+ firstchildlineno = last
525
+ for msgid, lines in msg_state.iteritems():
526
+ for lineno, state in lines.items():
527
+ original_lineno = lineno
528
+ if first <= lineno <= last:
529
+ # Set state for all lines for this block, if the
530
+ # warning is applied to nodes.
531
+ if self.check_message_id(msgid).scope == WarningScope.NODE:
532
+ if lineno > firstchildlineno:
533
+ state = True
534
+ first_, last_ = node.block_range(lineno)
535
+ else:
536
+ first_ = lineno
537
+ last_ = last
538
+ for line in xrange(first_, last_+1):
539
+ # do not override existing entries
540
+ if not line in self._module_msgs_state.get(msgid, ()):
541
+ if line in lines: # state change in the same block
542
+ state = lines[line]
543
+ original_lineno = line
544
+ if not state:
545
+ self._suppression_mapping[(msgid, line)] = original_lineno
546
+ try:
547
+ self._module_msgs_state[msgid][line] = state
548
+ except KeyError:
549
+ self._module_msgs_state[msgid] = {line: state}
550
+ del lines[lineno]
551
+
552
+
553
+ # code checking methods ###################################################
554
+
555
+ def get_checkers(self):
556
+ """return all available checkers as a list"""
557
+ return [self] + [c for checkers in self._checkers.itervalues()
558
+ for c in checkers if c is not self]
559
+
560
+ def prepare_checkers(self):
561
+ """return checkers needed for activated messages and reports"""
562
+ if not self.config.reports:
563
+ self.disable_reporters()
564
+ # get needed checkers
565
+ neededcheckers = [self]
566
+ for checker in self.get_checkers()[1:]:
567
+ # fatal errors should not trigger enable / disabling a checker
568
+ messages = set(msg for msg in checker.msgs
569
+ if msg[0] != 'F' and self.is_message_enabled(msg))
570
+ if (messages or
571
+ any(self.report_is_enabled(r[0]) for r in checker.reports)):
572
+ neededcheckers.append(checker)
573
+ return neededcheckers
574
+
575
+ def should_analyze_file(self, modname, path): # pylint: disable=unused-argument
576
+ """Returns whether or not a module should be checked.
577
+
578
+ This implementation returns True for all python source file, indicating
579
+ that all files should be linted.
580
+
581
+ Subclasses may override this method to indicate that modules satisfying
582
+ certain conditions should not be linted.
583
+
584
+ :param str modname: The name of the module to be checked.
585
+ :param str path: The full path to the source code of the module.
586
+ :returns: True if the module should be checked.
587
+ :rtype: bool
588
+ """
589
+ return path.endswith('.py')
590
+
591
+ def check(self, files_or_modules):
592
+ """main checking entry: check a list of files or modules from their
593
+ name.
594
+ """
595
+ if not isinstance(files_or_modules, (list, tuple)):
596
+ files_or_modules = (files_or_modules,)
597
+ walker = PyLintASTWalker(self)
598
+ checkers = self.prepare_checkers()
599
+ tokencheckers = [c for c in checkers if implements(c, ITokenChecker)
600
+ and c is not self]
601
+ rawcheckers = [c for c in checkers if implements(c, IRawChecker)]
602
+ # notify global begin
603
+ for checker in checkers:
604
+ checker.open()
605
+ if implements(checker, IAstroidChecker):
606
+ walker.add_checker(checker)
607
+ # build ast and check modules or packages
608
+ for descr in self.expand_files(files_or_modules):
609
+ modname, filepath = descr['name'], descr['path']
610
+ if not descr['isarg'] and not self.should_analyze_file(modname, filepath):
611
+ continue
612
+ if self.config.files_output:
613
+ reportfile = 'pylint_%s.%s' % (modname, self.reporter.extension)
614
+ self.reporter.set_output(open(reportfile, 'w'))
615
+ self.set_current_module(modname, filepath)
616
+ # get the module representation
617
+ astroid = self.get_ast(filepath, modname)
618
+ if astroid is None:
619
+ continue
620
+ self.base_name = descr['basename']
621
+ self.base_file = descr['basepath']
622
+ self._ignore_file = False
623
+ # fix the current file (if the source file was not available or
624
+ # if it's actually a c extension)
625
+ self.current_file = astroid.file # pylint: disable=maybe-no-member
626
+ self.check_astroid_module(astroid, walker, rawcheckers, tokencheckers)
627
+ self._add_suppression_messages()
628
+ # notify global end
629
+ self.set_current_module('')
630
+ self.stats['statement'] = walker.nbstatements
631
+ checkers.reverse()
632
+ for checker in checkers:
633
+ checker.close()
634
+
635
+ def expand_files(self, modules):
636
+ """get modules and errors from a list of modules and handle errors
637
+ """
638
+ result, errors = expand_modules(modules, self.config.black_list)
639
+ for error in errors:
640
+ message = modname = error["mod"]
641
+ key = error["key"]
642
+ self.set_current_module(modname)
643
+ if key == "fatal":
644
+ message = str(error["ex"]).replace(os.getcwd() + os.sep, '')
645
+ self.add_message(key, args=message)
646
+ return result
647
+
648
+ def set_current_module(self, modname, filepath=None):
649
+ """set the name of the currently analyzed module and
650
+ init statistics for it
651
+ """
652
+ if not modname and filepath is None:
653
+ return
654
+ self.reporter.on_set_current_module(modname, filepath)
655
+ self.current_name = modname
656
+ self.current_file = filepath or modname
657
+ self.stats['by_module'][modname] = {}
658
+ self.stats['by_module'][modname]['statement'] = 0
659
+ for msg_cat in MSG_TYPES.itervalues():
660
+ self.stats['by_module'][modname][msg_cat] = 0
661
+ # XXX hack, to be correct we need to keep module_msgs_state
662
+ # for every analyzed module (the problem stands with localized
663
+ # messages which are only detected in the .close step)
664
+ if modname:
665
+ self._module_msgs_state = {}
666
+ self._raw_module_msgs_state = {}
667
+ self._ignored_msgs = {}
668
+
669
+ def get_ast(self, filepath, modname):
670
+ """return a ast(roid) representation for a module"""
671
+ try:
672
+ return MANAGER.ast_from_file(filepath, modname, source=True)
673
+ except SyntaxError, ex:
674
+ self.add_message('syntax-error', line=ex.lineno, args=ex.msg)
675
+ except AstroidBuildingException, ex:
676
+ self.add_message('parse-error', args=ex)
677
+ except Exception, ex:
678
+ import traceback
679
+ traceback.print_exc()
680
+ self.add_message('astroid-error', args=(ex.__class__, ex))
681
+
682
+ def check_astroid_module(self, astroid, walker, rawcheckers, tokencheckers):
683
+ """check a module from its astroid representation, real work"""
684
+ # call raw checkers if possible
685
+ try:
686
+ tokens = tokenize_module(astroid)
687
+ except tokenize.TokenError, ex:
688
+ self.add_message('syntax-error', line=ex.args[1][0], args=ex.args[0])
689
+ return
690
+
691
+ if not astroid.pure_python:
692
+ self.add_message('raw-checker-failed', args=astroid.name)
693
+ else:
694
+ #assert astroid.file.endswith('.py')
695
+ # invoke ITokenChecker interface on self to fetch module/block
696
+ # level options
697
+ self.process_tokens(tokens)
698
+ if self._ignore_file:
699
+ return False
700
+ # walk ast to collect line numbers
701
+ for msg, lines in self._module_msgs_state.iteritems():
702
+ self._raw_module_msgs_state[msg] = lines.copy()
703
+ orig_state = self._module_msgs_state.copy()
704
+ self._module_msgs_state = {}
705
+ self._suppression_mapping = {}
706
+ self.collect_block_lines(astroid, orig_state)
707
+ for checker in rawcheckers:
708
+ checker.process_module(astroid)
709
+ for checker in tokencheckers:
710
+ checker.process_tokens(tokens)
711
+ # generate events to astroid checkers
712
+ walker.walk(astroid)
713
+ return True
714
+
715
+ # IAstroidChecker interface #################################################
716
+
717
+ def open(self):
718
+ """initialize counters"""
719
+ self.stats = {'by_module' : {},
720
+ 'by_msg' : {},
721
+ }
722
+ for msg_cat in MSG_TYPES.itervalues():
723
+ self.stats[msg_cat] = 0
724
+
725
+ def close(self):
726
+ """close the whole package /module, it's time to make reports !
727
+
728
+ if persistent run, pickle results for later comparison
729
+ """
730
+ if self.base_name is not None:
731
+ # load previous results if any
732
+ previous_stats = config.load_results(self.base_name)
733
+ # XXX code below needs refactoring to be more reporter agnostic
734
+ self.reporter.on_close(self.stats, previous_stats)
735
+ if self.config.reports:
736
+ sect = self.make_reports(self.stats, previous_stats)
737
+ if self.config.files_output:
738
+ filename = 'pylint_global.' + self.reporter.extension
739
+ self.reporter.set_output(open(filename, 'w'))
740
+ else:
741
+ sect = Section()
742
+ if self.config.reports or self.config.output_format == 'html':
743
+ self.reporter.display_results(sect)
744
+ # save results if persistent run
745
+ if self.config.persistent:
746
+ config.save_results(self.stats, self.base_name)
747
+ else:
748
+ self.reporter.on_close(self.stats, {})
749
+
750
+ # specific reports ########################################################
751
+
752
+ def _add_suppression_messages(self):
753
+ for warning, lines in self._raw_module_msgs_state.iteritems():
754
+ for line, enable in lines.iteritems():
755
+ if not enable and (warning, line) not in self._ignored_msgs:
756
+ self.add_message('useless-suppression', line, None,
757
+ (self.get_msg_display_string(warning),))
758
+ # don't use iteritems here, _ignored_msgs may be modified by add_message
759
+ for (warning, from_), lines in self._ignored_msgs.items():
760
+ for line in lines:
761
+ self.add_message('suppressed-message', line, None,
762
+ (self.get_msg_display_string(warning), from_))
763
+
764
+ def report_evaluation(self, sect, stats, previous_stats):
765
+ """make the global evaluation report"""
766
+ # check with at least check 1 statements (usually 0 when there is a
767
+ # syntax error preventing pylint from further processing)
768
+ if stats['statement'] == 0:
769
+ raise EmptyReport()
770
+ # get a global note for the code
771
+ evaluation = self.config.evaluation
772
+ try:
773
+ note = eval(evaluation, {}, self.stats)
774
+ except Exception, ex:
775
+ msg = 'An exception occurred while rating: %s' % ex
776
+ else:
777
+ stats['global_note'] = note
778
+ msg = 'Your code has been rated at %.2f/10' % note
779
+ pnote = previous_stats.get('global_note')
780
+ if pnote is not None:
781
+ msg += ' (previous run: %.2f/10, %+.2f)' % (pnote, note - pnote)
782
+ if self.config.comment:
783
+ msg = '%s\n%s' % (msg, config.get_note_message(note))
784
+ sect.append(Text(msg))
785
+
786
+ # some reporting functions ####################################################
787
+
788
+ def report_total_messages_stats(sect, stats, previous_stats):
789
+ """make total errors / warnings report"""
790
+ lines = ['type', 'number', 'previous', 'difference']
791
+ lines += table_lines_from_stats(stats, previous_stats,
792
+ ('convention', 'refactor',
793
+ 'warning', 'error'))
794
+ sect.append(Table(children=lines, cols=4, rheaders=1))
795
+
796
+ def report_messages_stats(sect, stats, _):
797
+ """make messages type report"""
798
+ if not stats['by_msg']:
799
+ # don't print this report when we didn't detected any errors
800
+ raise EmptyReport()
801
+ in_order = sorted([(value, msg_id)
802
+ for msg_id, value in stats['by_msg'].iteritems()
803
+ if not msg_id.startswith('I')])
804
+ in_order.reverse()
805
+ lines = ('message id', 'occurrences')
806
+ for value, msg_id in in_order:
807
+ lines += (msg_id, str(value))
808
+ sect.append(Table(children=lines, cols=2, rheaders=1))
809
+
810
+ def report_messages_by_module_stats(sect, stats, _):
811
+ """make errors / warnings by modules report"""
812
+ if len(stats['by_module']) == 1:
813
+ # don't print this report when we are analysing a single module
814
+ raise EmptyReport()
815
+ by_mod = {}
816
+ for m_type in ('fatal', 'error', 'warning', 'refactor', 'convention'):
817
+ total = stats[m_type]
818
+ for module in stats['by_module'].iterkeys():
819
+ mod_total = stats['by_module'][module][m_type]
820
+ if total == 0:
821
+ percent = 0
822
+ else:
823
+ percent = float((mod_total)*100) / total
824
+ by_mod.setdefault(module, {})[m_type] = percent
825
+ sorted_result = []
826
+ for module, mod_info in by_mod.iteritems():
827
+ sorted_result.append((mod_info['error'],
828
+ mod_info['warning'],
829
+ mod_info['refactor'],
830
+ mod_info['convention'],
831
+ module))
832
+ sorted_result.sort()
833
+ sorted_result.reverse()
834
+ lines = ['module', 'error', 'warning', 'refactor', 'convention']
835
+ for line in sorted_result:
836
+ if line[0] == 0 and line[1] == 0:
837
+ break
838
+ lines.append(line[-1])
839
+ for val in line[:-1]:
840
+ lines.append('%.2f' % val)
841
+ if len(lines) == 5:
842
+ raise EmptyReport()
843
+ sect.append(Table(children=lines, cols=5, rheaders=1))
844
+
845
+
846
+ # utilities ###################################################################
847
+
848
+ # this may help to import modules using gettext
849
+ # XXX syt, actually needed since we don't import code?
850
+
851
+ from logilab.common.compat import builtins
852
+ builtins._ = str
853
+
854
+
855
+ class ArgumentPreprocessingError(Exception):
856
+ """Raised if an error occurs during argument preprocessing."""
857
+
858
+
859
+ def preprocess_options(args, search_for):
860
+ """look for some options (keys of <search_for>) which have to be processed
861
+ before others
862
+
863
+ values of <search_for> are callback functions to call when the option is
864
+ found
865
+ """
866
+ i = 0
867
+ while i < len(args):
868
+ arg = args[i]
869
+ if arg.startswith('--'):
870
+ try:
871
+ option, val = arg[2:].split('=', 1)
872
+ except ValueError:
873
+ option, val = arg[2:], None
874
+ try:
875
+ cb, takearg = search_for[option]
876
+ except KeyError:
877
+ i += 1
878
+ else:
879
+ del args[i]
880
+ if takearg and val is None:
881
+ if i >= len(args) or args[i].startswith('-'):
882
+ msg = 'Option %s expects a value' % option
883
+ raise ArgumentPreprocessingError(msg)
884
+ val = args[i]
885
+ del args[i]
886
+ elif not takearg and val is not None:
887
+ msg = "Option %s doesn't expects a value" % option
888
+ raise ArgumentPreprocessingError(msg)
889
+ cb(option, val)
890
+ else:
891
+ i += 1
892
+
893
+ class Run(object):
894
+ """helper class to use as main for pylint :
895
+
896
+ run(*sys.argv[1:])
897
+ """
898
+ LinterClass = PyLinter
899
+ option_groups = (
900
+ ('Commands', 'Options which are actually commands. Options in this \
901
+ group are mutually exclusive.'),
902
+ )
903
+
904
+ def __init__(self, args, reporter=None, exit=True):
905
+ self._rcfile = None
906
+ self._plugins = []
907
+ try:
908
+ preprocess_options(args, {
909
+ # option: (callback, takearg)
910
+ 'init-hook': (cb_init_hook, True),
911
+ 'rcfile': (self.cb_set_rcfile, True),
912
+ 'load-plugins': (self.cb_add_plugins, True),
913
+ })
914
+ except ArgumentPreprocessingError, ex:
915
+ print >> sys.stderr, ex
916
+ sys.exit(32)
917
+
918
+ self.linter = linter = self.LinterClass((
919
+ ('rcfile',
920
+ {'action' : 'callback', 'callback' : lambda *args: 1,
921
+ 'type': 'string', 'metavar': '<file>',
922
+ 'help' : 'Specify a configuration file.'}),
923
+
924
+ ('init-hook',
925
+ {'action' : 'callback', 'callback' : lambda *args: 1,
926
+ 'type' : 'string', 'metavar': '<code>',
927
+ 'level': 1,
928
+ 'help' : 'Python code to execute, usually for sys.path \
929
+ manipulation such as pygtk.require().'}),
930
+
931
+ ('help-msg',
932
+ {'action' : 'callback', 'type' : 'string', 'metavar': '<msg-id>',
933
+ 'callback' : self.cb_help_message,
934
+ 'group': 'Commands',
935
+ 'help' : '''Display a help message for the given message id and \
936
+ exit. The value may be a comma separated list of message ids.'''}),
937
+
938
+ ('list-msgs',
939
+ {'action' : 'callback', 'metavar': '<msg-id>',
940
+ 'callback' : self.cb_list_messages,
941
+ 'group': 'Commands', 'level': 1,
942
+ 'help' : "Generate pylint's messages."}),
943
+
944
+ ('full-documentation',
945
+ {'action' : 'callback', 'metavar': '<msg-id>',
946
+ 'callback' : self.cb_full_documentation,
947
+ 'group': 'Commands', 'level': 1,
948
+ 'help' : "Generate pylint's full documentation."}),
949
+
950
+ ('generate-rcfile',
951
+ {'action' : 'callback', 'callback' : self.cb_generate_config,
952
+ 'group': 'Commands',
953
+ 'help' : '''Generate a sample configuration file according to \
954
+ the current configuration. You can put other options before this one to get \
955
+ them in the generated configuration.'''}),
956
+
957
+ ('generate-man',
958
+ {'action' : 'callback', 'callback' : self.cb_generate_manpage,
959
+ 'group': 'Commands',
960
+ 'help' : "Generate pylint's man page.", 'hide': True}),
961
+
962
+ ('errors-only',
963
+ {'action' : 'callback', 'callback' : self.cb_error_mode,
964
+ 'short': 'E',
965
+ 'help' : '''In error mode, checkers without error messages are \
966
+ disabled and for others, only the ERROR messages are displayed, and no reports \
967
+ are done by default'''}),
968
+
969
+ ('profile',
970
+ {'type' : 'yn', 'metavar' : '<y_or_n>',
971
+ 'default': False, 'hide': True,
972
+ 'help' : 'Profiled execution.'}),
973
+
974
+ ), option_groups=self.option_groups, pylintrc=self._rcfile)
975
+ # register standard checkers
976
+ linter.load_default_plugins()
977
+ # load command line plugins
978
+ linter.load_plugin_modules(self._plugins)
979
+ # add some help section
980
+ linter.add_help_section('Environment variables', config.ENV_HELP, level=1)
981
+ linter.add_help_section('Output',
982
+ 'Using the default text output, the message format is : \n'
983
+ ' \n'
984
+ ' MESSAGE_TYPE: LINE_NUM:[OBJECT:] MESSAGE \n'
985
+ ' \n'
986
+ 'There are 5 kind of message types : \n'
987
+ ' * (C) convention, for programming standard violation \n'
988
+ ' * (R) refactor, for bad code smell \n'
989
+ ' * (W) warning, for python specific problems \n'
990
+ ' * (E) error, for probable bugs in the code \n'
991
+ ' * (F) fatal, if an error occurred which prevented pylint from doing further\n'
992
+ 'processing.\n'
993
+ , level=1)
994
+ linter.add_help_section('Output status code',
995
+ 'Pylint should leave with following status code: \n'
996
+ ' * 0 if everything went fine \n'
997
+ ' * 1 if a fatal message was issued \n'
998
+ ' * 2 if an error message was issued \n'
999
+ ' * 4 if a warning message was issued \n'
1000
+ ' * 8 if a refactor message was issued \n'
1001
+ ' * 16 if a convention message was issued \n'
1002
+ ' * 32 on usage error \n'
1003
+ ' \n'
1004
+ 'status 1 to 16 will be bit-ORed so you can know which different categories has\n'
1005
+ 'been issued by analysing pylint output status code\n',
1006
+ level=1)
1007
+ # read configuration
1008
+ linter.disable('pointless-except')
1009
+ linter.disable('suppressed-message')
1010
+ linter.disable('useless-suppression')
1011
+ linter.read_config_file()
1012
+ config_parser = linter.cfgfile_parser
1013
+ # run init hook, if present, before loading plugins
1014
+ if config_parser.has_option('MASTER', 'init-hook'):
1015
+ cb_init_hook('init-hook',
1016
+ unquote(config_parser.get('MASTER', 'init-hook')))
1017
+ # is there some additional plugins in the file configuration, in
1018
+ if config_parser.has_option('MASTER', 'load-plugins'):
1019
+ plugins = splitstrip(config_parser.get('MASTER', 'load-plugins'))
1020
+ linter.load_plugin_modules(plugins)
1021
+ # now we can load file config and command line, plugins (which can
1022
+ # provide options) have been registered
1023
+ linter.load_config_file()
1024
+ if reporter:
1025
+ # if a custom reporter is provided as argument, it may be overridden
1026
+ # by file parameters, so re-set it here, but before command line
1027
+ # parsing so it's still overrideable by command line option
1028
+ linter.set_reporter(reporter)
1029
+ try:
1030
+ args = linter.load_command_line_configuration(args)
1031
+ except SystemExit, exc:
1032
+ if exc.code == 2: # bad options
1033
+ exc.code = 32
1034
+ raise
1035
+ if not args:
1036
+ print linter.help()
1037
+ sys.exit(32)
1038
+ # insert current working directory to the python path to have a correct
1039
+ # behaviour
1040
+ linter.prepare_import_path(args)
1041
+ if self.linter.config.profile:
1042
+ print >> sys.stderr, '** profiled run'
1043
+ import cProfile, pstats
1044
+ cProfile.runctx('linter.check(%r)' % args, globals(), locals(),
1045
+ 'stones.prof')
1046
+ data = pstats.Stats('stones.prof')
1047
+ data.strip_dirs()
1048
+ data.sort_stats('time', 'calls')
1049
+ data.print_stats(30)
1050
+ else:
1051
+ linter.check(args)
1052
+ linter.cleanup_import_path()
1053
+ if exit:
1054
+ sys.exit(self.linter.msg_status)
1055
+
1056
+ def cb_set_rcfile(self, name, value):
1057
+ """callback for option preprocessing (i.e. before option parsing)"""
1058
+ self._rcfile = value
1059
+
1060
+ def cb_add_plugins(self, name, value):
1061
+ """callback for option preprocessing (i.e. before option parsing)"""
1062
+ self._plugins.extend(splitstrip(value))
1063
+
1064
+ def cb_error_mode(self, *args, **kwargs):
1065
+ """error mode:
1066
+ * disable all but error messages
1067
+ * disable the 'miscellaneous' checker which can be safely deactivated in
1068
+ debug
1069
+ * disable reports
1070
+ * do not save execution information
1071
+ """
1072
+ self.linter.error_mode()
1073
+
1074
+ def cb_generate_config(self, *args, **kwargs):
1075
+ """optik callback for sample config file generation"""
1076
+ self.linter.generate_config(skipsections=('COMMANDS',))
1077
+ sys.exit(0)
1078
+
1079
+ def cb_generate_manpage(self, *args, **kwargs):
1080
+ """optik callback for sample config file generation"""
1081
+ from pylint import __pkginfo__
1082
+ self.linter.generate_manpage(__pkginfo__)
1083
+ sys.exit(0)
1084
+
1085
+ def cb_help_message(self, option, optname, value, parser):
1086
+ """optik callback for printing some help about a particular message"""
1087
+ self.linter.help_message(splitstrip(value))
1088
+ sys.exit(0)
1089
+
1090
+ def cb_full_documentation(self, option, optname, value, parser):
1091
+ """optik callback for printing full documentation"""
1092
+ self.linter.print_full_documentation()
1093
+ sys.exit(0)
1094
+
1095
+ def cb_list_messages(self, option, optname, value, parser): # FIXME
1096
+ """optik callback for printing available messages"""
1097
+ self.linter.list_messages()
1098
+ sys.exit(0)
1099
+
1100
+ def cb_init_hook(optname, value):
1101
+ """exec arbitrary code to set sys.path for instance"""
1102
+ exec value
1103
+
1104
+
1105
+ if __name__ == '__main__':
1106
+ Run(sys.argv[1:])