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.
- checksums.yaml +7 -0
- data/exercism-analysis.gemspec +30 -0
- data/lib/exercism-analysis.rb +38 -0
- data/lib/exercism-analysis/adapters/adapter.rb +23 -0
- data/lib/exercism-analysis/adapters/clojure.rb +13 -0
- data/lib/exercism-analysis/adapters/go.rb +19 -0
- data/lib/exercism-analysis/adapters/javascript.rb +13 -0
- data/lib/exercism-analysis/adapters/python.rb +13 -0
- data/lib/exercism-analysis/adapters/ruby.rb +19 -0
- data/lib/exercism-analysis/analysis.rb +18 -0
- data/lib/exercism-analysis/analyzers/analyzer.rb +54 -0
- data/lib/exercism-analysis/analyzers/clojure/kibit.rb +25 -0
- data/lib/exercism-analysis/analyzers/go/golint.rb +23 -0
- data/lib/exercism-analysis/analyzers/javascript/jslint.rb +24 -0
- data/lib/exercism-analysis/analyzers/python/pylint.rb +24 -0
- data/lib/exercism-analysis/analyzers/ruby/control_flow.rb +21 -0
- data/lib/exercism-analysis/analyzers/ruby/enumerable_condition.rb +21 -0
- data/lib/exercism-analysis/analyzers/ruby/for_loop.rb +29 -0
- data/lib/exercism-analysis/analyzers/ruby/indentation.rb +21 -0
- data/lib/exercism-analysis/analyzers/ruby/iter_mutation.rb +37 -0
- data/lib/exercism-analysis/analyzers/ruby/output.rb +20 -0
- data/lib/exercism-analysis/analyzers/ruby/range.rb +28 -0
- data/lib/exercism-analysis/analyzers/ruby/roodi.rb +19 -0
- data/lib/exercism-analysis/analyzers/ruby/send.rb +25 -0
- data/lib/exercism-analysis/analyzers/ruby/shebang.rb +23 -0
- data/lib/exercism-analysis/analyzers/ruby/tab.rb +38 -0
- data/lib/exercism-analysis/processors/call_processor.rb +39 -0
- data/lib/exercism-analysis/processors/control_flow_processor.rb +27 -0
- data/lib/exercism-analysis/processors/enumerable_condition_processor.rb +31 -0
- data/lib/exercism-analysis/processors/for_loop_processor.rb +21 -0
- data/lib/exercism-analysis/processors/indentation_processor.rb +69 -0
- data/lib/exercism-analysis/processors/iter_mutation_processor.rb +50 -0
- data/lib/exercism-analysis/processors/processor.rb +34 -0
- data/lib/exercism-analysis/processors/range_processor.rb +23 -0
- data/lib/exercism-analysis/processors/send_processor.rb +23 -0
- data/lib/exercism-analysis/templates/each_to_map.rb +29 -0
- data/lib/exercism-analysis/templates/each_to_select.rb +31 -0
- data/lib/exercism-analysis/templates/range_exclusive.rb +19 -0
- data/lib/exercism-analysis/templates/template.rb +29 -0
- data/vendor/clojure/kibit-runner/LICENSE +214 -0
- data/vendor/clojure/kibit-runner/project.clj +10 -0
- data/vendor/clojure/kibit-runner/src/kibit_runner/core.clj +17 -0
- data/vendor/clojure/kibit-runner/target/kibit-runner-0.1.0-SNAPSHOT-standalone.jar +0 -0
- data/vendor/clojure/kibit-runner/target/kibit-runner-0.1.0-SNAPSHOT.jar +0 -0
- data/vendor/clojure/kibit-runner/target/stale/extract-native.dependencies +1 -0
- data/vendor/go/src/github.com/golang/lint/LICENSE +27 -0
- data/vendor/go/src/github.com/golang/lint/README +59 -0
- data/vendor/go/src/github.com/golang/lint/golint/golint.go +67 -0
- data/vendor/go/src/github.com/golang/lint/lint.go +1061 -0
- data/vendor/go/src/runner/golint_runner.go +23 -0
- data/vendor/javascript/jshint_runner.js +6 -0
- data/vendor/javascript/node_modules/jshint/README.md +47 -0
- data/vendor/javascript/node_modules/jshint/bin/apply +6 -0
- data/vendor/javascript/node_modules/jshint/bin/build +36 -0
- data/vendor/javascript/node_modules/jshint/bin/changelog +36 -0
- data/vendor/javascript/node_modules/jshint/bin/jshint +3 -0
- data/vendor/javascript/node_modules/jshint/bin/land +34 -0
- data/vendor/javascript/node_modules/jshint/data/ascii-identifier-data.js +22 -0
- data/vendor/javascript/node_modules/jshint/data/non-ascii-identifier-part-only.js +1570 -0
- data/vendor/javascript/node_modules/jshint/data/non-ascii-identifier-start.js +48477 -0
- data/vendor/javascript/node_modules/jshint/dist/jshint-rhino.js +60642 -0
- data/vendor/javascript/node_modules/jshint/dist/jshint.js +60525 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/README.md +196 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/cli.js +1139 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/cat.js +17 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/command.js +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/echo.js +54 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/glob.js +6 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/long_desc.js +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/progress.js +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/sort.js +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/spinner.js +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/static.coffee +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/static.js +25 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/index.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/LICENSE +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/README.md +250 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/examples/g.js +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/examples/usr-local.js +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/glob.js +728 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/LICENSE +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/README.md +42 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/inherits.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/package.json +51 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/test.js +25 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/package.json +58 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/00-setup.js +176 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-comparison.js +63 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-results.json +351 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/cwd-test.js +55 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/globstar-match.js +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/mark.js +118 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/new-glob-optional-options.js +10 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/nocase-nomagic.js +113 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/pause-resume.js +73 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/readme-issue.js +36 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/root-nomount.js +39 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/root.js +46 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/stat.js +32 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/zz-cleanup.js +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/cli/package.json +70 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/LICENCE +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/README.md +33 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/index.js +86 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/LICENCE +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/README.md +45 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/index.js +5 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/package.json +89 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/seed.js +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/test/index.js +28 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/test/static/index.html +10 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/package.json +88 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/index.js +67 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/static/index.html +12 -0
- data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/static/test-adapter.js +53 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/Gruntfile.js +48 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/LICENSE-MIT +22 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/README.md +75 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/lib/exit.js +41 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/package.json +69 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/exit_test.js +121 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stderr.txt +10 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stdout-stderr.txt +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stdout.txt +10 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stderr.txt +100 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stdout-stderr.txt +200 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stdout.txt +100 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stderr.txt +1000 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stdout-stderr.txt +2000 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stdout.txt +1000 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/create-files.sh +8 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/log-broken.js +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/log.js +25 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/LICENSE +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/README.md +83 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/CollectingHandler.js +55 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/FeedHandler.js +95 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Parser.js +337 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/ProxyHandler.js +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Stream.js +35 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Tokenizer.js +891 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/WritableStream.js +21 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/index.js +68 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/LICENSE +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/index.js +14 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/package.json +40 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/readme.md +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/LICENSE +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/index.js +211 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/package.json +68 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/readme.md +102 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/01-basic.json +57 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/02-single_tag_1.json +21 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/03-single_tag_2.json +21 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/04-unescaped_in_script.json +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/05-tags_in_comment.json +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/06-comment_in_script.json +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/07-unescaped_in_style.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/09-unquoted_attrib.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/10-singular_attribute.json +15 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/11-text_outside_tags.json +40 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/12-text_only.json +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/13-comment_in_text.json +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/14-comment_in_text_in_script.json +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/15-non-verbose.json +22 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/16-normalize_whitespace.json +47 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/17-xml_namespace.json +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/18-enforce_empty_tags.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/19-ignore_empty_tags.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/20-template_script_tags.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/21-conditional_comments.json +15 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/22-lowercase_tags.json +41 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/23-dom-lvl1.json +121 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/tests.js +58 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/LICENSE +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/index.js +14 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/helpers.js +141 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/legacy.js +87 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js +77 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/querying.js +94 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/stringify.js +93 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/traversal.js +24 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/package.json +71 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/readme.md +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/fixture.js +6 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/tests/helpers.js +89 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/tests/legacy.js +119 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/utils.js +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/LICENSE +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/index.js +31 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/decode.js +72 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.js +26 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/encode.js +48 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/decode.json +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/entities.json +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/legacy.json +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/xml.json +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/package.json +79 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/readme.md +31 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/test/mocha.opts +2 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/test/test.js +150 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/LICENSE +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/README.md +15 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/duplex.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/float.patch +923 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_duplex.js +89 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_passthrough.js +46 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_readable.js +944 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_transform.js +209 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_writable.js +472 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/README.md +3 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/float.patch +604 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +107 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/package.json +53 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/util.js +106 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/LICENSE +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/README.md +42 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/inherits.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/inherits_browser.js +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/package.json +51 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/test.js +25 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/README.md +54 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/build/build.js +209 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/component.json +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/index.js +3 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/package.json +54 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/LICENSE +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/README.md +7 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/index.js +200 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/package.json +53 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/package.json +68 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/passthrough.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/readable.js +7 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/transform.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/writable.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/package.json +90 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/01-events.js +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/02-stream.js +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/03-feed.js +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Atom_Example.xml +25 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Attributes.html +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Basic.html +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/RDF_Example.xml +63 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/RSS_Example.xml +48 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/01-simple.json +44 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/02-template.json +63 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/03-lowercase_tags.json +46 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/04-cdata.json +50 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/05-cdata-special.json +35 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/06-leading-lt.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/07-self-closing.json +67 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/08-implicit-close-tags.json +59 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/09-attributes.json +68 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/10-crazy-attrib.json +52 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/11-script_in_script.json +54 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/12-long-comment-end.json +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/13-long-cdata-end.json +22 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/14-implicit-open-tags.json +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/15-lt-whitespace.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/16-double_attribs.json +45 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/17-numeric_entities.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/18-legacy_entities.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/19-named_entities.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/20-xml_entities.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/21-entity_in_attribute.json +38 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/22-double_brackets.json +41 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/23-legacy_entity_fail.json +16 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/24-special_special.json +133 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/25-empty_tag_name.json +13 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/26-not-quite-closed.json +35 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/27-entities_in_attributes.json +62 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/28-cdata_in_html.json +9 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/29-comment_edge-cases.json +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/30-cdata_edge-cases.json +22 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/01-rss.js +34 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/02-atom.js +18 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/03-rdf.js +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/01-basic.json +83 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/02-RSS.json +1093 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/03-Atom.json +644 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/04-RDF.json +1399 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/05-Attributes.json +354 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/api.js +63 -0
- data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/test-helper.js +83 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/LICENSE +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/README.md +218 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/minimatch.js +1061 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS +14 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +252 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/package.json +50 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/basic.js +369 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/package.json +58 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/package.json +57 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/basic.js +399 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/brace-expand.js +33 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/caching.js +14 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/defaults.js +274 -0
- data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/LICENSE +26 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/README.md +569 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/bin/shjs +51 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/global.js +3 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/make.js +47 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/package.json +61 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/scripts/generate-docs.js +21 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/scripts/run-tests.js +50 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/shell.js +157 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cat.js +43 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cd.js +19 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/chmod.js +208 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/common.js +203 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cp.js +201 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/dirs.js +191 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/echo.js +20 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/error.js +10 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/exec.js +181 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/find.js +51 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/grep.js +52 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/ln.js +53 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/ls.js +126 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/mkdir.js +68 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/mv.js +80 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/popd.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/pushd.js +1 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/pwd.js +11 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/rm.js +145 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/sed.js +43 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/tempdir.js +56 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/test.js +85 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/to.js +29 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/toEnd.js +29 -0
- data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/which.js +83 -0
- data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/cli.js +41 -0
- data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/package.json +76 -0
- data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/readme.md +74 -0
- data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/strip-json-comments.js +64 -0
- data/vendor/javascript/node_modules/jshint/node_modules/underscore/LICENSE +23 -0
- data/vendor/javascript/node_modules/jshint/node_modules/underscore/README.md +22 -0
- data/vendor/javascript/node_modules/jshint/node_modules/underscore/package.json +66 -0
- data/vendor/javascript/node_modules/jshint/node_modules/underscore/underscore-min.js +6 -0
- data/vendor/javascript/node_modules/jshint/node_modules/underscore/underscore.js +1343 -0
- data/vendor/javascript/node_modules/jshint/package.json +80 -0
- data/vendor/javascript/node_modules/jshint/src/cli.js +731 -0
- data/vendor/javascript/node_modules/jshint/src/jshint.js +5023 -0
- data/vendor/javascript/node_modules/jshint/src/lex.js +1650 -0
- data/vendor/javascript/node_modules/jshint/src/messages.js +223 -0
- data/vendor/javascript/node_modules/jshint/src/platforms/rhino.js +115 -0
- data/vendor/javascript/node_modules/jshint/src/reg.js +38 -0
- data/vendor/javascript/node_modules/jshint/src/reporters/checkstyle.js +81 -0
- data/vendor/javascript/node_modules/jshint/src/reporters/default.js +34 -0
- data/vendor/javascript/node_modules/jshint/src/reporters/jslint_xml.js +57 -0
- data/vendor/javascript/node_modules/jshint/src/reporters/non_error.js +52 -0
- data/vendor/javascript/node_modules/jshint/src/state.js +28 -0
- data/vendor/javascript/node_modules/jshint/src/style.js +143 -0
- data/vendor/javascript/node_modules/jshint/src/vars.js +658 -0
- data/vendor/python/astroid/COPYING +339 -0
- data/vendor/python/astroid/COPYING.LESSER +510 -0
- data/vendor/python/astroid/ChangeLog +574 -0
- data/vendor/python/astroid/MANIFEST.in +9 -0
- data/vendor/python/astroid/README +56 -0
- data/vendor/python/astroid/README.Python3 +26 -0
- data/vendor/python/astroid/__init__.py +118 -0
- data/vendor/python/astroid/__init__.pyc +0 -0
- data/vendor/python/astroid/__pkginfo__.py +48 -0
- data/vendor/python/astroid/__pkginfo__.pyc +0 -0
- data/vendor/python/astroid/announce.txt +23 -0
- data/vendor/python/astroid/as_string.py +496 -0
- data/vendor/python/astroid/as_string.pyc +0 -0
- data/vendor/python/astroid/bases.py +618 -0
- data/vendor/python/astroid/bases.pyc +0 -0
- data/vendor/python/astroid/brain/py2gi.py +159 -0
- data/vendor/python/astroid/brain/py2gi.pyc +0 -0
- data/vendor/python/astroid/brain/py2mechanize.py +20 -0
- data/vendor/python/astroid/brain/py2mechanize.pyc +0 -0
- data/vendor/python/astroid/brain/py2qt4.py +25 -0
- data/vendor/python/astroid/brain/py2qt4.pyc +0 -0
- data/vendor/python/astroid/brain/py2stdlib.py +252 -0
- data/vendor/python/astroid/brain/py2stdlib.pyc +0 -0
- data/vendor/python/astroid/builder.py +238 -0
- data/vendor/python/astroid/builder.pyc +0 -0
- data/vendor/python/astroid/exceptions.py +51 -0
- data/vendor/python/astroid/exceptions.pyc +0 -0
- data/vendor/python/astroid/inference.py +393 -0
- data/vendor/python/astroid/inference.pyc +0 -0
- data/vendor/python/astroid/inspector.py +275 -0
- data/vendor/python/astroid/manager.py +336 -0
- data/vendor/python/astroid/manager.pyc +0 -0
- data/vendor/python/astroid/mixins.py +122 -0
- data/vendor/python/astroid/mixins.pyc +0 -0
- data/vendor/python/astroid/node_classes.py +928 -0
- data/vendor/python/astroid/node_classes.pyc +0 -0
- data/vendor/python/astroid/nodes.py +73 -0
- data/vendor/python/astroid/nodes.pyc +0 -0
- data/vendor/python/astroid/protocols.py +322 -0
- data/vendor/python/astroid/protocols.pyc +0 -0
- data/vendor/python/astroid/raw_building.py +361 -0
- data/vendor/python/astroid/raw_building.pyc +0 -0
- data/vendor/python/astroid/rebuilder.py +954 -0
- data/vendor/python/astroid/rebuilder.pyc +0 -0
- data/vendor/python/astroid/scoped_nodes.py +1118 -0
- data/vendor/python/astroid/scoped_nodes.pyc +0 -0
- data/vendor/python/astroid/setup.py +184 -0
- data/vendor/python/astroid/tox.ini +10 -0
- data/vendor/python/astroid/utils.py +236 -0
- data/vendor/python/astroid/utils.pyc +0 -0
- data/vendor/python/logilab/__init__.py +0 -0
- data/vendor/python/logilab/__init__.pyc +0 -0
- data/vendor/python/logilab/common/COPYING +339 -0
- data/vendor/python/logilab/common/COPYING.LESSER +510 -0
- data/vendor/python/logilab/common/ChangeLog +1517 -0
- data/vendor/python/logilab/common/MANIFEST.in +13 -0
- data/vendor/python/logilab/common/README +185 -0
- data/vendor/python/logilab/common/README.Python3 +29 -0
- data/vendor/python/logilab/common/__init__.py +171 -0
- data/vendor/python/logilab/common/__init__.pyc +0 -0
- data/vendor/python/logilab/common/__pkginfo__.py +53 -0
- data/vendor/python/logilab/common/__pkginfo__.pyc +0 -0
- data/vendor/python/logilab/common/announce.txt +25 -0
- data/vendor/python/logilab/common/bin/pytest +7 -0
- data/vendor/python/logilab/common/bin/pytest.bat +17 -0
- data/vendor/python/logilab/common/cache.py +114 -0
- data/vendor/python/logilab/common/changelog.py +236 -0
- data/vendor/python/logilab/common/changelog.pyc +0 -0
- data/vendor/python/logilab/common/clcommands.py +332 -0
- data/vendor/python/logilab/common/cli.py +208 -0
- data/vendor/python/logilab/common/compat.py +243 -0
- data/vendor/python/logilab/common/compat.pyc +0 -0
- data/vendor/python/logilab/common/configuration.py +1094 -0
- data/vendor/python/logilab/common/configuration.pyc +0 -0
- data/vendor/python/logilab/common/contexts.py +5 -0
- data/vendor/python/logilab/common/corbautils.py +117 -0
- data/vendor/python/logilab/common/daemon.py +100 -0
- data/vendor/python/logilab/common/date.py +333 -0
- data/vendor/python/logilab/common/dbf.py +229 -0
- data/vendor/python/logilab/common/debugger.py +210 -0
- data/vendor/python/logilab/common/decorators.py +281 -0
- data/vendor/python/logilab/common/decorators.pyc +0 -0
- data/vendor/python/logilab/common/deprecation.py +188 -0
- data/vendor/python/logilab/common/deprecation.pyc +0 -0
- data/vendor/python/logilab/common/fileutils.py +402 -0
- data/vendor/python/logilab/common/graph.py +276 -0
- data/vendor/python/logilab/common/graph.pyc +0 -0
- data/vendor/python/logilab/common/hg.py +130 -0
- data/vendor/python/logilab/common/interface.py +71 -0
- data/vendor/python/logilab/common/interface.pyc +0 -0
- data/vendor/python/logilab/common/logging_ext.py +193 -0
- data/vendor/python/logilab/common/modutils.py +695 -0
- data/vendor/python/logilab/common/modutils.pyc +0 -0
- data/vendor/python/logilab/common/optik_ext.py +391 -0
- data/vendor/python/logilab/common/optik_ext.pyc +0 -0
- data/vendor/python/logilab/common/optparser.py +90 -0
- data/vendor/python/logilab/common/proc.py +277 -0
- data/vendor/python/logilab/common/pyro_ext.py +180 -0
- data/vendor/python/logilab/common/pytest.py +1177 -0
- data/vendor/python/logilab/common/python-logilab-common.spec +184 -0
- data/vendor/python/logilab/common/registry.py +1113 -0
- data/vendor/python/logilab/common/setup.cfg +3 -0
- data/vendor/python/logilab/common/setup.py +189 -0
- data/vendor/python/logilab/common/shellutils.py +455 -0
- data/vendor/python/logilab/common/sphinx_ext.py +87 -0
- data/vendor/python/logilab/common/sphinxutils.py +122 -0
- data/vendor/python/logilab/common/table.py +925 -0
- data/vendor/python/logilab/common/tasksqueue.py +100 -0
- data/vendor/python/logilab/common/textutils.py +534 -0
- data/vendor/python/logilab/common/textutils.pyc +0 -0
- data/vendor/python/logilab/common/tree.py +369 -0
- data/vendor/python/logilab/common/tree.pyc +0 -0
- data/vendor/python/logilab/common/umessage.py +190 -0
- data/vendor/python/logilab/common/ureports/__init__.py +174 -0
- data/vendor/python/logilab/common/ureports/__init__.pyc +0 -0
- data/vendor/python/logilab/common/ureports/docbook_writer.py +139 -0
- data/vendor/python/logilab/common/ureports/html_writer.py +131 -0
- data/vendor/python/logilab/common/ureports/html_writer.pyc +0 -0
- data/vendor/python/logilab/common/ureports/nodes.py +201 -0
- data/vendor/python/logilab/common/ureports/nodes.pyc +0 -0
- data/vendor/python/logilab/common/ureports/text_writer.py +140 -0
- data/vendor/python/logilab/common/ureports/text_writer.pyc +0 -0
- data/vendor/python/logilab/common/urllib2ext.py +87 -0
- data/vendor/python/logilab/common/vcgutils.py +216 -0
- data/vendor/python/logilab/common/visitor.py +107 -0
- data/vendor/python/logilab/common/visitor.pyc +0 -0
- data/vendor/python/logilab/common/xmlrpcutils.py +131 -0
- data/vendor/python/logilab/common/xmlutils.py +61 -0
- data/vendor/python/pylint/CONTRIBUTORS.txt +38 -0
- data/vendor/python/pylint/COPYING +340 -0
- data/vendor/python/pylint/ChangeLog +1437 -0
- data/vendor/python/pylint/DEPENDS +3 -0
- data/vendor/python/pylint/MANIFEST.in +14 -0
- data/vendor/python/pylint/README +50 -0
- data/vendor/python/pylint/README.Python3 +37 -0
- data/vendor/python/pylint/__init__.py +44 -0
- data/vendor/python/pylint/__init__.pyc +0 -0
- data/vendor/python/pylint/__main__.py +3 -0
- data/vendor/python/pylint/__pkginfo__.py +74 -0
- data/vendor/python/pylint/__pkginfo__.pyc +0 -0
- data/vendor/python/pylint/bin/epylint +3 -0
- data/vendor/python/pylint/bin/epylint.bat +5 -0
- data/vendor/python/pylint/bin/pylint +3 -0
- data/vendor/python/pylint/bin/pylint-gui +3 -0
- data/vendor/python/pylint/bin/pylint-gui.bat +5 -0
- data/vendor/python/pylint/bin/pylint.bat +5 -0
- data/vendor/python/pylint/bin/pyreverse +3 -0
- data/vendor/python/pylint/bin/pyreverse.bat +5 -0
- data/vendor/python/pylint/bin/symilar +3 -0
- data/vendor/python/pylint/bin/symilar.bat +5 -0
- data/vendor/python/pylint/checkers/__init__.py +145 -0
- data/vendor/python/pylint/checkers/__init__.pyc +0 -0
- data/vendor/python/pylint/checkers/base.py +1141 -0
- data/vendor/python/pylint/checkers/base.pyc +0 -0
- data/vendor/python/pylint/checkers/classes.py +792 -0
- data/vendor/python/pylint/checkers/classes.pyc +0 -0
- data/vendor/python/pylint/checkers/design_analysis.py +367 -0
- data/vendor/python/pylint/checkers/design_analysis.pyc +0 -0
- data/vendor/python/pylint/checkers/exceptions.py +306 -0
- data/vendor/python/pylint/checkers/exceptions.pyc +0 -0
- data/vendor/python/pylint/checkers/format.py +943 -0
- data/vendor/python/pylint/checkers/format.pyc +0 -0
- data/vendor/python/pylint/checkers/imports.py +394 -0
- data/vendor/python/pylint/checkers/imports.pyc +0 -0
- data/vendor/python/pylint/checkers/logging.py +213 -0
- data/vendor/python/pylint/checkers/logging.pyc +0 -0
- data/vendor/python/pylint/checkers/misc.py +90 -0
- data/vendor/python/pylint/checkers/misc.pyc +0 -0
- data/vendor/python/pylint/checkers/newstyle.py +151 -0
- data/vendor/python/pylint/checkers/newstyle.pyc +0 -0
- data/vendor/python/pylint/checkers/raw_metrics.py +129 -0
- data/vendor/python/pylint/checkers/raw_metrics.pyc +0 -0
- data/vendor/python/pylint/checkers/similar.py +365 -0
- data/vendor/python/pylint/checkers/similar.pyc +0 -0
- data/vendor/python/pylint/checkers/stdlib.py +69 -0
- data/vendor/python/pylint/checkers/stdlib.pyc +0 -0
- data/vendor/python/pylint/checkers/strings.py +304 -0
- data/vendor/python/pylint/checkers/strings.pyc +0 -0
- data/vendor/python/pylint/checkers/typecheck.py +451 -0
- data/vendor/python/pylint/checkers/typecheck.pyc +0 -0
- data/vendor/python/pylint/checkers/utils.py +416 -0
- data/vendor/python/pylint/checkers/utils.pyc +0 -0
- data/vendor/python/pylint/checkers/variables.py +741 -0
- data/vendor/python/pylint/checkers/variables.pyc +0 -0
- data/vendor/python/pylint/config.py +156 -0
- data/vendor/python/pylint/config.pyc +0 -0
- data/vendor/python/pylint/epylint.py +175 -0
- data/vendor/python/pylint/gui.py +508 -0
- data/vendor/python/pylint/interfaces.py +72 -0
- data/vendor/python/pylint/interfaces.pyc +0 -0
- data/vendor/python/pylint/lint.py +1106 -0
- data/vendor/python/pylint/lint.pyc +0 -0
- data/vendor/python/pylint/pyreverse/__init__.py +5 -0
- data/vendor/python/pylint/pyreverse/diadefslib.py +233 -0
- data/vendor/python/pylint/pyreverse/diagrams.py +247 -0
- data/vendor/python/pylint/pyreverse/main.py +124 -0
- data/vendor/python/pylint/pyreverse/utils.py +131 -0
- data/vendor/python/pylint/pyreverse/writer.py +199 -0
- data/vendor/python/pylint/reporters/__init__.py +138 -0
- data/vendor/python/pylint/reporters/__init__.pyc +0 -0
- data/vendor/python/pylint/reporters/guireporter.py +28 -0
- data/vendor/python/pylint/reporters/guireporter.pyc +0 -0
- data/vendor/python/pylint/reporters/html.py +70 -0
- data/vendor/python/pylint/reporters/html.pyc +0 -0
- data/vendor/python/pylint/reporters/text.py +143 -0
- data/vendor/python/pylint/reporters/text.pyc +0 -0
- data/vendor/python/pylint/setup.cfg +3 -0
- data/vendor/python/pylint/setup.py +203 -0
- data/vendor/python/pylint/tox.ini +10 -0
- data/vendor/python/pylint/utils.py +744 -0
- data/vendor/python/pylint/utils.pyc +0 -0
- data/vendor/python/pylint_runner.py +22 -0
- metadata +675 -0
|
Binary file
|
|
@@ -0,0 +1,943 @@
|
|
|
1
|
+
# Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
|
|
2
|
+
#
|
|
3
|
+
# This program is free software; you can redistribute it and/or modify it under
|
|
4
|
+
# the terms of the GNU General Public License as published by the Free Software
|
|
5
|
+
# Foundation; either version 2 of the License, or (at your option) any later
|
|
6
|
+
# version.
|
|
7
|
+
#
|
|
8
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
9
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
10
|
+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
11
|
+
#
|
|
12
|
+
# You should have received a copy of the GNU General Public License along with
|
|
13
|
+
# this program; if not, write to the Free Software Foundation, Inc.,
|
|
14
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
15
|
+
"""Python code format's checker.
|
|
16
|
+
|
|
17
|
+
By default try to follow Guido's style guide :
|
|
18
|
+
|
|
19
|
+
http://www.python.org/doc/essays/styleguide.html
|
|
20
|
+
|
|
21
|
+
Some parts of the process_token method is based from The Tab Nanny std module.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
import keyword
|
|
25
|
+
import sys
|
|
26
|
+
import tokenize
|
|
27
|
+
|
|
28
|
+
if not hasattr(tokenize, 'NL'):
|
|
29
|
+
raise ValueError("tokenize.NL doesn't exist -- tokenize module too old")
|
|
30
|
+
|
|
31
|
+
from astroid import nodes
|
|
32
|
+
|
|
33
|
+
from pylint.interfaces import ITokenChecker, IAstroidChecker, IRawChecker
|
|
34
|
+
from pylint.checkers import BaseTokenChecker
|
|
35
|
+
from pylint.checkers.utils import check_messages
|
|
36
|
+
from pylint.utils import WarningScope, OPTION_RGX
|
|
37
|
+
|
|
38
|
+
_CONTINUATION_BLOCK_OPENERS = ['elif', 'except', 'for', 'if', 'while', 'def', 'class']
|
|
39
|
+
_KEYWORD_TOKENS = ['assert', 'del', 'elif', 'except', 'for', 'if', 'in', 'not',
|
|
40
|
+
'raise', 'return', 'while', 'yield']
|
|
41
|
+
if sys.version_info < (3, 0):
|
|
42
|
+
_KEYWORD_TOKENS.append('print')
|
|
43
|
+
|
|
44
|
+
_SPACED_OPERATORS = ['==', '<', '>', '!=', '<>', '<=', '>=',
|
|
45
|
+
'+=', '-=', '*=', '**=', '/=', '//=', '&=', '|=', '^=',
|
|
46
|
+
'%=', '>>=', '<<=']
|
|
47
|
+
_OPENING_BRACKETS = ['(', '[', '{']
|
|
48
|
+
_CLOSING_BRACKETS = [')', ']', '}']
|
|
49
|
+
_TAB_LENGTH = 8
|
|
50
|
+
|
|
51
|
+
_EOL = frozenset([tokenize.NEWLINE, tokenize.NL, tokenize.COMMENT])
|
|
52
|
+
_JUNK_TOKENS = (tokenize.COMMENT, tokenize.NL)
|
|
53
|
+
|
|
54
|
+
# Whitespace checking policy constants
|
|
55
|
+
_MUST = 0
|
|
56
|
+
_MUST_NOT = 1
|
|
57
|
+
_IGNORE = 2
|
|
58
|
+
|
|
59
|
+
# Whitespace checking config constants
|
|
60
|
+
_DICT_SEPARATOR = 'dict-separator'
|
|
61
|
+
_TRAILING_COMMA = 'trailing-comma'
|
|
62
|
+
_NO_SPACE_CHECK_CHOICES = [_TRAILING_COMMA, _DICT_SEPARATOR]
|
|
63
|
+
|
|
64
|
+
MSGS = {
|
|
65
|
+
'C0301': ('Line too long (%s/%s)',
|
|
66
|
+
'line-too-long',
|
|
67
|
+
'Used when a line is longer than a given number of characters.'),
|
|
68
|
+
'C0302': ('Too many lines in module (%s)', # was W0302
|
|
69
|
+
'too-many-lines',
|
|
70
|
+
'Used when a module has too much lines, reducing its readability.'
|
|
71
|
+
),
|
|
72
|
+
'C0303': ('Trailing whitespace',
|
|
73
|
+
'trailing-whitespace',
|
|
74
|
+
'Used when there is whitespace between the end of a line and the '
|
|
75
|
+
'newline.'),
|
|
76
|
+
'C0304': ('Final newline missing',
|
|
77
|
+
'missing-final-newline',
|
|
78
|
+
'Used when the last line in a file is missing a newline.'),
|
|
79
|
+
'W0311': ('Bad indentation. Found %s %s, expected %s',
|
|
80
|
+
'bad-indentation',
|
|
81
|
+
'Used when an unexpected number of indentation\'s tabulations or '
|
|
82
|
+
'spaces has been found.'),
|
|
83
|
+
'C0330': ('Wrong %s indentation%s.\n%s%s',
|
|
84
|
+
'bad-continuation',
|
|
85
|
+
'TODO'),
|
|
86
|
+
'W0312': ('Found indentation with %ss instead of %ss',
|
|
87
|
+
'mixed-indentation',
|
|
88
|
+
'Used when there are some mixed tabs and spaces in a module.'),
|
|
89
|
+
'W0301': ('Unnecessary semicolon', # was W0106
|
|
90
|
+
'unnecessary-semicolon',
|
|
91
|
+
'Used when a statement is ended by a semi-colon (";"), which \
|
|
92
|
+
isn\'t necessary (that\'s python, not C ;).'),
|
|
93
|
+
'C0321': ('More than one statement on a single line',
|
|
94
|
+
'multiple-statements',
|
|
95
|
+
'Used when more than on statement are found on the same line.',
|
|
96
|
+
{'scope': WarningScope.NODE}),
|
|
97
|
+
'C0325' : ('Unnecessary parens after %r keyword',
|
|
98
|
+
'superfluous-parens',
|
|
99
|
+
'Used when a single item in parentheses follows an if, for, or '
|
|
100
|
+
'other keyword.'),
|
|
101
|
+
'C0326': ('%s space %s %s %s\n%s',
|
|
102
|
+
'bad-whitespace',
|
|
103
|
+
('Used when a wrong number of spaces is used around an operator, '
|
|
104
|
+
'bracket or block opener.'),
|
|
105
|
+
{'old_names': [('C0323', 'no-space-after-operator'),
|
|
106
|
+
('C0324', 'no-space-after-comma'),
|
|
107
|
+
('C0322', 'no-space-before-operator')]})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
if sys.version_info < (3, 0):
|
|
112
|
+
|
|
113
|
+
MSGS.update({
|
|
114
|
+
'W0331': ('Use of the <> operator',
|
|
115
|
+
'old-ne-operator',
|
|
116
|
+
'Used when the deprecated "<>" operator is used instead \
|
|
117
|
+
of "!=".'),
|
|
118
|
+
'W0332': ('Use of "l" as long integer identifier',
|
|
119
|
+
'lowercase-l-suffix',
|
|
120
|
+
'Used when a lower case "l" is used to mark a long integer. You '
|
|
121
|
+
'should use a upper case "L" since the letter "l" looks too much '
|
|
122
|
+
'like the digit "1"'),
|
|
123
|
+
'W0333': ('Use of the `` operator',
|
|
124
|
+
'backtick',
|
|
125
|
+
'Used when the deprecated "``" (backtick) operator is used '
|
|
126
|
+
'instead of the str() function.',
|
|
127
|
+
{'scope': WarningScope.NODE}),
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _underline_token(token):
|
|
132
|
+
length = token[3][1] - token[2][1]
|
|
133
|
+
offset = token[2][1]
|
|
134
|
+
return token[4] + (' ' * offset) + ('^' * length)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def _column_distance(token1, token2):
|
|
138
|
+
if token1 == token2:
|
|
139
|
+
return 0
|
|
140
|
+
if token2[3] < token1[3]:
|
|
141
|
+
token1, token2 = token2, token1
|
|
142
|
+
if token1[3][0] != token2[2][0]:
|
|
143
|
+
return None
|
|
144
|
+
return token2[2][1] - token1[3][1]
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def _last_token_on_line_is(tokens, line_end, token):
|
|
148
|
+
return (
|
|
149
|
+
line_end > 0 and tokens.token(line_end-1) == token or
|
|
150
|
+
line_end > 1 and tokens.token(line_end-2) == token
|
|
151
|
+
and tokens.type(line_end-1) == tokenize.COMMENT)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _token_followed_by_eol(tokens, position):
|
|
155
|
+
return (tokens.type(position+1) == tokenize.NL or
|
|
156
|
+
tokens.type(position+1) == tokenize.COMMENT and
|
|
157
|
+
tokens.type(position+2) == tokenize.NL)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def _get_indent_length(line):
|
|
161
|
+
"""Return the length of the indentation on the given token's line."""
|
|
162
|
+
result = 0
|
|
163
|
+
for char in line:
|
|
164
|
+
if char == ' ':
|
|
165
|
+
result += 1
|
|
166
|
+
elif char == '\t':
|
|
167
|
+
result += _TAB_LENGTH
|
|
168
|
+
else:
|
|
169
|
+
break
|
|
170
|
+
return result
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def _get_indent_hint_line(bar_positions, bad_position):
|
|
174
|
+
"""Return a line with |s for each of the positions in the given lists."""
|
|
175
|
+
if not bar_positions:
|
|
176
|
+
return ''
|
|
177
|
+
markers = [(pos, '|') for pos in bar_positions]
|
|
178
|
+
markers.append((bad_position, '^'))
|
|
179
|
+
markers.sort()
|
|
180
|
+
line = [' '] * (markers[-1][0] + 1)
|
|
181
|
+
for position, marker in markers:
|
|
182
|
+
line[position] = marker
|
|
183
|
+
return ''.join(line)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class _ContinuedIndent(object):
|
|
187
|
+
__slots__ = ('valid_outdent_offsets',
|
|
188
|
+
'valid_continuation_offsets',
|
|
189
|
+
'context_type',
|
|
190
|
+
'token',
|
|
191
|
+
'position')
|
|
192
|
+
|
|
193
|
+
def __init__(self,
|
|
194
|
+
context_type,
|
|
195
|
+
token,
|
|
196
|
+
position,
|
|
197
|
+
valid_outdent_offsets,
|
|
198
|
+
valid_continuation_offsets):
|
|
199
|
+
self.valid_outdent_offsets = valid_outdent_offsets
|
|
200
|
+
self.valid_continuation_offsets = valid_continuation_offsets
|
|
201
|
+
self.context_type = context_type
|
|
202
|
+
self.position = position
|
|
203
|
+
self.token = token
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
# The contexts for hanging indents.
|
|
207
|
+
# A hanging indented dictionary value after :
|
|
208
|
+
HANGING_DICT_VALUE = 'dict-value'
|
|
209
|
+
# Hanging indentation in an expression.
|
|
210
|
+
HANGING = 'hanging'
|
|
211
|
+
# Hanging indentation in a block header.
|
|
212
|
+
HANGING_BLOCK = 'hanging-block'
|
|
213
|
+
# Continued indentation inside an expression.
|
|
214
|
+
CONTINUED = 'continued'
|
|
215
|
+
# Continued indentation in a block header.
|
|
216
|
+
CONTINUED_BLOCK = 'continued-block'
|
|
217
|
+
|
|
218
|
+
SINGLE_LINE = 'single'
|
|
219
|
+
WITH_BODY = 'multi'
|
|
220
|
+
|
|
221
|
+
_CONTINUATION_MSG_PARTS = {
|
|
222
|
+
HANGING_DICT_VALUE: ('hanging', ' in dict value'),
|
|
223
|
+
HANGING: ('hanging', ''),
|
|
224
|
+
HANGING_BLOCK: ('hanging', ' before block'),
|
|
225
|
+
CONTINUED: ('continued', ''),
|
|
226
|
+
CONTINUED_BLOCK: ('continued', ' before block'),
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def _Offsets(*args):
|
|
231
|
+
"""Valid indentation offsets for a continued line."""
|
|
232
|
+
return dict((a, None) for a in args)
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
def _BeforeBlockOffsets(single, with_body):
|
|
236
|
+
"""Valid alternative indent offsets for continued lines before blocks.
|
|
237
|
+
|
|
238
|
+
:param single: Valid offset for statements on a single logical line.
|
|
239
|
+
:param with_body: Valid offset for statements on several lines.
|
|
240
|
+
"""
|
|
241
|
+
return {single: SINGLE_LINE, with_body: WITH_BODY}
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
class TokenWrapper(object):
|
|
245
|
+
"""A wrapper for readable access to token information."""
|
|
246
|
+
|
|
247
|
+
def __init__(self, tokens):
|
|
248
|
+
self._tokens = tokens
|
|
249
|
+
|
|
250
|
+
def token(self, idx):
|
|
251
|
+
return self._tokens[idx][1]
|
|
252
|
+
|
|
253
|
+
def type(self, idx):
|
|
254
|
+
return self._tokens[idx][0]
|
|
255
|
+
|
|
256
|
+
def start_line(self, idx):
|
|
257
|
+
return self._tokens[idx][2][0]
|
|
258
|
+
|
|
259
|
+
def start_col(self, idx):
|
|
260
|
+
return self._tokens[idx][2][1]
|
|
261
|
+
|
|
262
|
+
def line(self, idx):
|
|
263
|
+
return self._tokens[idx][4]
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
class ContinuedLineState(object):
|
|
267
|
+
"""Tracker for continued indentation inside a logical line."""
|
|
268
|
+
|
|
269
|
+
def __init__(self, tokens, config):
|
|
270
|
+
self._line_start = -1
|
|
271
|
+
self._cont_stack = []
|
|
272
|
+
self._is_block_opener = False
|
|
273
|
+
self.retained_warnings = []
|
|
274
|
+
self._config = config
|
|
275
|
+
self._tokens = TokenWrapper(tokens)
|
|
276
|
+
|
|
277
|
+
@property
|
|
278
|
+
def has_content(self):
|
|
279
|
+
return bool(self._cont_stack)
|
|
280
|
+
|
|
281
|
+
@property
|
|
282
|
+
def _block_indent_size(self):
|
|
283
|
+
return len(self._config.indent_string.replace('\t', ' ' * _TAB_LENGTH))
|
|
284
|
+
|
|
285
|
+
@property
|
|
286
|
+
def _continuation_size(self):
|
|
287
|
+
return self._config.indent_after_paren
|
|
288
|
+
|
|
289
|
+
def handle_line_start(self, pos):
|
|
290
|
+
"""Record the first non-junk token at the start of a line."""
|
|
291
|
+
if self._line_start > -1:
|
|
292
|
+
return
|
|
293
|
+
self._is_block_opener = self._tokens.token(pos) in _CONTINUATION_BLOCK_OPENERS
|
|
294
|
+
self._line_start = pos
|
|
295
|
+
|
|
296
|
+
def next_physical_line(self):
|
|
297
|
+
"""Prepares the tracker for a new physical line (NL)."""
|
|
298
|
+
self._line_start = -1
|
|
299
|
+
self._is_block_opener = False
|
|
300
|
+
|
|
301
|
+
def next_logical_line(self):
|
|
302
|
+
"""Prepares the tracker for a new logical line (NEWLINE).
|
|
303
|
+
|
|
304
|
+
A new logical line only starts with block indentation.
|
|
305
|
+
"""
|
|
306
|
+
self.next_physical_line()
|
|
307
|
+
self.retained_warnings = []
|
|
308
|
+
self._cont_stack = []
|
|
309
|
+
|
|
310
|
+
def add_block_warning(self, token_position, state, valid_offsets):
|
|
311
|
+
self.retained_warnings.append((token_position, state, valid_offsets))
|
|
312
|
+
|
|
313
|
+
def get_valid_offsets(self, idx):
|
|
314
|
+
""""Returns the valid offsets for the token at the given position."""
|
|
315
|
+
# The closing brace on a dict or the 'for' in a dict comprehension may
|
|
316
|
+
# reset two indent levels because the dict value is ended implicitly
|
|
317
|
+
stack_top = -1
|
|
318
|
+
if self._tokens.token(idx) in ('}', 'for') and self._cont_stack[-1].token == ':':
|
|
319
|
+
stack_top = -2
|
|
320
|
+
indent = self._cont_stack[stack_top]
|
|
321
|
+
if self._tokens.token(idx) in _CLOSING_BRACKETS:
|
|
322
|
+
valid_offsets = indent.valid_outdent_offsets
|
|
323
|
+
else:
|
|
324
|
+
valid_offsets = indent.valid_continuation_offsets
|
|
325
|
+
return indent, valid_offsets.copy()
|
|
326
|
+
|
|
327
|
+
def _hanging_indent_after_bracket(self, bracket, position):
|
|
328
|
+
"""Extracts indentation information for a hanging indent."""
|
|
329
|
+
indentation = _get_indent_length(self._tokens.line(position))
|
|
330
|
+
if self._is_block_opener and self._continuation_size == self._block_indent_size:
|
|
331
|
+
return _ContinuedIndent(
|
|
332
|
+
HANGING_BLOCK,
|
|
333
|
+
bracket,
|
|
334
|
+
position,
|
|
335
|
+
_Offsets(indentation + self._continuation_size, indentation),
|
|
336
|
+
_BeforeBlockOffsets(indentation + self._continuation_size,
|
|
337
|
+
indentation + self._continuation_size * 2))
|
|
338
|
+
elif bracket == ':':
|
|
339
|
+
if self._cont_stack[-1].context_type == CONTINUED:
|
|
340
|
+
# If the dict key was on the same line as the open brace, the new
|
|
341
|
+
# correct indent should be relative to the key instead of the
|
|
342
|
+
# current indent level
|
|
343
|
+
paren_align = self._cont_stack[-1].valid_outdent_offsets
|
|
344
|
+
next_align = self._cont_stack[-1].valid_continuation_offsets.copy()
|
|
345
|
+
next_align[next_align.keys()[0] + self._continuation_size] = True
|
|
346
|
+
else:
|
|
347
|
+
next_align = _Offsets(indentation + self._continuation_size, indentation)
|
|
348
|
+
paren_align = _Offsets(indentation + self._continuation_size, indentation)
|
|
349
|
+
return _ContinuedIndent(HANGING_DICT_VALUE, bracket, position, paren_align, next_align)
|
|
350
|
+
else:
|
|
351
|
+
return _ContinuedIndent(
|
|
352
|
+
HANGING,
|
|
353
|
+
bracket,
|
|
354
|
+
position,
|
|
355
|
+
_Offsets(indentation, indentation + self._continuation_size),
|
|
356
|
+
_Offsets(indentation + self._continuation_size))
|
|
357
|
+
|
|
358
|
+
def _continuation_inside_bracket(self, bracket, pos):
|
|
359
|
+
"""Extracts indentation information for a continued indent."""
|
|
360
|
+
indentation = _get_indent_length(self._tokens.line(pos))
|
|
361
|
+
if self._is_block_opener and self._tokens.start_col(pos+1) - indentation == self._block_indent_size:
|
|
362
|
+
return _ContinuedIndent(
|
|
363
|
+
CONTINUED_BLOCK,
|
|
364
|
+
bracket,
|
|
365
|
+
pos,
|
|
366
|
+
_Offsets(self._tokens.start_col(pos)),
|
|
367
|
+
_BeforeBlockOffsets(self._tokens.start_col(pos+1),
|
|
368
|
+
self._tokens.start_col(pos+1) + self._continuation_size))
|
|
369
|
+
else:
|
|
370
|
+
return _ContinuedIndent(
|
|
371
|
+
CONTINUED,
|
|
372
|
+
bracket,
|
|
373
|
+
pos,
|
|
374
|
+
_Offsets(self._tokens.start_col(pos)),
|
|
375
|
+
_Offsets(self._tokens.start_col(pos+1)))
|
|
376
|
+
|
|
377
|
+
def pop_token(self):
|
|
378
|
+
self._cont_stack.pop()
|
|
379
|
+
|
|
380
|
+
def push_token(self, token, position):
|
|
381
|
+
"""Pushes a new token for continued indentation on the stack.
|
|
382
|
+
|
|
383
|
+
Tokens that can modify continued indentation offsets are:
|
|
384
|
+
* opening brackets
|
|
385
|
+
* 'lambda'
|
|
386
|
+
* : inside dictionaries
|
|
387
|
+
|
|
388
|
+
push_token relies on the caller to filter out those
|
|
389
|
+
interesting tokens.
|
|
390
|
+
|
|
391
|
+
:param token: The concrete token
|
|
392
|
+
:param position: The position of the token in the stream.
|
|
393
|
+
"""
|
|
394
|
+
if _token_followed_by_eol(self._tokens, position):
|
|
395
|
+
self._cont_stack.append(
|
|
396
|
+
self._hanging_indent_after_bracket(token, position))
|
|
397
|
+
else:
|
|
398
|
+
self._cont_stack.append(
|
|
399
|
+
self._continuation_inside_bracket(token, position))
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
class FormatChecker(BaseTokenChecker):
|
|
403
|
+
"""checks for :
|
|
404
|
+
* unauthorized constructions
|
|
405
|
+
* strict indentation
|
|
406
|
+
* line length
|
|
407
|
+
* use of <> instead of !=
|
|
408
|
+
"""
|
|
409
|
+
|
|
410
|
+
__implements__ = (ITokenChecker, IAstroidChecker, IRawChecker)
|
|
411
|
+
|
|
412
|
+
# configuration section name
|
|
413
|
+
name = 'format'
|
|
414
|
+
# messages
|
|
415
|
+
msgs = MSGS
|
|
416
|
+
# configuration options
|
|
417
|
+
# for available dict keys/values see the optik parser 'add_option' method
|
|
418
|
+
options = (('max-line-length',
|
|
419
|
+
{'default' : 80, 'type' : "int", 'metavar' : '<int>',
|
|
420
|
+
'help' : 'Maximum number of characters on a single line.'}),
|
|
421
|
+
('ignore-long-lines',
|
|
422
|
+
{'type': 'regexp', 'metavar': '<regexp>',
|
|
423
|
+
'default': r'^\s*(# )?<?https?://\S+>?$',
|
|
424
|
+
'help': ('Regexp for a line that is allowed to be longer than '
|
|
425
|
+
'the limit.')}),
|
|
426
|
+
('single-line-if-stmt',
|
|
427
|
+
{'default': False, 'type' : 'yn', 'metavar' : '<y_or_n>',
|
|
428
|
+
'help' : ('Allow the body of an if to be on the same '
|
|
429
|
+
'line as the test if there is no else.')}),
|
|
430
|
+
('no-space-check',
|
|
431
|
+
{'default': ','.join(_NO_SPACE_CHECK_CHOICES),
|
|
432
|
+
'type': 'multiple_choice',
|
|
433
|
+
'choices': _NO_SPACE_CHECK_CHOICES,
|
|
434
|
+
'help': ('List of optional constructs for which whitespace '
|
|
435
|
+
'checking is disabled')}),
|
|
436
|
+
('max-module-lines',
|
|
437
|
+
{'default' : 1000, 'type' : 'int', 'metavar' : '<int>',
|
|
438
|
+
'help': 'Maximum number of lines in a module'}
|
|
439
|
+
),
|
|
440
|
+
('indent-string',
|
|
441
|
+
{'default' : ' ', 'type' : "string", 'metavar' : '<string>',
|
|
442
|
+
'help' : 'String used as indentation unit. This is usually \
|
|
443
|
+
" " (4 spaces) or "\\t" (1 tab).'}),
|
|
444
|
+
('indent-after-paren',
|
|
445
|
+
{'type': 'int', 'metavar': '<int>', 'default': 4,
|
|
446
|
+
'help': 'Number of spaces of indent required inside a hanging '
|
|
447
|
+
' or continued line.'}),
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
def __init__(self, linter=None):
|
|
451
|
+
BaseTokenChecker.__init__(self, linter)
|
|
452
|
+
self._lines = None
|
|
453
|
+
self._visited_lines = None
|
|
454
|
+
self._bracket_stack = [None]
|
|
455
|
+
|
|
456
|
+
def _pop_token(self):
|
|
457
|
+
self._bracket_stack.pop()
|
|
458
|
+
self._current_line.pop_token()
|
|
459
|
+
|
|
460
|
+
def _push_token(self, token, idx):
|
|
461
|
+
self._bracket_stack.append(token)
|
|
462
|
+
self._current_line.push_token(token, idx)
|
|
463
|
+
|
|
464
|
+
def new_line(self, tokens, line_end, line_start):
|
|
465
|
+
"""a new line has been encountered, process it if necessary"""
|
|
466
|
+
if _last_token_on_line_is(tokens, line_end, ';'):
|
|
467
|
+
self.add_message('unnecessary-semicolon', line=tokens.start_line(line_end))
|
|
468
|
+
|
|
469
|
+
line_num = tokens.start_line(line_start)
|
|
470
|
+
line = tokens.line(line_start)
|
|
471
|
+
if tokens.type(line_start) not in _JUNK_TOKENS:
|
|
472
|
+
self._lines[line_num] = line.split('\n')[0]
|
|
473
|
+
self.check_lines(line, line_num)
|
|
474
|
+
|
|
475
|
+
def process_module(self, module):
|
|
476
|
+
self._keywords_with_parens = set()
|
|
477
|
+
if 'print_function' in module.future_imports:
|
|
478
|
+
self._keywords_with_parens.add('print')
|
|
479
|
+
|
|
480
|
+
def _check_keyword_parentheses(self, tokens, start):
|
|
481
|
+
"""Check that there are not unnecessary parens after a keyword.
|
|
482
|
+
|
|
483
|
+
Parens are unnecessary if there is exactly one balanced outer pair on a
|
|
484
|
+
line, and it is followed by a colon, and contains no commas (i.e. is not a
|
|
485
|
+
tuple).
|
|
486
|
+
|
|
487
|
+
Args:
|
|
488
|
+
tokens: list of Tokens; the entire list of Tokens.
|
|
489
|
+
start: int; the position of the keyword in the token list.
|
|
490
|
+
"""
|
|
491
|
+
# If the next token is not a paren, we're fine.
|
|
492
|
+
if self._inside_brackets(':') and tokens[start][1] == 'for':
|
|
493
|
+
self._pop_token()
|
|
494
|
+
if tokens[start+1][1] != '(':
|
|
495
|
+
return
|
|
496
|
+
|
|
497
|
+
found_and_or = False
|
|
498
|
+
depth = 0
|
|
499
|
+
keyword_token = tokens[start][1]
|
|
500
|
+
line_num = tokens[start][2][0]
|
|
501
|
+
|
|
502
|
+
for i in xrange(start, len(tokens) - 1):
|
|
503
|
+
token = tokens[i]
|
|
504
|
+
|
|
505
|
+
# If we hit a newline, then assume any parens were for continuation.
|
|
506
|
+
if token[0] == tokenize.NL:
|
|
507
|
+
return
|
|
508
|
+
|
|
509
|
+
if token[1] == '(':
|
|
510
|
+
depth += 1
|
|
511
|
+
elif token[1] == ')':
|
|
512
|
+
depth -= 1
|
|
513
|
+
if not depth:
|
|
514
|
+
# ')' can't happen after if (foo), since it would be a syntax error.
|
|
515
|
+
if (tokens[i+1][1] in (':', ')', ']', '}', 'in') or
|
|
516
|
+
tokens[i+1][0] in (tokenize.NEWLINE, tokenize.ENDMARKER,
|
|
517
|
+
tokenize.COMMENT)):
|
|
518
|
+
# The empty tuple () is always accepted.
|
|
519
|
+
if i == start + 2:
|
|
520
|
+
return
|
|
521
|
+
if keyword_token == 'not':
|
|
522
|
+
if not found_and_or:
|
|
523
|
+
self.add_message('superfluous-parens', line=line_num,
|
|
524
|
+
args=keyword_token)
|
|
525
|
+
elif keyword_token in ('return', 'yield'):
|
|
526
|
+
self.add_message('superfluous-parens', line=line_num,
|
|
527
|
+
args=keyword_token)
|
|
528
|
+
elif keyword_token not in self._keywords_with_parens:
|
|
529
|
+
if not (tokens[i+1][1] == 'in' and found_and_or):
|
|
530
|
+
self.add_message('superfluous-parens', line=line_num,
|
|
531
|
+
args=keyword_token)
|
|
532
|
+
return
|
|
533
|
+
elif depth == 1:
|
|
534
|
+
# This is a tuple, which is always acceptable.
|
|
535
|
+
if token[1] == ',':
|
|
536
|
+
return
|
|
537
|
+
# 'and' and 'or' are the only boolean operators with lower precedence
|
|
538
|
+
# than 'not', so parens are only required when they are found.
|
|
539
|
+
elif token[1] in ('and', 'or'):
|
|
540
|
+
found_and_or = True
|
|
541
|
+
# A yield inside an expression must always be in parentheses,
|
|
542
|
+
# quit early without error.
|
|
543
|
+
elif token[1] == 'yield':
|
|
544
|
+
return
|
|
545
|
+
# A generator expression always has a 'for' token in it, and
|
|
546
|
+
# the 'for' token is only legal inside parens when it is in a
|
|
547
|
+
# generator expression. The parens are necessary here, so bail
|
|
548
|
+
# without an error.
|
|
549
|
+
elif token[1] == 'for':
|
|
550
|
+
return
|
|
551
|
+
|
|
552
|
+
def _opening_bracket(self, tokens, i):
|
|
553
|
+
self._push_token(tokens[i][1], i)
|
|
554
|
+
# Special case: ignore slices
|
|
555
|
+
if tokens[i][1] == '[' and tokens[i+1][1] == ':':
|
|
556
|
+
return
|
|
557
|
+
|
|
558
|
+
if (i > 0 and (tokens[i-1][0] == tokenize.NAME and
|
|
559
|
+
not (keyword.iskeyword(tokens[i-1][1]))
|
|
560
|
+
or tokens[i-1][1] in _CLOSING_BRACKETS)):
|
|
561
|
+
self._check_space(tokens, i, (_MUST_NOT, _MUST_NOT))
|
|
562
|
+
else:
|
|
563
|
+
self._check_space(tokens, i, (_IGNORE, _MUST_NOT))
|
|
564
|
+
|
|
565
|
+
def _closing_bracket(self, tokens, i):
|
|
566
|
+
if self._inside_brackets(':'):
|
|
567
|
+
self._pop_token()
|
|
568
|
+
self._pop_token()
|
|
569
|
+
# Special case: ignore slices
|
|
570
|
+
if tokens[i-1][1] == ':' and tokens[i][1] == ']':
|
|
571
|
+
return
|
|
572
|
+
policy_before = _MUST_NOT
|
|
573
|
+
if tokens[i][1] in _CLOSING_BRACKETS and tokens[i-1][1] == ',':
|
|
574
|
+
if _TRAILING_COMMA in self.config.no_space_check:
|
|
575
|
+
policy_before = _IGNORE
|
|
576
|
+
|
|
577
|
+
self._check_space(tokens, i, (policy_before, _IGNORE))
|
|
578
|
+
|
|
579
|
+
def _check_equals_spacing(self, tokens, i):
|
|
580
|
+
"""Check the spacing of a single equals sign."""
|
|
581
|
+
if self._inside_brackets('(') or self._inside_brackets('lambda'):
|
|
582
|
+
self._check_space(tokens, i, (_MUST_NOT, _MUST_NOT))
|
|
583
|
+
else:
|
|
584
|
+
self._check_space(tokens, i, (_MUST, _MUST))
|
|
585
|
+
|
|
586
|
+
def _open_lambda(self, tokens, i): # pylint:disable=unused-argument
|
|
587
|
+
self._push_token('lambda', i)
|
|
588
|
+
|
|
589
|
+
def _handle_colon(self, tokens, i):
|
|
590
|
+
# Special case: ignore slices
|
|
591
|
+
if self._inside_brackets('['):
|
|
592
|
+
return
|
|
593
|
+
if (self._inside_brackets('{') and
|
|
594
|
+
_DICT_SEPARATOR in self.config.no_space_check):
|
|
595
|
+
policy = (_IGNORE, _IGNORE)
|
|
596
|
+
else:
|
|
597
|
+
policy = (_MUST_NOT, _MUST)
|
|
598
|
+
self._check_space(tokens, i, policy)
|
|
599
|
+
|
|
600
|
+
if self._inside_brackets('lambda'):
|
|
601
|
+
self._pop_token()
|
|
602
|
+
elif self._inside_brackets('{'):
|
|
603
|
+
self._push_token(':', i)
|
|
604
|
+
|
|
605
|
+
def _handle_comma(self, tokens, i):
|
|
606
|
+
# Only require a following whitespace if this is
|
|
607
|
+
# not a hanging comma before a closing bracket.
|
|
608
|
+
if tokens[i+1][1] in _CLOSING_BRACKETS:
|
|
609
|
+
self._check_space(tokens, i, (_MUST_NOT, _IGNORE))
|
|
610
|
+
else:
|
|
611
|
+
self._check_space(tokens, i, (_MUST_NOT, _MUST))
|
|
612
|
+
if self._inside_brackets(':'):
|
|
613
|
+
self._pop_token()
|
|
614
|
+
|
|
615
|
+
def _check_surrounded_by_space(self, tokens, i):
|
|
616
|
+
"""Check that a binary operator is surrounded by exactly one space."""
|
|
617
|
+
self._check_space(tokens, i, (_MUST, _MUST))
|
|
618
|
+
|
|
619
|
+
def _check_space(self, tokens, i, policies):
|
|
620
|
+
def _policy_string(policy):
|
|
621
|
+
if policy == _MUST:
|
|
622
|
+
return 'Exactly one', 'required'
|
|
623
|
+
else:
|
|
624
|
+
return 'No', 'allowed'
|
|
625
|
+
|
|
626
|
+
def _name_construct(token):
|
|
627
|
+
if tokens[i][1] == ',':
|
|
628
|
+
return 'comma'
|
|
629
|
+
elif tokens[i][1] == ':':
|
|
630
|
+
return ':'
|
|
631
|
+
elif tokens[i][1] in '()[]{}':
|
|
632
|
+
return 'bracket'
|
|
633
|
+
elif tokens[i][1] in ('<', '>', '<=', '>=', '!=', '=='):
|
|
634
|
+
return 'comparison'
|
|
635
|
+
else:
|
|
636
|
+
if self._inside_brackets('('):
|
|
637
|
+
return 'keyword argument assignment'
|
|
638
|
+
else:
|
|
639
|
+
return 'assignment'
|
|
640
|
+
|
|
641
|
+
good_space = [True, True]
|
|
642
|
+
pairs = [(tokens[i-1], tokens[i]), (tokens[i], tokens[i+1])]
|
|
643
|
+
|
|
644
|
+
for other_idx, (policy, token_pair) in enumerate(zip(policies, pairs)):
|
|
645
|
+
if token_pair[other_idx][0] in _EOL or policy == _IGNORE:
|
|
646
|
+
continue
|
|
647
|
+
|
|
648
|
+
distance = _column_distance(*token_pair)
|
|
649
|
+
if distance is None:
|
|
650
|
+
continue
|
|
651
|
+
good_space[other_idx] = (
|
|
652
|
+
(policy == _MUST and distance == 1) or
|
|
653
|
+
(policy == _MUST_NOT and distance == 0))
|
|
654
|
+
|
|
655
|
+
warnings = []
|
|
656
|
+
if not any(good_space) and policies[0] == policies[1]:
|
|
657
|
+
warnings.append((policies[0], 'around'))
|
|
658
|
+
else:
|
|
659
|
+
for ok, policy, position in zip(good_space, policies, ('before', 'after')):
|
|
660
|
+
if not ok:
|
|
661
|
+
warnings.append((policy, position))
|
|
662
|
+
for policy, position in warnings:
|
|
663
|
+
construct = _name_construct(tokens[i])
|
|
664
|
+
count, state = _policy_string(policy)
|
|
665
|
+
self.add_message('bad-whitespace', line=tokens[i][2][0],
|
|
666
|
+
args=(count, state, position, construct,
|
|
667
|
+
_underline_token(tokens[i])))
|
|
668
|
+
|
|
669
|
+
def _inside_brackets(self, left):
|
|
670
|
+
return self._bracket_stack[-1] == left
|
|
671
|
+
|
|
672
|
+
def _handle_old_ne_operator(self, tokens, i):
|
|
673
|
+
if tokens[i][1] == '<>':
|
|
674
|
+
self.add_message('old-ne-operator', line=tokens[i][2][0])
|
|
675
|
+
|
|
676
|
+
def _prepare_token_dispatcher(self):
|
|
677
|
+
raw = [
|
|
678
|
+
(_KEYWORD_TOKENS,
|
|
679
|
+
self._check_keyword_parentheses),
|
|
680
|
+
|
|
681
|
+
(_OPENING_BRACKETS, self._opening_bracket),
|
|
682
|
+
|
|
683
|
+
(_CLOSING_BRACKETS, self._closing_bracket),
|
|
684
|
+
|
|
685
|
+
(['='], self._check_equals_spacing),
|
|
686
|
+
|
|
687
|
+
(_SPACED_OPERATORS, self._check_surrounded_by_space),
|
|
688
|
+
|
|
689
|
+
([','], self._handle_comma),
|
|
690
|
+
|
|
691
|
+
([':'], self._handle_colon),
|
|
692
|
+
|
|
693
|
+
(['lambda'], self._open_lambda),
|
|
694
|
+
|
|
695
|
+
(['<>'], self._handle_old_ne_operator),
|
|
696
|
+
]
|
|
697
|
+
|
|
698
|
+
dispatch = {}
|
|
699
|
+
for tokens, handler in raw:
|
|
700
|
+
for token in tokens:
|
|
701
|
+
dispatch[token] = handler
|
|
702
|
+
return dispatch
|
|
703
|
+
|
|
704
|
+
def process_tokens(self, tokens):
|
|
705
|
+
"""process tokens and search for :
|
|
706
|
+
|
|
707
|
+
_ non strict indentation (i.e. not always using the <indent> parameter as
|
|
708
|
+
indent unit)
|
|
709
|
+
_ too long lines (i.e. longer than <max_chars>)
|
|
710
|
+
_ optionally bad construct (if given, bad_construct must be a compiled
|
|
711
|
+
regular expression).
|
|
712
|
+
"""
|
|
713
|
+
self._bracket_stack = [None]
|
|
714
|
+
indents = [0]
|
|
715
|
+
check_equal = False
|
|
716
|
+
line_num = 0
|
|
717
|
+
self._lines = {}
|
|
718
|
+
self._visited_lines = {}
|
|
719
|
+
token_handlers = self._prepare_token_dispatcher()
|
|
720
|
+
|
|
721
|
+
self._current_line = ContinuedLineState(tokens, self.config)
|
|
722
|
+
for idx, (tok_type, token, start, _, line) in enumerate(tokens):
|
|
723
|
+
if start[0] != line_num:
|
|
724
|
+
line_num = start[0]
|
|
725
|
+
# A tokenizer oddity: if an indented line contains a multi-line
|
|
726
|
+
# docstring, the line member of the INDENT token does not contain
|
|
727
|
+
# the full line; therefore we check the next token on the line.
|
|
728
|
+
if tok_type == tokenize.INDENT:
|
|
729
|
+
self.new_line(TokenWrapper(tokens), idx-1, idx+1)
|
|
730
|
+
else:
|
|
731
|
+
self.new_line(TokenWrapper(tokens), idx-1, idx)
|
|
732
|
+
|
|
733
|
+
if tok_type == tokenize.NEWLINE:
|
|
734
|
+
# a program statement, or ENDMARKER, will eventually follow,
|
|
735
|
+
# after some (possibly empty) run of tokens of the form
|
|
736
|
+
# (NL | COMMENT)* (INDENT | DEDENT+)?
|
|
737
|
+
# If an INDENT appears, setting check_equal is wrong, and will
|
|
738
|
+
# be undone when we see the INDENT.
|
|
739
|
+
check_equal = True
|
|
740
|
+
self._process_retained_warnings(TokenWrapper(tokens), idx)
|
|
741
|
+
self._current_line.next_logical_line()
|
|
742
|
+
elif tok_type == tokenize.INDENT:
|
|
743
|
+
check_equal = False
|
|
744
|
+
self.check_indent_level(token, indents[-1]+1, line_num)
|
|
745
|
+
indents.append(indents[-1]+1)
|
|
746
|
+
elif tok_type == tokenize.DEDENT:
|
|
747
|
+
# there's nothing we need to check here! what's important is
|
|
748
|
+
# that when the run of DEDENTs ends, the indentation of the
|
|
749
|
+
# program statement (or ENDMARKER) that triggered the run is
|
|
750
|
+
# equal to what's left at the top of the indents stack
|
|
751
|
+
check_equal = True
|
|
752
|
+
if len(indents) > 1:
|
|
753
|
+
del indents[-1]
|
|
754
|
+
elif tok_type == tokenize.NL:
|
|
755
|
+
self._check_continued_indentation(TokenWrapper(tokens), idx+1)
|
|
756
|
+
self._current_line.next_physical_line()
|
|
757
|
+
elif tok_type != tokenize.COMMENT:
|
|
758
|
+
self._current_line.handle_line_start(idx)
|
|
759
|
+
# This is the first concrete token following a NEWLINE, so it
|
|
760
|
+
# must be the first token of the next program statement, or an
|
|
761
|
+
# ENDMARKER; the "line" argument exposes the leading whitespace
|
|
762
|
+
# for this statement; in the case of ENDMARKER, line is an empty
|
|
763
|
+
# string, so will properly match the empty string with which the
|
|
764
|
+
# "indents" stack was seeded
|
|
765
|
+
if check_equal:
|
|
766
|
+
check_equal = False
|
|
767
|
+
self.check_indent_level(line, indents[-1], line_num)
|
|
768
|
+
|
|
769
|
+
if tok_type == tokenize.NUMBER and token.endswith('l'):
|
|
770
|
+
self.add_message('lowercase-l-suffix', line=line_num)
|
|
771
|
+
|
|
772
|
+
try:
|
|
773
|
+
handler = token_handlers[token]
|
|
774
|
+
except KeyError:
|
|
775
|
+
pass
|
|
776
|
+
else:
|
|
777
|
+
handler(tokens, idx)
|
|
778
|
+
|
|
779
|
+
line_num -= 1 # to be ok with "wc -l"
|
|
780
|
+
if line_num > self.config.max_module_lines:
|
|
781
|
+
self.add_message('too-many-lines', args=line_num, line=1)
|
|
782
|
+
|
|
783
|
+
def _process_retained_warnings(self, tokens, current_pos):
|
|
784
|
+
single_line_block_stmt = not _last_token_on_line_is(tokens, current_pos, ':')
|
|
785
|
+
|
|
786
|
+
for indent_pos, state, offsets in self._current_line.retained_warnings:
|
|
787
|
+
block_type = offsets[tokens.start_col(indent_pos)]
|
|
788
|
+
hints = dict((k, v) for k, v in offsets.iteritems()
|
|
789
|
+
if v != block_type)
|
|
790
|
+
if single_line_block_stmt and block_type == WITH_BODY:
|
|
791
|
+
self._add_continuation_message(state, hints, tokens, indent_pos)
|
|
792
|
+
elif not single_line_block_stmt and block_type == SINGLE_LINE:
|
|
793
|
+
self._add_continuation_message(state, hints, tokens, indent_pos)
|
|
794
|
+
|
|
795
|
+
def _check_continued_indentation(self, tokens, next_idx):
|
|
796
|
+
# Do not issue any warnings if the next line is empty.
|
|
797
|
+
if not self._current_line.has_content or tokens.type(next_idx) == tokenize.NL:
|
|
798
|
+
return
|
|
799
|
+
|
|
800
|
+
state, valid_offsets = self._current_line.get_valid_offsets(next_idx)
|
|
801
|
+
# Special handling for hanging comments. If the last line ended with a
|
|
802
|
+
# comment and the new line contains only a comment, the line may also be
|
|
803
|
+
# indented to the start of the previous comment.
|
|
804
|
+
if (tokens.type(next_idx) == tokenize.COMMENT and
|
|
805
|
+
tokens.type(next_idx-2) == tokenize.COMMENT):
|
|
806
|
+
valid_offsets[tokens.start_col(next_idx-2)] = True
|
|
807
|
+
|
|
808
|
+
# We can only decide if the indentation of a continued line before opening
|
|
809
|
+
# a new block is valid once we know of the body of the block is on the
|
|
810
|
+
# same line as the block opener. Since the token processing is single-pass,
|
|
811
|
+
# emitting those warnings is delayed until the block opener is processed.
|
|
812
|
+
if (state.context_type in (HANGING_BLOCK, CONTINUED_BLOCK)
|
|
813
|
+
and tokens.start_col(next_idx) in valid_offsets):
|
|
814
|
+
self._current_line.add_block_warning(next_idx, state, valid_offsets)
|
|
815
|
+
elif tokens.start_col(next_idx) not in valid_offsets:
|
|
816
|
+
self._add_continuation_message(state, valid_offsets, tokens, next_idx)
|
|
817
|
+
|
|
818
|
+
def _add_continuation_message(self, state, offsets, tokens, position):
|
|
819
|
+
readable_type, readable_position = _CONTINUATION_MSG_PARTS[state.context_type]
|
|
820
|
+
hint_line = _get_indent_hint_line(offsets, tokens.start_col(position))
|
|
821
|
+
self.add_message(
|
|
822
|
+
'bad-continuation',
|
|
823
|
+
line=tokens.start_line(position),
|
|
824
|
+
args=(readable_type, readable_position, tokens.line(position), hint_line))
|
|
825
|
+
|
|
826
|
+
@check_messages('multiple-statements')
|
|
827
|
+
def visit_default(self, node):
|
|
828
|
+
"""check the node line number and check it if not yet done"""
|
|
829
|
+
if not node.is_statement:
|
|
830
|
+
return
|
|
831
|
+
if not node.root().pure_python:
|
|
832
|
+
return # XXX block visit of child nodes
|
|
833
|
+
prev_sibl = node.previous_sibling()
|
|
834
|
+
if prev_sibl is not None:
|
|
835
|
+
prev_line = prev_sibl.fromlineno
|
|
836
|
+
else:
|
|
837
|
+
# The line on which a finally: occurs in a try/finally
|
|
838
|
+
# is not directly represented in the AST. We infer it
|
|
839
|
+
# by taking the last line of the body and adding 1, which
|
|
840
|
+
# should be the line of finally:
|
|
841
|
+
if (isinstance(node.parent, nodes.TryFinally)
|
|
842
|
+
and node in node.parent.finalbody):
|
|
843
|
+
prev_line = node.parent.body[0].tolineno + 1
|
|
844
|
+
else:
|
|
845
|
+
prev_line = node.parent.statement().fromlineno
|
|
846
|
+
line = node.fromlineno
|
|
847
|
+
assert line, node
|
|
848
|
+
if prev_line == line and self._visited_lines.get(line) != 2:
|
|
849
|
+
self._check_multi_statement_line(node, line)
|
|
850
|
+
return
|
|
851
|
+
if line in self._visited_lines:
|
|
852
|
+
return
|
|
853
|
+
try:
|
|
854
|
+
tolineno = node.blockstart_tolineno
|
|
855
|
+
except AttributeError:
|
|
856
|
+
tolineno = node.tolineno
|
|
857
|
+
assert tolineno, node
|
|
858
|
+
lines = []
|
|
859
|
+
for line in xrange(line, tolineno + 1):
|
|
860
|
+
self._visited_lines[line] = 1
|
|
861
|
+
try:
|
|
862
|
+
lines.append(self._lines[line].rstrip())
|
|
863
|
+
except KeyError:
|
|
864
|
+
lines.append('')
|
|
865
|
+
|
|
866
|
+
def _check_multi_statement_line(self, node, line):
|
|
867
|
+
"""Check for lines containing multiple statements."""
|
|
868
|
+
# Do not warn about multiple nested context managers
|
|
869
|
+
# in with statements.
|
|
870
|
+
if isinstance(node, nodes.With):
|
|
871
|
+
return
|
|
872
|
+
# For try... except... finally..., the two nodes
|
|
873
|
+
# appear to be on the same line due to how the AST is built.
|
|
874
|
+
if (isinstance(node, nodes.TryExcept) and
|
|
875
|
+
isinstance(node.parent, nodes.TryFinally)):
|
|
876
|
+
return
|
|
877
|
+
if (isinstance(node.parent, nodes.If) and not node.parent.orelse
|
|
878
|
+
and self.config.single_line_if_stmt):
|
|
879
|
+
return
|
|
880
|
+
self.add_message('multiple-statements', node=node)
|
|
881
|
+
self._visited_lines[line] = 2
|
|
882
|
+
|
|
883
|
+
@check_messages('backtick')
|
|
884
|
+
def visit_backquote(self, node):
|
|
885
|
+
self.add_message('backtick', node=node)
|
|
886
|
+
|
|
887
|
+
def check_lines(self, lines, i):
|
|
888
|
+
"""check lines have less than a maximum number of characters
|
|
889
|
+
"""
|
|
890
|
+
max_chars = self.config.max_line_length
|
|
891
|
+
ignore_long_line = self.config.ignore_long_lines
|
|
892
|
+
|
|
893
|
+
for line in lines.splitlines(True):
|
|
894
|
+
if not line.endswith('\n'):
|
|
895
|
+
self.add_message('missing-final-newline', line=i)
|
|
896
|
+
else:
|
|
897
|
+
stripped_line = line.rstrip()
|
|
898
|
+
if line[len(stripped_line):] not in ('\n', '\r\n'):
|
|
899
|
+
self.add_message('trailing-whitespace', line=i)
|
|
900
|
+
# Don't count excess whitespace in the line length.
|
|
901
|
+
line = stripped_line
|
|
902
|
+
mobj = OPTION_RGX.search(line)
|
|
903
|
+
if mobj and mobj.group(1).split('=', 1)[0].strip() == 'disable':
|
|
904
|
+
line = line.split('#')[0].rstrip()
|
|
905
|
+
|
|
906
|
+
if len(line) > max_chars and not ignore_long_line.search(line):
|
|
907
|
+
self.add_message('line-too-long', line=i, args=(len(line), max_chars))
|
|
908
|
+
i += 1
|
|
909
|
+
|
|
910
|
+
def check_indent_level(self, string, expected, line_num):
|
|
911
|
+
"""return the indent level of the string
|
|
912
|
+
"""
|
|
913
|
+
indent = self.config.indent_string
|
|
914
|
+
if indent == '\\t': # \t is not interpreted in the configuration file
|
|
915
|
+
indent = '\t'
|
|
916
|
+
level = 0
|
|
917
|
+
unit_size = len(indent)
|
|
918
|
+
while string[:unit_size] == indent:
|
|
919
|
+
string = string[unit_size:]
|
|
920
|
+
level += 1
|
|
921
|
+
suppl = ''
|
|
922
|
+
while string and string[0] in ' \t':
|
|
923
|
+
if string[0] != indent[0]:
|
|
924
|
+
if string[0] == '\t':
|
|
925
|
+
args = ('tab', 'space')
|
|
926
|
+
else:
|
|
927
|
+
args = ('space', 'tab')
|
|
928
|
+
self.add_message('mixed-indentation', args=args, line=line_num)
|
|
929
|
+
return level
|
|
930
|
+
suppl += string[0]
|
|
931
|
+
string = string[1:]
|
|
932
|
+
if level != expected or suppl:
|
|
933
|
+
i_type = 'spaces'
|
|
934
|
+
if indent[0] == '\t':
|
|
935
|
+
i_type = 'tabs'
|
|
936
|
+
self.add_message('bad-indentation', line=line_num,
|
|
937
|
+
args=(level * unit_size + len(suppl), i_type,
|
|
938
|
+
expected * unit_size))
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
def register(linter):
|
|
942
|
+
"""required method to auto register this checker """
|
|
943
|
+
linter.register_checker(FormatChecker(linter))
|