libv8 7.3.492.27.1 → 8.4.255.0
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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +11 -14
- data/CHANGELOG.md +10 -0
- data/README.md +10 -11
- data/Rakefile +30 -36
- data/ext/libv8/builder.rb +1 -1
- data/lib/libv8/version.rb +1 -1
- data/libv8.gemspec +1 -3
- data/vendor/depot_tools/{cipd.ps1 → .cipd_impl.ps1} +0 -0
- data/vendor/depot_tools/.gitattributes +1 -1
- data/vendor/depot_tools/.gitignore +7 -2
- data/vendor/depot_tools/.style.yapf +3 -1
- data/vendor/depot_tools/.vpython +55 -0
- data/vendor/depot_tools/.vpython3 +23 -0
- data/vendor/depot_tools/CROS_OWNERS +3 -1
- data/vendor/depot_tools/GOMA_OWNERS +9 -0
- data/vendor/depot_tools/LUCI_OWNERS +5 -0
- data/vendor/depot_tools/OWNERS +21 -6
- data/vendor/depot_tools/PRESUBMIT.py +35 -18
- data/vendor/depot_tools/README.git-cl.md +0 -14
- data/vendor/depot_tools/README.md +1 -1
- data/vendor/depot_tools/WATCHLISTS +2 -2
- data/vendor/depot_tools/auth.py +60 -772
- data/vendor/depot_tools/autoninja +12 -6
- data/vendor/depot_tools/autoninja.bat +14 -6
- data/vendor/depot_tools/autoninja.py +64 -27
- data/vendor/depot_tools/bb +1 -1
- data/vendor/depot_tools/bootstrap/{win/README.md → README.md} +28 -14
- data/vendor/depot_tools/bootstrap/{win/win_tools.py → bootstrap.py} +60 -43
- data/vendor/depot_tools/bootstrap/{win/git-bash.template.sh → git-bash.template.sh} +1 -1
- data/vendor/depot_tools/bootstrap/{win/git.template.bat → git.template.bat} +0 -0
- data/vendor/depot_tools/bootstrap/manifest.txt +27 -0
- data/vendor/depot_tools/bootstrap/manifest_bleeding_edge.txt +27 -0
- data/vendor/depot_tools/bootstrap/{win/profile.d.python.sh → profile.d.python.sh} +0 -0
- data/vendor/depot_tools/bootstrap/{win/python27.bleeding_edge.bat → python27.bat} +0 -0
- data/vendor/depot_tools/bootstrap/{win/python27.new.bat → python3.bat} +3 -3
- data/vendor/depot_tools/bootstrap/{win/win_tools.bat → win_tools.bat} +21 -16
- data/vendor/depot_tools/bootstrap_python3 +35 -0
- data/vendor/depot_tools/cbuildbot +1 -1
- data/vendor/depot_tools/chrome_set_ver +1 -1
- data/vendor/depot_tools/cipd +43 -39
- data/vendor/depot_tools/cipd.bat +2 -2
- data/vendor/depot_tools/cipd_client_version +1 -1
- data/vendor/depot_tools/cipd_client_version.digests +15 -14
- data/vendor/depot_tools/cipd_manifest.txt +31 -8
- data/vendor/depot_tools/cipd_manifest.versions +278 -158
- data/vendor/depot_tools/cit.py +9 -7
- data/vendor/depot_tools/clang_format.py +4 -1
- data/vendor/depot_tools/clang_format_merge_driver.py +10 -8
- data/vendor/depot_tools/compile_single_file.py +7 -2
- data/vendor/depot_tools/cpplint.py +51 -45
- data/vendor/depot_tools/cros +87 -0
- data/vendor/depot_tools/cros_sdk +1 -1
- data/vendor/depot_tools/crosjobs +13 -0
- data/vendor/depot_tools/detect_host_arch.py +0 -1
- data/vendor/depot_tools/dirmd +12 -0
- data/vendor/depot_tools/dirmd.bat +7 -0
- data/vendor/depot_tools/download_from_google_storage.py +47 -27
- data/vendor/depot_tools/ensure_bootstrap +14 -0
- data/vendor/depot_tools/fetch +14 -1
- data/vendor/depot_tools/fetch.bat +14 -1
- data/vendor/depot_tools/fetch.py +5 -7
- data/vendor/depot_tools/fetch_configs/chromium.py +6 -4
- data/vendor/depot_tools/fetch_configs/devtools-frontend.py +44 -0
- data/vendor/depot_tools/fetch_configs/ios_internal.py +10 -19
- data/vendor/depot_tools/fix_encoding.py +19 -5
- data/vendor/depot_tools/gclient +28 -12
- data/vendor/depot_tools/gclient-new-workdir.py +2 -0
- data/vendor/depot_tools/gclient.bat +18 -1
- data/vendor/depot_tools/gclient.py +160 -119
- data/vendor/depot_tools/gclient_eval.py +119 -107
- data/vendor/depot_tools/gclient_paths.py +67 -57
- data/vendor/depot_tools/gclient_scm.py +181 -159
- data/vendor/depot_tools/gclient_utils.py +177 -124
- data/vendor/depot_tools/gerrit_client.py +21 -13
- data/vendor/depot_tools/gerrit_util.py +188 -228
- data/vendor/depot_tools/git-cache +1 -1
- data/vendor/depot_tools/git-cl +1 -1
- data/vendor/depot_tools/git-drover +1 -1
- data/vendor/depot_tools/git-find-releases +1 -1
- data/vendor/depot_tools/git-footers +1 -1
- data/vendor/depot_tools/git-freeze +1 -1
- data/vendor/depot_tools/git-hyper-blame +1 -1
- data/vendor/depot_tools/git-map +1 -1
- data/vendor/depot_tools/git-map-branches +1 -1
- data/vendor/depot_tools/git-mark-merge-base +1 -1
- data/vendor/depot_tools/git-nav-downstream +1 -1
- data/vendor/depot_tools/git-new-branch +1 -1
- data/vendor/depot_tools/git-number +1 -1
- data/vendor/depot_tools/git-rebase-update +1 -1
- data/vendor/depot_tools/git-rename-branch +1 -1
- data/vendor/depot_tools/git-reparent-branch +1 -1
- data/vendor/depot_tools/git-retry +1 -1
- data/vendor/depot_tools/git-squash-branch +1 -1
- data/vendor/depot_tools/git-thaw +1 -1
- data/vendor/depot_tools/git-upstream-diff +1 -1
- data/vendor/depot_tools/git_cache.py +255 -360
- data/vendor/depot_tools/git_cl.py +1562 -2059
- data/vendor/depot_tools/git_cl_completion.sh +16 -2
- data/vendor/depot_tools/git_common.py +77 -32
- data/vendor/depot_tools/git_drover.py +17 -8
- data/vendor/depot_tools/git_find_releases.py +11 -9
- data/vendor/depot_tools/git_footers.py +13 -9
- data/vendor/depot_tools/git_freezer.py +3 -1
- data/vendor/depot_tools/git_hyper_blame.py +25 -32
- data/vendor/depot_tools/git_map.py +115 -93
- data/vendor/depot_tools/git_map_branches.py +11 -10
- data/vendor/depot_tools/git_mark_merge_base.py +8 -6
- data/vendor/depot_tools/git_nav_downstream.py +9 -6
- data/vendor/depot_tools/git_new_branch.py +39 -33
- data/vendor/depot_tools/git_number.py +28 -17
- data/vendor/depot_tools/git_rebase_update.py +50 -49
- data/vendor/depot_tools/git_rename_branch.py +2 -2
- data/vendor/depot_tools/git_reparent_branch.py +8 -6
- data/vendor/depot_tools/git_upstream_diff.py +4 -2
- data/vendor/depot_tools/gn.py +6 -4
- data/vendor/depot_tools/goma_auth +12 -0
- data/vendor/depot_tools/goma_auth.bat +8 -0
- data/vendor/depot_tools/goma_ctl +12 -0
- data/vendor/depot_tools/goma_ctl.bat +8 -0
- data/vendor/depot_tools/gsutil.py +5 -2
- data/vendor/depot_tools/gsutil.py.bat +8 -0
- data/vendor/depot_tools/gsutil.vpython +3 -1
- data/vendor/depot_tools/infra/config/OWNERS +2 -2
- data/vendor/depot_tools/infra/config/recipes.cfg +3 -2
- data/vendor/depot_tools/led +1 -1
- data/vendor/depot_tools/lockfile.py +116 -0
- data/vendor/depot_tools/luci-auth +1 -1
- data/vendor/depot_tools/lucicfg +1 -1
- data/vendor/depot_tools/mac_toolchain +1 -1
- data/vendor/depot_tools/man/html/depot_tools.html +1 -1
- data/vendor/depot_tools/man/html/depot_tools_tutorial.html +31 -25
- data/vendor/depot_tools/man/html/git-cl.html +1 -1
- data/vendor/depot_tools/man/html/git-drover.html +18 -18
- data/vendor/depot_tools/man/html/git-footers.html +1 -1
- data/vendor/depot_tools/man/html/git-freeze.html +3 -3
- data/vendor/depot_tools/man/html/git-hyper-blame.html +1 -1
- data/vendor/depot_tools/man/html/git-map-branches.html +2 -2
- data/vendor/depot_tools/man/html/git-map.html +1 -1
- data/vendor/depot_tools/man/html/git-mark-merge-base.html +1 -1
- data/vendor/depot_tools/man/html/git-nav-downstream.html +3 -3
- data/vendor/depot_tools/man/html/git-nav-upstream.html +12 -6
- data/vendor/depot_tools/man/html/git-new-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-rebase-update.html +20 -1
- data/vendor/depot_tools/man/html/git-rename-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-reparent-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-retry.html +1 -1
- data/vendor/depot_tools/man/html/git-squash-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-thaw.html +1 -1
- data/vendor/depot_tools/man/html/git-upstream-diff.html +10 -6
- data/vendor/depot_tools/man/man1/git-cl.1 +4 -4
- data/vendor/depot_tools/man/man1/git-drover.1 +21 -21
- data/vendor/depot_tools/man/man1/git-footers.1 +4 -4
- data/vendor/depot_tools/man/man1/git-freeze.1 +6 -6
- data/vendor/depot_tools/man/man1/git-hyper-blame.1 +4 -4
- data/vendor/depot_tools/man/man1/git-map-branches.1 +4 -4
- data/vendor/depot_tools/man/man1/git-map.1 +4 -4
- data/vendor/depot_tools/man/man1/git-mark-merge-base.1 +4 -4
- data/vendor/depot_tools/man/man1/git-nav-downstream.1 +6 -6
- data/vendor/depot_tools/man/man1/git-nav-upstream.1 +15 -9
- data/vendor/depot_tools/man/man1/git-new-branch.1 +3 -3
- data/vendor/depot_tools/man/man1/git-rebase-update.1 +14 -4
- data/vendor/depot_tools/man/man1/git-rename-branch.1 +4 -4
- data/vendor/depot_tools/man/man1/git-reparent-branch.1 +4 -4
- data/vendor/depot_tools/man/man1/git-retry.1 +4 -4
- data/vendor/depot_tools/man/man1/git-squash-branch.1 +4 -4
- data/vendor/depot_tools/man/man1/git-thaw.1 +4 -4
- data/vendor/depot_tools/man/man1/git-upstream-diff.1 +7 -13
- data/vendor/depot_tools/man/man7/depot_tools.7 +4 -4
- data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +31 -25
- data/vendor/depot_tools/man/src/common_demo_functions.sh +2 -2
- data/vendor/depot_tools/man/src/depot_tools_tutorial.txt +3 -3
- data/vendor/depot_tools/man/src/filter_demo_output.py +4 -2
- data/vendor/depot_tools/man/src/git-new-branch.txt +2 -1
- data/vendor/depot_tools/man/src/git-rebase-update.txt +8 -1
- data/vendor/depot_tools/metrics.README.md +8 -5
- data/vendor/depot_tools/metrics.py +7 -6
- data/vendor/depot_tools/metrics_utils.py +4 -14
- data/vendor/depot_tools/my_activity.py +85 -251
- data/vendor/depot_tools/ninja +1 -0
- data/vendor/depot_tools/ninja-mac +0 -0
- data/vendor/depot_tools/ninjalog_uploader.py +146 -145
- data/vendor/depot_tools/ninjalog_uploader_wrapper.py +69 -60
- data/vendor/depot_tools/owners.py +156 -43
- data/vendor/depot_tools/owners_finder.py +28 -14
- data/vendor/depot_tools/post_build_ninja_summary.py +76 -48
- data/vendor/depot_tools/presubmit_canned_checks.py +293 -106
- data/vendor/depot_tools/presubmit_support.py +527 -333
- data/vendor/depot_tools/prpc +1 -1
- data/vendor/depot_tools/pylint +2 -12
- data/vendor/depot_tools/pylint-1.5 +78 -0
- data/vendor/depot_tools/pylint-1.6 +78 -0
- data/vendor/depot_tools/pylint-1.7 +78 -0
- data/vendor/depot_tools/pylint-1.8 +78 -0
- data/vendor/depot_tools/pylint-1.9 +78 -0
- data/vendor/depot_tools/{depot-tools-auth.bat → pylint.bat} +2 -2
- data/vendor/depot_tools/pylint_main.py +45 -0
- data/vendor/depot_tools/pylintrc +14 -1
- data/vendor/depot_tools/python-bin/python3 +7 -0
- data/vendor/depot_tools/python_runner.sh +13 -8
- data/vendor/depot_tools/rdb +12 -0
- data/vendor/depot_tools/rdb.bat +7 -0
- data/vendor/depot_tools/recipes/OWNERS +0 -1
- data/vendor/depot_tools/recipes/README.recipes.md +218 -151
- data/vendor/depot_tools/recipes/recipe_modules/OWNERS +1 -1
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +17 -16
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +127 -78
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic.json +19 -4
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic_luci.json +18 -3
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json +19 -4
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/clobber.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +28 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_rebase_patch_ref.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_reset.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/input_commit_with_id_without_repo.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/multiple_patch_refs.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{with_manifest_name.json → no_cp_checkout_HEAD.json} +25 -15
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_branch_head.json +65 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_specific_commit.json +65 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_master.json +65 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/refs.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/reset_root_solution_revision.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/resolve_chromium_fixed_version.json +117 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +17 -11
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +41 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +24 -11
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json +38 -11
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json +36 -11
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/unrecognized_commit_repo.json +0 -5
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_tags.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.py +95 -22
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/bot_update.py +187 -114
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/test_api.py +2 -2
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/tests/do_not_retry_patch_failures_in_cq.py +42 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/tests/ensure_checkout.py +1 -0
- data/vendor/depot_tools/recipes/recipe_modules/cipd/__init__.py +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/api.py +2 -2
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/basic.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/basic_pkg.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/describe-failed.json +2 -4
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/describe-many-instances.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/mac64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_file.json +26 -6
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_mode.json +23 -5
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_verfile.json +23 -5
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/win64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/junk arch.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/junk bits.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_arm_32.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_arm_64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_intel_32.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_intel_64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_mips_64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/mac_intel_64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/win_intel_32.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/win_intel_64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/test_api.py +1 -1
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/api.py +4 -1
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json +4 -2
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/basic_luci.json +3 -1
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/win.json +4 -2
- data/vendor/depot_tools/recipes/recipe_modules/gclient/__init__.py +2 -1
- data/vendor/depot_tools/recipes/recipe_modules/gclient/api.py +82 -13
- data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +23 -11
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/basic.json +3 -4
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/revision.json +3 -6
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/tryserver.json +3 -4
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +7 -7
- data/vendor/depot_tools/recipes/recipe_modules/gclient/resources/diff_deps.py +16 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/test_api.py +4 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/diff_deps.expected/basic.json +55 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/diff_deps.expected/dont have revision yet.json +84 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/diff_deps.expected/no change, exception.json +83 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/diff_deps.expected/windows.json +55 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/diff_deps.py +88 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/patch_project.py +9 -21
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/sync_failure.py +24 -0
- data/vendor/depot_tools/recipes/recipe_modules/gerrit/api.py +2 -1
- data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +7 -12
- data/vendor/depot_tools/recipes/recipe_modules/git/__init__.py +0 -2
- data/vendor/depot_tools/recipes/recipe_modules/git/api.py +9 -17
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_branch.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_hash.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_ref.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_tags.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json +3 -13
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json +4 -12
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json +2 -10
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json +1 -7
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json +1 -7
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json +0 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json +3 -10
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json +3 -11
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/platform_win.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json +3 -13
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.py +0 -5
- data/vendor/depot_tools/recipes/recipe_modules/git_cl/__init__.py +1 -1
- data/vendor/depot_tools/recipes/recipe_modules/git_cl/api.py +7 -13
- data/vendor/depot_tools/recipes/recipe_modules/git_cl/examples/full.expected/basic.json +21 -16
- data/vendor/depot_tools/recipes/recipe_modules/git_cl/examples/full.py +1 -2
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/api.py +1 -1
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/examples/full.expected/basic.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/resources/gerrit_client.py +2 -2
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.expected/basic.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/gsutil/api.py +23 -8
- data/vendor/depot_tools/recipes/recipe_modules/gsutil/examples/full.expected/basic.json +52 -1
- data/vendor/depot_tools/recipes/recipe_modules/gsutil/examples/full.py +15 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/__init__.py +1 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/api.py +32 -8
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/ancient_version.json +83 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/automatic_version.json +83 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/explicit_version.json +83 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/linux.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/mac.json +5 -4
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/win.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.py +21 -2
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/__init__.py +20 -0
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/api.py +235 -3
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/examples/full.expected/basic.json +13 -5
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/examples/full.py +5 -1
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/properties.proto +14 -0
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/test_api.py +19 -0
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/tests/execute.py +247 -0
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/tests/prepare.py +49 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/api.py +33 -45
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/basic_tags.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json +64 -21
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch_and_target_ref.json +64 -21
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +1 -22
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch_new.json +1 -22
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.py +5 -32
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/tests/gerrit_change_fetch_ref_timeout.py +29 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.expected/basic.json +5 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py +22 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/tests/gerrit_change_target_ref.py +32 -0
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/linux.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/mac.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/win.json +2 -1
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.py +1 -6
- data/vendor/depot_tools/recipes/recipes.py +49 -28
- data/vendor/depot_tools/recipes/recipes/fetch_end_to_end_test.expected/basic.json +11 -6
- data/vendor/depot_tools/repo +698 -540
- data/vendor/depot_tools/roll-dep +14 -1
- data/vendor/depot_tools/roll-dep.bat +10 -1
- data/vendor/depot_tools/roll_dep.py +15 -10
- data/vendor/depot_tools/scm.py +95 -75
- data/vendor/depot_tools/setup_color.py +36 -2
- data/vendor/depot_tools/split_cl.py +44 -32
- data/vendor/depot_tools/subcommand.py +6 -6
- data/vendor/depot_tools/subprocess2.py +38 -322
- data/vendor/depot_tools/third_party/colorama/LICENSE.txt +0 -1
- data/vendor/depot_tools/third_party/colorama/README.chromium +4 -5
- data/vendor/depot_tools/third_party/colorama/README.rst +346 -0
- data/vendor/depot_tools/third_party/colorama/__init__.py +3 -4
- data/vendor/depot_tools/third_party/colorama/ansi.py +82 -30
- data/vendor/depot_tools/third_party/colorama/ansitowin32.py +105 -37
- data/vendor/depot_tools/third_party/colorama/initialise.py +39 -15
- data/vendor/depot_tools/third_party/colorama/win32.py +46 -28
- data/vendor/depot_tools/third_party/colorama/winterm.py +80 -31
- data/vendor/depot_tools/update_depot_tools +18 -8
- data/vendor/depot_tools/update_depot_tools.bat +19 -15
- data/vendor/depot_tools/upload_metrics.py +7 -6
- data/vendor/depot_tools/upload_to_google_storage.py +23 -16
- data/vendor/depot_tools/vpython +4 -4
- data/vendor/depot_tools/vpython.bat +1 -1
- data/vendor/depot_tools/vpython3 +55 -0
- data/vendor/depot_tools/vpython3.bat +12 -0
- data/vendor/depot_tools/watchlists.py +14 -11
- data/vendor/depot_tools/weekly +4 -2
- data/vendor/depot_tools/win32imports.py +61 -0
- data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +49 -41
- data/vendor/depot_tools/win_toolchain/package_from_installed.py +142 -149
- data/vendor/depot_tools/wtf +5 -3
- data/vendor/depot_tools/yapf +5 -1
- metadata +68 -343
- data/vendor/depot_tools/README.testing +0 -23
- data/vendor/depot_tools/annotated_gclient.py +0 -89
- data/vendor/depot_tools/appengine_mapper.py +0 -23
- data/vendor/depot_tools/bootstrap/win/manifest.txt +0 -20
- data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +0 -20
- data/vendor/depot_tools/bootstrap/win/pylint.new.bat +0 -7
- data/vendor/depot_tools/buildbucket.py +0 -186
- data/vendor/depot_tools/checkout.py +0 -431
- data/vendor/depot_tools/cros +0 -1
- data/vendor/depot_tools/dart_format.py +0 -58
- data/vendor/depot_tools/depot-tools-auth +0 -8
- data/vendor/depot_tools/depot-tools-auth.py +0 -102
- data/vendor/depot_tools/my_reviews.py +0 -396
- data/vendor/depot_tools/patch.py +0 -548
- data/vendor/depot_tools/pylint.py +0 -30
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/buildbot.json +0 -239
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_luci.json +0 -222
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/__init__.py +0 -4
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/api.py +0 -29
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/basic.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_linux.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_mac.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_win.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_linux.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_mac.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_win.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_linux.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_mac.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_win.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.py +0 -33
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/path_config.py +0 -66
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/set_failure_hash_with_no_steps.json +0 -11
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json +0 -45
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json +0 -45
- data/vendor/depot_tools/rietveld.py +0 -779
- data/vendor/depot_tools/roll-dep-svn +0 -8
- data/vendor/depot_tools/roll-dep-svn.bat +0 -12
- data/vendor/depot_tools/roll_dep_svn.py +0 -430
- data/vendor/depot_tools/support/chromite_wrapper +0 -96
- data/vendor/depot_tools/third_party/boto/LICENSE +0 -18
- data/vendor/depot_tools/third_party/boto/README.chromium +0 -43
- data/vendor/depot_tools/third_party/boto/README.rst +0 -163
- data/vendor/depot_tools/third_party/boto/__init__.py +0 -793
- data/vendor/depot_tools/third_party/boto/auth.py +0 -682
- data/vendor/depot_tools/third_party/boto/auth_handler.py +0 -58
- data/vendor/depot_tools/third_party/boto/cacerts/__init__.py +0 -22
- data/vendor/depot_tools/third_party/boto/cacerts/cacerts.txt +0 -2183
- data/vendor/depot_tools/third_party/boto/compat.py +0 -28
- data/vendor/depot_tools/third_party/boto/connection.py +0 -1081
- data/vendor/depot_tools/third_party/boto/contrib/__init__.py +0 -22
- data/vendor/depot_tools/third_party/boto/contrib/ymlmessage.py +0 -52
- data/vendor/depot_tools/third_party/boto/core/README +0 -58
- data/vendor/depot_tools/third_party/boto/core/__init__.py +0 -23
- data/vendor/depot_tools/third_party/boto/core/auth.py +0 -78
- data/vendor/depot_tools/third_party/boto/core/credentials.py +0 -154
- data/vendor/depot_tools/third_party/boto/core/dictresponse.py +0 -178
- data/vendor/depot_tools/third_party/boto/core/service.py +0 -67
- data/vendor/depot_tools/third_party/boto/datapipeline/__init__.py +0 -0
- data/vendor/depot_tools/third_party/boto/datapipeline/exceptions.py +0 -42
- data/vendor/depot_tools/third_party/boto/datapipeline/layer1.py +0 -546
- data/vendor/depot_tools/third_party/boto/ecs/__init__.py +0 -90
- data/vendor/depot_tools/third_party/boto/ecs/item.py +0 -153
- data/vendor/depot_tools/third_party/boto/exception.py +0 -476
- data/vendor/depot_tools/third_party/boto/file/README +0 -49
- data/vendor/depot_tools/third_party/boto/file/__init__.py +0 -28
- data/vendor/depot_tools/third_party/boto/file/bucket.py +0 -112
- data/vendor/depot_tools/third_party/boto/file/connection.py +0 -33
- data/vendor/depot_tools/third_party/boto/file/key.py +0 -199
- data/vendor/depot_tools/third_party/boto/file/simpleresultset.py +0 -30
- data/vendor/depot_tools/third_party/boto/fps/__init__.py +0 -21
- data/vendor/depot_tools/third_party/boto/fps/connection.py +0 -369
- data/vendor/depot_tools/third_party/boto/fps/exception.py +0 -344
- data/vendor/depot_tools/third_party/boto/fps/response.py +0 -175
- data/vendor/depot_tools/third_party/boto/gs/__init__.py +0 -22
- data/vendor/depot_tools/third_party/boto/gs/acl.py +0 -304
- data/vendor/depot_tools/third_party/boto/gs/bucket.py +0 -870
- data/vendor/depot_tools/third_party/boto/gs/bucketlistresultset.py +0 -64
- data/vendor/depot_tools/third_party/boto/gs/connection.py +0 -103
- data/vendor/depot_tools/third_party/boto/gs/cors.py +0 -169
- data/vendor/depot_tools/third_party/boto/gs/key.py +0 -704
- data/vendor/depot_tools/third_party/boto/gs/resumable_upload_handler.py +0 -659
- data/vendor/depot_tools/third_party/boto/gs/user.py +0 -54
- data/vendor/depot_tools/third_party/boto/handler.py +0 -44
- data/vendor/depot_tools/third_party/boto/https_connection.py +0 -124
- data/vendor/depot_tools/third_party/boto/jsonresponse.py +0 -163
- data/vendor/depot_tools/third_party/boto/manage/__init__.py +0 -23
- data/vendor/depot_tools/third_party/boto/manage/cmdshell.py +0 -241
- data/vendor/depot_tools/third_party/boto/manage/propget.py +0 -64
- data/vendor/depot_tools/third_party/boto/manage/server.py +0 -556
- data/vendor/depot_tools/third_party/boto/manage/task.py +0 -175
- data/vendor/depot_tools/third_party/boto/manage/test_manage.py +0 -34
- data/vendor/depot_tools/third_party/boto/manage/volume.py +0 -420
- data/vendor/depot_tools/third_party/boto/mashups/__init__.py +0 -23
- data/vendor/depot_tools/third_party/boto/mashups/interactive.py +0 -97
- data/vendor/depot_tools/third_party/boto/mashups/iobject.py +0 -115
- data/vendor/depot_tools/third_party/boto/mashups/order.py +0 -211
- data/vendor/depot_tools/third_party/boto/mashups/server.py +0 -395
- data/vendor/depot_tools/third_party/boto/plugin.py +0 -90
- data/vendor/depot_tools/third_party/boto/provider.py +0 -337
- data/vendor/depot_tools/third_party/boto/pyami/__init__.py +0 -22
- data/vendor/depot_tools/third_party/boto/pyami/bootstrap.py +0 -134
- data/vendor/depot_tools/third_party/boto/pyami/config.py +0 -229
- data/vendor/depot_tools/third_party/boto/pyami/copybot.cfg +0 -60
- data/vendor/depot_tools/third_party/boto/pyami/copybot.py +0 -97
- data/vendor/depot_tools/third_party/boto/pyami/helloworld.py +0 -28
- data/vendor/depot_tools/third_party/boto/pyami/launch_ami.py +0 -178
- data/vendor/depot_tools/third_party/boto/pyami/scriptbase.py +0 -44
- data/vendor/depot_tools/third_party/boto/pyami/startup.py +0 -60
- data/vendor/depot_tools/third_party/boto/regioninfo.py +0 -63
- data/vendor/depot_tools/third_party/boto/resultset.py +0 -169
- data/vendor/depot_tools/third_party/boto/roboto/__init__.py +0 -1
- data/vendor/depot_tools/third_party/boto/roboto/awsqueryrequest.py +0 -504
- data/vendor/depot_tools/third_party/boto/roboto/awsqueryservice.py +0 -121
- data/vendor/depot_tools/third_party/boto/roboto/param.py +0 -147
- data/vendor/depot_tools/third_party/boto/s3/__init__.py +0 -84
- data/vendor/depot_tools/third_party/boto/s3/acl.py +0 -164
- data/vendor/depot_tools/third_party/boto/s3/bucket.py +0 -1634
- data/vendor/depot_tools/third_party/boto/s3/bucketlistresultset.py +0 -139
- data/vendor/depot_tools/third_party/boto/s3/bucketlogging.py +0 -83
- data/vendor/depot_tools/third_party/boto/s3/connection.py +0 -540
- data/vendor/depot_tools/third_party/boto/s3/cors.py +0 -210
- data/vendor/depot_tools/third_party/boto/s3/deletemarker.py +0 -55
- data/vendor/depot_tools/third_party/boto/s3/key.py +0 -1712
- data/vendor/depot_tools/third_party/boto/s3/keyfile.py +0 -134
- data/vendor/depot_tools/third_party/boto/s3/lifecycle.py +0 -231
- data/vendor/depot_tools/third_party/boto/s3/multidelete.py +0 -138
- data/vendor/depot_tools/third_party/boto/s3/multipart.py +0 -315
- data/vendor/depot_tools/third_party/boto/s3/prefix.py +0 -42
- data/vendor/depot_tools/third_party/boto/s3/resumable_download_handler.py +0 -339
- data/vendor/depot_tools/third_party/boto/s3/tagging.py +0 -71
- data/vendor/depot_tools/third_party/boto/s3/user.py +0 -49
- data/vendor/depot_tools/third_party/boto/s3/website.py +0 -237
- data/vendor/depot_tools/third_party/boto/services/__init__.py +0 -23
- data/vendor/depot_tools/third_party/boto/services/bs.py +0 -179
- data/vendor/depot_tools/third_party/boto/services/message.py +0 -58
- data/vendor/depot_tools/third_party/boto/services/result.py +0 -136
- data/vendor/depot_tools/third_party/boto/services/service.py +0 -161
- data/vendor/depot_tools/third_party/boto/services/servicedef.py +0 -91
- data/vendor/depot_tools/third_party/boto/services/sonofmmm.cfg +0 -43
- data/vendor/depot_tools/third_party/boto/services/sonofmmm.py +0 -81
- data/vendor/depot_tools/third_party/boto/services/submit.py +0 -88
- data/vendor/depot_tools/third_party/boto/ses/__init__.py +0 -54
- data/vendor/depot_tools/third_party/boto/ses/connection.py +0 -521
- data/vendor/depot_tools/third_party/boto/ses/exceptions.py +0 -77
- data/vendor/depot_tools/third_party/boto/storage_uri.py +0 -835
- data/vendor/depot_tools/third_party/boto/sts/__init__.py +0 -55
- data/vendor/depot_tools/third_party/boto/sts/connection.py +0 -207
- data/vendor/depot_tools/third_party/boto/sts/credentials.py +0 -215
- data/vendor/depot_tools/third_party/boto/utils.py +0 -927
- data/vendor/depot_tools/third_party/colorama/README.txt +0 -304
- data/vendor/depot_tools/third_party/fancy_urllib/README +0 -22
- data/vendor/depot_tools/third_party/fancy_urllib/__init__.py +0 -460
- data/vendor/depot_tools/third_party/logilab/README.chromium +0 -6
- data/vendor/depot_tools/third_party/logilab/__init__.py +0 -0
- data/vendor/depot_tools/third_party/logilab/astroid/LICENSE.txt +0 -340
- data/vendor/depot_tools/third_party/logilab/astroid/README.chromium +0 -11
- data/vendor/depot_tools/third_party/logilab/astroid/__init__.py +0 -136
- data/vendor/depot_tools/third_party/logilab/astroid/__pkginfo__.py +0 -42
- data/vendor/depot_tools/third_party/logilab/astroid/arguments.py +0 -233
- data/vendor/depot_tools/third_party/logilab/astroid/as_string.py +0 -548
- data/vendor/depot_tools/third_party/logilab/astroid/astpeephole.py +0 -86
- data/vendor/depot_tools/third_party/logilab/astroid/bases.py +0 -636
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_builtin_inference.py +0 -336
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_dateutil.py +0 -15
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_gi.py +0 -195
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_mechanize.py +0 -18
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_nose.py +0 -82
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_numpy.py +0 -62
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_pytest.py +0 -76
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_qt.py +0 -44
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_six.py +0 -288
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_ssl.py +0 -65
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_stdlib.py +0 -473
- data/vendor/depot_tools/third_party/logilab/astroid/builder.py +0 -263
- data/vendor/depot_tools/third_party/logilab/astroid/context.py +0 -81
- data/vendor/depot_tools/third_party/logilab/astroid/decorators.py +0 -75
- data/vendor/depot_tools/third_party/logilab/astroid/exceptions.py +0 -71
- data/vendor/depot_tools/third_party/logilab/astroid/inference.py +0 -359
- data/vendor/depot_tools/third_party/logilab/astroid/manager.py +0 -267
- data/vendor/depot_tools/third_party/logilab/astroid/mixins.py +0 -147
- data/vendor/depot_tools/third_party/logilab/astroid/modutils.py +0 -741
- data/vendor/depot_tools/third_party/logilab/astroid/node_classes.py +0 -1053
- data/vendor/depot_tools/third_party/logilab/astroid/nodes.py +0 -87
- data/vendor/depot_tools/third_party/logilab/astroid/objects.py +0 -186
- data/vendor/depot_tools/third_party/logilab/astroid/protocols.py +0 -470
- data/vendor/depot_tools/third_party/logilab/astroid/raw_building.py +0 -390
- data/vendor/depot_tools/third_party/logilab/astroid/rebuilder.py +0 -989
- data/vendor/depot_tools/third_party/logilab/astroid/scoped_nodes.py +0 -1716
- data/vendor/depot_tools/third_party/logilab/astroid/test_utils.py +0 -201
- data/vendor/depot_tools/third_party/logilab/astroid/transforms.py +0 -96
- data/vendor/depot_tools/third_party/logilab/astroid/util.py +0 -89
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/LICENSE +0 -19
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/README.chromium +0 -11
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/__init__.py +0 -20
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/cext.c +0 -1421
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/compat.py +0 -9
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/simple.py +0 -246
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/slots.py +0 -414
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/utils.py +0 -13
- data/vendor/depot_tools/third_party/logilab/wrapt/LICENSE +0 -24
- data/vendor/depot_tools/third_party/logilab/wrapt/README.chromium +0 -11
- data/vendor/depot_tools/third_party/logilab/wrapt/__init__.py +0 -19
- data/vendor/depot_tools/third_party/logilab/wrapt/_wrappers.c +0 -2729
- data/vendor/depot_tools/third_party/logilab/wrapt/arguments.py +0 -96
- data/vendor/depot_tools/third_party/logilab/wrapt/decorators.py +0 -512
- data/vendor/depot_tools/third_party/logilab/wrapt/importer.py +0 -228
- data/vendor/depot_tools/third_party/logilab/wrapt/wrappers.py +0 -901
- data/vendor/depot_tools/third_party/mock/LICENSE.txt +0 -26
- data/vendor/depot_tools/third_party/mock/README.chromium +0 -24
- data/vendor/depot_tools/third_party/mock/__init__.py +0 -2366
- data/vendor/depot_tools/third_party/oauth2client/LICENSE +0 -202
- data/vendor/depot_tools/third_party/oauth2client/MODIFICATIONS.diff +0 -66
- data/vendor/depot_tools/third_party/oauth2client/README.chromium +0 -15
- data/vendor/depot_tools/third_party/oauth2client/__init__.py +0 -5
- data/vendor/depot_tools/third_party/oauth2client/anyjson.py +0 -32
- data/vendor/depot_tools/third_party/oauth2client/appengine.py +0 -963
- data/vendor/depot_tools/third_party/oauth2client/client.py +0 -1363
- data/vendor/depot_tools/third_party/oauth2client/clientsecrets.py +0 -153
- data/vendor/depot_tools/third_party/oauth2client/crypt.py +0 -377
- data/vendor/depot_tools/third_party/oauth2client/django_orm.py +0 -134
- data/vendor/depot_tools/third_party/oauth2client/file.py +0 -124
- data/vendor/depot_tools/third_party/oauth2client/gce.py +0 -90
- data/vendor/depot_tools/third_party/oauth2client/keyring_storage.py +0 -109
- data/vendor/depot_tools/third_party/oauth2client/locked_file.py +0 -373
- data/vendor/depot_tools/third_party/oauth2client/multistore_file.py +0 -465
- data/vendor/depot_tools/third_party/oauth2client/old_run.py +0 -160
- data/vendor/depot_tools/third_party/oauth2client/tools.py +0 -243
- data/vendor/depot_tools/third_party/oauth2client/util.py +0 -196
- data/vendor/depot_tools/third_party/oauth2client/xsrfutil.py +0 -113
- data/vendor/depot_tools/third_party/protobuf26/README.chromium +0 -23
- data/vendor/depot_tools/third_party/protobuf26/__init__.py +0 -0
- data/vendor/depot_tools/third_party/protobuf26/compiler/__init__.py +0 -0
- data/vendor/depot_tools/third_party/protobuf26/compiler/plugin_pb2.py +0 -184
- data/vendor/depot_tools/third_party/protobuf26/descriptor.py +0 -849
- data/vendor/depot_tools/third_party/protobuf26/descriptor_database.py +0 -137
- data/vendor/depot_tools/third_party/protobuf26/descriptor_pb2.py +0 -1522
- data/vendor/depot_tools/third_party/protobuf26/descriptor_pool.py +0 -643
- data/vendor/depot_tools/third_party/protobuf26/internal/__init__.py +0 -0
- data/vendor/depot_tools/third_party/protobuf26/internal/api_implementation.py +0 -89
- data/vendor/depot_tools/third_party/protobuf26/internal/containers.py +0 -269
- data/vendor/depot_tools/third_party/protobuf26/internal/cpp_message.py +0 -663
- data/vendor/depot_tools/third_party/protobuf26/internal/decoder.py +0 -831
- data/vendor/depot_tools/third_party/protobuf26/internal/encoder.py +0 -788
- data/vendor/depot_tools/third_party/protobuf26/internal/enum_type_wrapper.py +0 -89
- data/vendor/depot_tools/third_party/protobuf26/internal/message_listener.py +0 -78
- data/vendor/depot_tools/third_party/protobuf26/internal/python_message.py +0 -1247
- data/vendor/depot_tools/third_party/protobuf26/internal/type_checkers.py +0 -328
- data/vendor/depot_tools/third_party/protobuf26/internal/wire_format.py +0 -268
- data/vendor/depot_tools/third_party/protobuf26/message.py +0 -284
- data/vendor/depot_tools/third_party/protobuf26/message_factory.py +0 -155
- data/vendor/depot_tools/third_party/protobuf26/reflection.py +0 -205
- data/vendor/depot_tools/third_party/protobuf26/service.py +0 -226
- data/vendor/depot_tools/third_party/protobuf26/service_reflection.py +0 -284
- data/vendor/depot_tools/third_party/protobuf26/symbol_database.py +0 -185
- data/vendor/depot_tools/third_party/protobuf26/text_encoding.py +0 -110
- data/vendor/depot_tools/third_party/protobuf26/text_format.py +0 -873
- data/vendor/depot_tools/third_party/pylint.py +0 -37
- data/vendor/depot_tools/third_party/pylint/LICENSE.txt +0 -340
- data/vendor/depot_tools/third_party/pylint/README.chromium +0 -30
- data/vendor/depot_tools/third_party/pylint/__init__.py +0 -46
- data/vendor/depot_tools/third_party/pylint/__main__.py +0 -3
- data/vendor/depot_tools/third_party/pylint/__pkginfo__.py +0 -80
- data/vendor/depot_tools/third_party/pylint/checkers/__init__.py +0 -123
- data/vendor/depot_tools/third_party/pylint/checkers/async.py +0 -82
- data/vendor/depot_tools/third_party/pylint/checkers/base.py +0 -2010
- data/vendor/depot_tools/third_party/pylint/checkers/classes.py +0 -1120
- data/vendor/depot_tools/third_party/pylint/checkers/design_analysis.py +0 -348
- data/vendor/depot_tools/third_party/pylint/checkers/exceptions.py +0 -369
- data/vendor/depot_tools/third_party/pylint/checkers/format.py +0 -993
- data/vendor/depot_tools/third_party/pylint/checkers/imports.py +0 -654
- data/vendor/depot_tools/third_party/pylint/checkers/logging.py +0 -258
- data/vendor/depot_tools/third_party/pylint/checkers/misc.py +0 -105
- data/vendor/depot_tools/third_party/pylint/checkers/newstyle.py +0 -169
- data/vendor/depot_tools/third_party/pylint/checkers/python3.py +0 -591
- data/vendor/depot_tools/third_party/pylint/checkers/raw_metrics.py +0 -129
- data/vendor/depot_tools/third_party/pylint/checkers/similar.py +0 -371
- data/vendor/depot_tools/third_party/pylint/checkers/spelling.py +0 -264
- data/vendor/depot_tools/third_party/pylint/checkers/stdlib.py +0 -280
- data/vendor/depot_tools/third_party/pylint/checkers/strings.py +0 -618
- data/vendor/depot_tools/third_party/pylint/checkers/typecheck.py +0 -974
- data/vendor/depot_tools/third_party/pylint/checkers/utils.py +0 -741
- data/vendor/depot_tools/third_party/pylint/checkers/variables.py +0 -1191
- data/vendor/depot_tools/third_party/pylint/config.py +0 -820
- data/vendor/depot_tools/third_party/pylint/epylint.py +0 -181
- data/vendor/depot_tools/third_party/pylint/extensions/__init__.py +0 -0
- data/vendor/depot_tools/third_party/pylint/extensions/check_docs.py +0 -311
- data/vendor/depot_tools/third_party/pylint/extensions/check_elif.py +0 -62
- data/vendor/depot_tools/third_party/pylint/graph.py +0 -179
- data/vendor/depot_tools/third_party/pylint/gui.py +0 -531
- data/vendor/depot_tools/third_party/pylint/interfaces.py +0 -102
- data/vendor/depot_tools/third_party/pylint/lint.py +0 -1381
- data/vendor/depot_tools/third_party/pylint/pyreverse/__init__.py +0 -5
- data/vendor/depot_tools/third_party/pylint/pyreverse/diadefslib.py +0 -230
- data/vendor/depot_tools/third_party/pylint/pyreverse/diagrams.py +0 -258
- data/vendor/depot_tools/third_party/pylint/pyreverse/inspector.py +0 -372
- data/vendor/depot_tools/third_party/pylint/pyreverse/main.py +0 -147
- data/vendor/depot_tools/third_party/pylint/pyreverse/utils.py +0 -210
- data/vendor/depot_tools/third_party/pylint/pyreverse/vcgutils.py +0 -198
- data/vendor/depot_tools/third_party/pylint/pyreverse/writer.py +0 -198
- data/vendor/depot_tools/third_party/pylint/reporters/__init__.py +0 -149
- data/vendor/depot_tools/third_party/pylint/reporters/guireporter.py +0 -27
- data/vendor/depot_tools/third_party/pylint/reporters/html.py +0 -108
- data/vendor/depot_tools/third_party/pylint/reporters/json.py +0 -64
- data/vendor/depot_tools/third_party/pylint/reporters/text.py +0 -237
- data/vendor/depot_tools/third_party/pylint/reporters/ureports/__init__.py +0 -106
- data/vendor/depot_tools/third_party/pylint/reporters/ureports/html_writer.py +0 -93
- data/vendor/depot_tools/third_party/pylint/reporters/ureports/nodes.py +0 -181
- data/vendor/depot_tools/third_party/pylint/reporters/ureports/text_writer.py +0 -99
- data/vendor/depot_tools/third_party/pylint/testutils.py +0 -414
- data/vendor/depot_tools/third_party/pylint/utils.py +0 -1148
- data/vendor/depot_tools/third_party/pymox/COPYING +0 -202
- data/vendor/depot_tools/third_party/pymox/MANIFEST.in +0 -5
- data/vendor/depot_tools/third_party/pymox/README +0 -56
- data/vendor/depot_tools/third_party/pymox/__init__.py +0 -0
- data/vendor/depot_tools/third_party/pymox/mox.py +0 -1643
- data/vendor/depot_tools/third_party/pymox/mox_test.py +0 -1708
- data/vendor/depot_tools/third_party/pymox/mox_test_helper.py +0 -76
- data/vendor/depot_tools/third_party/pymox/setup.py +0 -14
- data/vendor/depot_tools/third_party/pymox/stubout.py +0 -142
- data/vendor/depot_tools/third_party/pymox/stubout_test.py +0 -47
- data/vendor/depot_tools/third_party/pymox/stubout_testee.py +0 -2
- data/vendor/depot_tools/third_party/simplejson/LICENSE.txt +0 -19
- data/vendor/depot_tools/third_party/simplejson/PKG-INFO +0 -29
- data/vendor/depot_tools/third_party/simplejson/__init__.py +0 -437
- data/vendor/depot_tools/third_party/simplejson/decoder.py +0 -421
- data/vendor/depot_tools/third_party/simplejson/encoder.py +0 -501
- data/vendor/depot_tools/third_party/simplejson/ordered_dict.py +0 -119
- data/vendor/depot_tools/third_party/simplejson/scanner.py +0 -77
- data/vendor/depot_tools/third_party/simplejson/tool.py +0 -39
- data/vendor/depot_tools/third_party/upload.py +0 -2565
|
@@ -1,414 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2003-2013 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
|
-
"""functional/non regression tests for pylint"""
|
|
17
|
-
from __future__ import print_function
|
|
18
|
-
|
|
19
|
-
import collections
|
|
20
|
-
import contextlib
|
|
21
|
-
import functools
|
|
22
|
-
from glob import glob
|
|
23
|
-
import os
|
|
24
|
-
from os import linesep, getcwd, sep
|
|
25
|
-
from os.path import abspath, basename, dirname, isdir, join, splitext
|
|
26
|
-
import sys
|
|
27
|
-
import re
|
|
28
|
-
import unittest
|
|
29
|
-
import tempfile
|
|
30
|
-
import tokenize
|
|
31
|
-
|
|
32
|
-
import six
|
|
33
|
-
from six.moves import StringIO
|
|
34
|
-
|
|
35
|
-
import astroid
|
|
36
|
-
from pylint import checkers
|
|
37
|
-
from pylint.utils import PyLintASTWalker
|
|
38
|
-
from pylint.reporters import BaseReporter
|
|
39
|
-
from pylint.interfaces import IReporter
|
|
40
|
-
from pylint.lint import PyLinter
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
# Utils
|
|
45
|
-
|
|
46
|
-
SYS_VERS_STR = '%d%d%d' % sys.version_info[:3]
|
|
47
|
-
TITLE_UNDERLINES = ['', '=', '-', '.']
|
|
48
|
-
PREFIX = abspath(dirname(__file__))
|
|
49
|
-
PY3K = sys.version_info[0] == 3
|
|
50
|
-
|
|
51
|
-
def fix_path():
|
|
52
|
-
sys.path.insert(0, PREFIX)
|
|
53
|
-
|
|
54
|
-
def get_tests_info(input_dir, msg_dir, prefix, suffix):
|
|
55
|
-
"""get python input examples and output messages
|
|
56
|
-
|
|
57
|
-
We use following conventions for input files and messages:
|
|
58
|
-
for different inputs:
|
|
59
|
-
test for python >= x.y -> input = <name>_pyxy.py
|
|
60
|
-
test for python < x.y -> input = <name>_py_xy.py
|
|
61
|
-
for one input and different messages:
|
|
62
|
-
message for python >= x.y -> message = <name>_pyxy.txt
|
|
63
|
-
lower versions -> message with highest num
|
|
64
|
-
"""
|
|
65
|
-
result = []
|
|
66
|
-
for fname in glob(join(input_dir, prefix + '*' + suffix)):
|
|
67
|
-
infile = basename(fname)
|
|
68
|
-
fbase = splitext(infile)[0]
|
|
69
|
-
# filter input files :
|
|
70
|
-
pyrestr = fbase.rsplit('_py', 1)[-1] # like _26 or 26
|
|
71
|
-
if pyrestr.isdigit(): # '24', '25'...
|
|
72
|
-
if SYS_VERS_STR < pyrestr:
|
|
73
|
-
continue
|
|
74
|
-
if pyrestr.startswith('_') and pyrestr[1:].isdigit():
|
|
75
|
-
# skip test for higher python versions
|
|
76
|
-
if SYS_VERS_STR >= pyrestr[1:]:
|
|
77
|
-
continue
|
|
78
|
-
messages = glob(join(msg_dir, fbase + '*.txt'))
|
|
79
|
-
# the last one will be without ext, i.e. for all or upper versions:
|
|
80
|
-
if messages:
|
|
81
|
-
for outfile in sorted(messages, reverse=True):
|
|
82
|
-
py_rest = outfile.rsplit('_py', 1)[-1][:-4]
|
|
83
|
-
if py_rest.isdigit() and SYS_VERS_STR >= py_rest:
|
|
84
|
-
break
|
|
85
|
-
else:
|
|
86
|
-
# This will provide an error message indicating the missing filename.
|
|
87
|
-
outfile = join(msg_dir, fbase + '.txt')
|
|
88
|
-
result.append((infile, outfile))
|
|
89
|
-
return result
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
class TestReporter(BaseReporter):
|
|
93
|
-
"""reporter storing plain text messages"""
|
|
94
|
-
|
|
95
|
-
__implements__ = IReporter
|
|
96
|
-
|
|
97
|
-
def __init__(self): # pylint: disable=super-init-not-called
|
|
98
|
-
|
|
99
|
-
self.message_ids = {}
|
|
100
|
-
self.reset()
|
|
101
|
-
self.path_strip_prefix = getcwd() + sep
|
|
102
|
-
|
|
103
|
-
def reset(self):
|
|
104
|
-
self.out = StringIO()
|
|
105
|
-
self.messages = []
|
|
106
|
-
|
|
107
|
-
def add_message(self, msg_id, location, msg):
|
|
108
|
-
"""manage message of different type and in the context of path """
|
|
109
|
-
_, _, obj, line, _ = location
|
|
110
|
-
self.message_ids[msg_id] = 1
|
|
111
|
-
if obj:
|
|
112
|
-
obj = ':%s' % obj
|
|
113
|
-
sigle = msg_id[0]
|
|
114
|
-
if PY3K and linesep != '\n':
|
|
115
|
-
# 2to3 writes os.linesep instead of using
|
|
116
|
-
# the previosly used line separators
|
|
117
|
-
msg = msg.replace('\r\n', '\n')
|
|
118
|
-
self.messages.append('%s:%3s%s: %s' % (sigle, line, obj, msg))
|
|
119
|
-
|
|
120
|
-
def finalize(self):
|
|
121
|
-
self.messages.sort()
|
|
122
|
-
for msg in self.messages:
|
|
123
|
-
print(msg, file=self.out)
|
|
124
|
-
result = self.out.getvalue()
|
|
125
|
-
self.reset()
|
|
126
|
-
return result
|
|
127
|
-
|
|
128
|
-
def display_reports(self, layout):
|
|
129
|
-
"""ignore layouts"""
|
|
130
|
-
|
|
131
|
-
_display = None
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
class Message(collections.namedtuple('Message',
|
|
135
|
-
['msg_id', 'line', 'node', 'args'])):
|
|
136
|
-
def __new__(cls, msg_id, line=None, node=None, args=None):
|
|
137
|
-
return tuple.__new__(cls, (msg_id, line, node, args))
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
class UnittestLinter(object):
|
|
141
|
-
"""A fake linter class to capture checker messages."""
|
|
142
|
-
# pylint: disable=unused-argument, no-self-use
|
|
143
|
-
|
|
144
|
-
def __init__(self):
|
|
145
|
-
self._messages = []
|
|
146
|
-
self.stats = {}
|
|
147
|
-
|
|
148
|
-
def release_messages(self):
|
|
149
|
-
try:
|
|
150
|
-
return self._messages
|
|
151
|
-
finally:
|
|
152
|
-
self._messages = []
|
|
153
|
-
|
|
154
|
-
def add_message(self, msg_id, line=None, node=None, args=None,
|
|
155
|
-
confidence=None):
|
|
156
|
-
self._messages.append(Message(msg_id, line, node, args))
|
|
157
|
-
|
|
158
|
-
def is_message_enabled(self, *unused_args):
|
|
159
|
-
return True
|
|
160
|
-
|
|
161
|
-
def add_stats(self, **kwargs):
|
|
162
|
-
for name, value in six.iteritems(kwargs):
|
|
163
|
-
self.stats[name] = value
|
|
164
|
-
return self.stats
|
|
165
|
-
|
|
166
|
-
@property
|
|
167
|
-
def options_providers(self):
|
|
168
|
-
return linter.options_providers
|
|
169
|
-
|
|
170
|
-
def set_config(**kwargs):
|
|
171
|
-
"""Decorator for setting config values on a checker."""
|
|
172
|
-
def _wrapper(fun):
|
|
173
|
-
@functools.wraps(fun)
|
|
174
|
-
def _forward(self):
|
|
175
|
-
for key, value in six.iteritems(kwargs):
|
|
176
|
-
setattr(self.checker.config, key, value)
|
|
177
|
-
if isinstance(self, CheckerTestCase):
|
|
178
|
-
# reopen checker in case, it may be interested in configuration change
|
|
179
|
-
self.checker.open()
|
|
180
|
-
fun(self)
|
|
181
|
-
|
|
182
|
-
return _forward
|
|
183
|
-
return _wrapper
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
class CheckerTestCase(unittest.TestCase):
|
|
187
|
-
"""A base testcase class for unittesting individual checker classes."""
|
|
188
|
-
CHECKER_CLASS = None
|
|
189
|
-
CONFIG = {}
|
|
190
|
-
|
|
191
|
-
def setUp(self):
|
|
192
|
-
self.linter = UnittestLinter()
|
|
193
|
-
self.checker = self.CHECKER_CLASS(self.linter) # pylint: disable=not-callable
|
|
194
|
-
for key, value in six.iteritems(self.CONFIG):
|
|
195
|
-
setattr(self.checker.config, key, value)
|
|
196
|
-
self.checker.open()
|
|
197
|
-
|
|
198
|
-
@contextlib.contextmanager
|
|
199
|
-
def assertNoMessages(self):
|
|
200
|
-
"""Assert that no messages are added by the given method."""
|
|
201
|
-
with self.assertAddsMessages():
|
|
202
|
-
yield
|
|
203
|
-
|
|
204
|
-
@contextlib.contextmanager
|
|
205
|
-
def assertAddsMessages(self, *messages):
|
|
206
|
-
"""Assert that exactly the given method adds the given messages.
|
|
207
|
-
|
|
208
|
-
The list of messages must exactly match *all* the messages added by the
|
|
209
|
-
method. Additionally, we check to see whether the args in each message can
|
|
210
|
-
actually be substituted into the message string.
|
|
211
|
-
"""
|
|
212
|
-
yield
|
|
213
|
-
got = self.linter.release_messages()
|
|
214
|
-
msg = ('Expected messages did not match actual.\n'
|
|
215
|
-
'Expected:\n%s\nGot:\n%s' % ('\n'.join(repr(m) for m in messages),
|
|
216
|
-
'\n'.join(repr(m) for m in got)))
|
|
217
|
-
self.assertEqual(list(messages), got, msg)
|
|
218
|
-
|
|
219
|
-
def walk(self, node):
|
|
220
|
-
"""recursive walk on the given node"""
|
|
221
|
-
walker = PyLintASTWalker(linter)
|
|
222
|
-
walker.add_checker(self.checker)
|
|
223
|
-
walker.walk(node)
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
# Init
|
|
227
|
-
test_reporter = TestReporter()
|
|
228
|
-
linter = PyLinter()
|
|
229
|
-
linter.set_reporter(test_reporter)
|
|
230
|
-
linter.config.persistent = 0
|
|
231
|
-
checkers.initialize(linter)
|
|
232
|
-
|
|
233
|
-
if linesep != '\n':
|
|
234
|
-
LINE_RGX = re.compile(linesep)
|
|
235
|
-
def ulines(string):
|
|
236
|
-
return LINE_RGX.sub('\n', string)
|
|
237
|
-
else:
|
|
238
|
-
def ulines(string):
|
|
239
|
-
return string
|
|
240
|
-
|
|
241
|
-
INFO_TEST_RGX = re.compile(r'^func_i\d\d\d\d$')
|
|
242
|
-
|
|
243
|
-
def exception_str(self, ex): # pylint: disable=unused-argument
|
|
244
|
-
"""function used to replace default __str__ method of exception instances"""
|
|
245
|
-
return 'in %s\n:: %s' % (ex.file, ', '.join(ex.args))
|
|
246
|
-
|
|
247
|
-
# Test classes
|
|
248
|
-
|
|
249
|
-
class LintTestUsingModule(unittest.TestCase):
|
|
250
|
-
INPUT_DIR = None
|
|
251
|
-
DEFAULT_PACKAGE = 'input'
|
|
252
|
-
package = DEFAULT_PACKAGE
|
|
253
|
-
linter = linter
|
|
254
|
-
module = None
|
|
255
|
-
depends = None
|
|
256
|
-
output = None
|
|
257
|
-
_TEST_TYPE = 'module'
|
|
258
|
-
maxDiff = None
|
|
259
|
-
|
|
260
|
-
def shortDescription(self):
|
|
261
|
-
values = {'mode' : self._TEST_TYPE,
|
|
262
|
-
'input': self.module,
|
|
263
|
-
'pkg': self.package,
|
|
264
|
-
'cls': self.__class__.__name__}
|
|
265
|
-
|
|
266
|
-
if self.package == self.DEFAULT_PACKAGE:
|
|
267
|
-
msg = '%(mode)s test of input file "%(input)s" (%(cls)s)'
|
|
268
|
-
else:
|
|
269
|
-
msg = '%(mode)s test of input file "%(input)s" in "%(pkg)s" (%(cls)s)'
|
|
270
|
-
return msg % values
|
|
271
|
-
|
|
272
|
-
def test_functionality(self):
|
|
273
|
-
tocheck = [self.package+'.'+self.module]
|
|
274
|
-
# pylint: disable=not-an-iterable; can't handle boolean checks for now
|
|
275
|
-
if self.depends:
|
|
276
|
-
tocheck += [self.package+'.%s' % name.replace('.py', '')
|
|
277
|
-
for name, _ in self.depends]
|
|
278
|
-
self._test(tocheck)
|
|
279
|
-
|
|
280
|
-
def _check_result(self, got):
|
|
281
|
-
self.assertMultiLineEqual(self._get_expected().strip()+'\n',
|
|
282
|
-
got.strip()+'\n')
|
|
283
|
-
|
|
284
|
-
def _test(self, tocheck):
|
|
285
|
-
if INFO_TEST_RGX.match(self.module):
|
|
286
|
-
self.linter.enable('I')
|
|
287
|
-
else:
|
|
288
|
-
self.linter.disable('I')
|
|
289
|
-
try:
|
|
290
|
-
self.linter.check(tocheck)
|
|
291
|
-
except Exception as ex:
|
|
292
|
-
# need finalization to restore a correct state
|
|
293
|
-
self.linter.reporter.finalize()
|
|
294
|
-
ex.file = tocheck
|
|
295
|
-
print(ex)
|
|
296
|
-
ex.__str__ = exception_str
|
|
297
|
-
raise
|
|
298
|
-
self._check_result(self.linter.reporter.finalize())
|
|
299
|
-
|
|
300
|
-
def _has_output(self):
|
|
301
|
-
return not self.module.startswith('func_noerror_')
|
|
302
|
-
|
|
303
|
-
def _get_expected(self):
|
|
304
|
-
if self._has_output() and self.output:
|
|
305
|
-
with open(self.output, 'U') as fobj:
|
|
306
|
-
return fobj.read().strip() + '\n'
|
|
307
|
-
else:
|
|
308
|
-
return ''
|
|
309
|
-
|
|
310
|
-
class LintTestUsingFile(LintTestUsingModule):
|
|
311
|
-
|
|
312
|
-
_TEST_TYPE = 'file'
|
|
313
|
-
|
|
314
|
-
def test_functionality(self):
|
|
315
|
-
importable = join(self.INPUT_DIR, self.module)
|
|
316
|
-
# python also prefers packages over simple modules.
|
|
317
|
-
if not isdir(importable):
|
|
318
|
-
importable += '.py'
|
|
319
|
-
tocheck = [importable]
|
|
320
|
-
# pylint: disable=not-an-iterable; can't handle boolean checks for now
|
|
321
|
-
if self.depends:
|
|
322
|
-
tocheck += [join(self.INPUT_DIR, name) for name, _ in self.depends]
|
|
323
|
-
self._test(tocheck)
|
|
324
|
-
|
|
325
|
-
class LintTestUpdate(LintTestUsingModule):
|
|
326
|
-
|
|
327
|
-
_TEST_TYPE = 'update'
|
|
328
|
-
|
|
329
|
-
def _check_result(self, got):
|
|
330
|
-
if self._has_output():
|
|
331
|
-
try:
|
|
332
|
-
expected = self._get_expected()
|
|
333
|
-
except IOError:
|
|
334
|
-
expected = ''
|
|
335
|
-
if got != expected:
|
|
336
|
-
with open(self.output, 'w') as fobj:
|
|
337
|
-
fobj.write(got)
|
|
338
|
-
|
|
339
|
-
# Callback
|
|
340
|
-
|
|
341
|
-
def cb_test_gen(base_class):
|
|
342
|
-
def call(input_dir, msg_dir, module_file, messages_file, dependencies):
|
|
343
|
-
# pylint: disable=no-init
|
|
344
|
-
class LintTC(base_class):
|
|
345
|
-
module = module_file.replace('.py', '')
|
|
346
|
-
output = messages_file
|
|
347
|
-
depends = dependencies or None
|
|
348
|
-
INPUT_DIR = input_dir
|
|
349
|
-
MSG_DIR = msg_dir
|
|
350
|
-
return LintTC
|
|
351
|
-
return call
|
|
352
|
-
|
|
353
|
-
# Main function
|
|
354
|
-
|
|
355
|
-
def make_tests(input_dir, msg_dir, filter_rgx, callbacks):
|
|
356
|
-
"""generate tests classes from test info
|
|
357
|
-
|
|
358
|
-
return the list of generated test classes
|
|
359
|
-
"""
|
|
360
|
-
if filter_rgx:
|
|
361
|
-
is_to_run = re.compile(filter_rgx).search
|
|
362
|
-
else:
|
|
363
|
-
is_to_run = lambda x: 1
|
|
364
|
-
tests = []
|
|
365
|
-
for module_file, messages_file in (
|
|
366
|
-
get_tests_info(input_dir, msg_dir, 'func_', '')
|
|
367
|
-
):
|
|
368
|
-
if not is_to_run(module_file) or module_file.endswith(('.pyc', "$py.class")):
|
|
369
|
-
continue
|
|
370
|
-
base = module_file.replace('func_', '').replace('.py', '')
|
|
371
|
-
|
|
372
|
-
dependencies = get_tests_info(input_dir, msg_dir, base, '.py')
|
|
373
|
-
|
|
374
|
-
for callback in callbacks:
|
|
375
|
-
test = callback(input_dir, msg_dir, module_file, messages_file,
|
|
376
|
-
dependencies)
|
|
377
|
-
if test:
|
|
378
|
-
tests.append(test)
|
|
379
|
-
return tests
|
|
380
|
-
|
|
381
|
-
def tokenize_str(code):
|
|
382
|
-
return list(tokenize.generate_tokens(StringIO(code).readline))
|
|
383
|
-
|
|
384
|
-
@contextlib.contextmanager
|
|
385
|
-
def create_tempfile(content=None):
|
|
386
|
-
"""Create a new temporary file.
|
|
387
|
-
|
|
388
|
-
If *content* parameter is given, then it will be written
|
|
389
|
-
in the temporary file, before passing it back.
|
|
390
|
-
This is a context manager and should be used with a *with* statement.
|
|
391
|
-
"""
|
|
392
|
-
# Can't use tempfile.NamedTemporaryFile here
|
|
393
|
-
# because on Windows the file must be closed before writing to it,
|
|
394
|
-
# see http://bugs.python.org/issue14243
|
|
395
|
-
file_handle, tmp = tempfile.mkstemp()
|
|
396
|
-
if content:
|
|
397
|
-
if sys.version_info >= (3, 0):
|
|
398
|
-
# erff
|
|
399
|
-
os.write(file_handle, bytes(content, 'ascii'))
|
|
400
|
-
else:
|
|
401
|
-
os.write(file_handle, content)
|
|
402
|
-
try:
|
|
403
|
-
yield tmp
|
|
404
|
-
finally:
|
|
405
|
-
os.close(file_handle)
|
|
406
|
-
os.remove(tmp)
|
|
407
|
-
|
|
408
|
-
@contextlib.contextmanager
|
|
409
|
-
def create_file_backed_module(code):
|
|
410
|
-
"""Create an astroid module for the given code, backed by a real file."""
|
|
411
|
-
with create_tempfile() as temp:
|
|
412
|
-
module = astroid.parse(code)
|
|
413
|
-
module.file = temp
|
|
414
|
-
yield module
|
|
@@ -1,1148 +0,0 @@
|
|
|
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
|
-
"""some various utilities and helper classes, most of them used in the
|
|
17
|
-
main pylint class
|
|
18
|
-
"""
|
|
19
|
-
from __future__ import print_function
|
|
20
|
-
|
|
21
|
-
import collections
|
|
22
|
-
import itertools
|
|
23
|
-
import os
|
|
24
|
-
from os.path import dirname, basename, splitext, exists, isdir, join, normpath
|
|
25
|
-
import re
|
|
26
|
-
import sys
|
|
27
|
-
import tokenize
|
|
28
|
-
import warnings
|
|
29
|
-
import textwrap
|
|
30
|
-
|
|
31
|
-
import six
|
|
32
|
-
from six.moves import zip # pylint: disable=redefined-builtin
|
|
33
|
-
|
|
34
|
-
from astroid import nodes, Module
|
|
35
|
-
from astroid.modutils import modpath_from_file, get_module_files, \
|
|
36
|
-
file_from_modpath, load_module_from_file
|
|
37
|
-
|
|
38
|
-
from pylint.interfaces import IRawChecker, ITokenChecker, UNDEFINED, implements
|
|
39
|
-
from pylint.reporters.ureports.nodes import Section
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class UnknownMessage(Exception):
|
|
43
|
-
"""raised when a unregistered message id is encountered"""
|
|
44
|
-
|
|
45
|
-
class EmptyReport(Exception):
|
|
46
|
-
"""raised when a report is empty and so should not be displayed"""
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
MSG_TYPES = {
|
|
50
|
-
'I' : 'info',
|
|
51
|
-
'C' : 'convention',
|
|
52
|
-
'R' : 'refactor',
|
|
53
|
-
'W' : 'warning',
|
|
54
|
-
'E' : 'error',
|
|
55
|
-
'F' : 'fatal'
|
|
56
|
-
}
|
|
57
|
-
MSG_TYPES_LONG = {v: k for k, v in six.iteritems(MSG_TYPES)}
|
|
58
|
-
|
|
59
|
-
MSG_TYPES_STATUS = {
|
|
60
|
-
'I' : 0,
|
|
61
|
-
'C' : 16,
|
|
62
|
-
'R' : 8,
|
|
63
|
-
'W' : 4,
|
|
64
|
-
'E' : 2,
|
|
65
|
-
'F' : 1
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
DEPRECATED_ALIASES = {
|
|
69
|
-
# New name, deprecated name.
|
|
70
|
-
'repr': 'backquote',
|
|
71
|
-
'expr': 'discard',
|
|
72
|
-
'assignname': 'assname',
|
|
73
|
-
'assignattr': 'assattr',
|
|
74
|
-
'attribute': 'getattr',
|
|
75
|
-
'call': 'callfunc',
|
|
76
|
-
'importfrom': 'from',
|
|
77
|
-
'classdef': 'class',
|
|
78
|
-
'functiondef': 'function',
|
|
79
|
-
'generatorexp': 'genexpr',
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
_MSG_ORDER = 'EWRCIF'
|
|
83
|
-
MSG_STATE_SCOPE_CONFIG = 0
|
|
84
|
-
MSG_STATE_SCOPE_MODULE = 1
|
|
85
|
-
MSG_STATE_CONFIDENCE = 2
|
|
86
|
-
|
|
87
|
-
# Allow stopping after the first semicolon encountered,
|
|
88
|
-
# so that an option can be continued with the reasons
|
|
89
|
-
# why it is active or disabled.
|
|
90
|
-
OPTION_RGX = re.compile(r'\s*#.*\bpylint:\s*([^;]+);{0,1}')
|
|
91
|
-
|
|
92
|
-
# The line/node distinction does not apply to fatal errors and reports.
|
|
93
|
-
_SCOPE_EXEMPT = 'FR'
|
|
94
|
-
|
|
95
|
-
class WarningScope(object):
|
|
96
|
-
LINE = 'line-based-msg'
|
|
97
|
-
NODE = 'node-based-msg'
|
|
98
|
-
|
|
99
|
-
_MsgBase = collections.namedtuple(
|
|
100
|
-
'_MsgBase',
|
|
101
|
-
['msg_id', 'symbol', 'msg', 'C', 'category', 'confidence',
|
|
102
|
-
'abspath', 'path', 'module', 'obj', 'line', 'column'])
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
class Message(_MsgBase):
|
|
106
|
-
"""This class represent a message to be issued by the reporters"""
|
|
107
|
-
def __new__(cls, msg_id, symbol, location, msg, confidence):
|
|
108
|
-
return _MsgBase.__new__(
|
|
109
|
-
cls, msg_id, symbol, msg, msg_id[0], MSG_TYPES[msg_id[0]],
|
|
110
|
-
confidence, *location)
|
|
111
|
-
|
|
112
|
-
def format(self, template):
|
|
113
|
-
"""Format the message according to the given template.
|
|
114
|
-
|
|
115
|
-
The template format is the one of the format method :
|
|
116
|
-
cf. http://docs.python.org/2/library/string.html#formatstrings
|
|
117
|
-
"""
|
|
118
|
-
# For some reason, _asdict on derived namedtuples does not work with
|
|
119
|
-
# Python 3.4. Needs some investigation.
|
|
120
|
-
return template.format(**dict(zip(self._fields, self)))
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
def get_module_and_frameid(node):
|
|
124
|
-
"""return the module name and the frame id in the module"""
|
|
125
|
-
frame = node.frame()
|
|
126
|
-
module, obj = '', []
|
|
127
|
-
while frame:
|
|
128
|
-
if isinstance(frame, Module):
|
|
129
|
-
module = frame.name
|
|
130
|
-
else:
|
|
131
|
-
obj.append(getattr(frame, 'name', '<lambda>'))
|
|
132
|
-
try:
|
|
133
|
-
frame = frame.parent.frame()
|
|
134
|
-
except AttributeError:
|
|
135
|
-
frame = None
|
|
136
|
-
obj.reverse()
|
|
137
|
-
return module, '.'.join(obj)
|
|
138
|
-
|
|
139
|
-
def category_id(cid):
|
|
140
|
-
cid = cid.upper()
|
|
141
|
-
if cid in MSG_TYPES:
|
|
142
|
-
return cid
|
|
143
|
-
return MSG_TYPES_LONG.get(cid)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
def _decoding_readline(stream, encoding):
|
|
147
|
-
return lambda: stream.readline().decode(encoding, 'replace')
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
def tokenize_module(module):
|
|
151
|
-
with module.stream() as stream:
|
|
152
|
-
readline = stream.readline
|
|
153
|
-
if sys.version_info < (3, 0):
|
|
154
|
-
if module.file_encoding is not None:
|
|
155
|
-
readline = _decoding_readline(stream, module.file_encoding)
|
|
156
|
-
|
|
157
|
-
return list(tokenize.generate_tokens(readline))
|
|
158
|
-
return list(tokenize.tokenize(readline))
|
|
159
|
-
|
|
160
|
-
def build_message_def(checker, msgid, msg_tuple):
|
|
161
|
-
if implements(checker, (IRawChecker, ITokenChecker)):
|
|
162
|
-
default_scope = WarningScope.LINE
|
|
163
|
-
else:
|
|
164
|
-
default_scope = WarningScope.NODE
|
|
165
|
-
options = {}
|
|
166
|
-
if len(msg_tuple) > 3:
|
|
167
|
-
(msg, symbol, descr, options) = msg_tuple
|
|
168
|
-
elif len(msg_tuple) > 2:
|
|
169
|
-
(msg, symbol, descr) = msg_tuple[:3]
|
|
170
|
-
else:
|
|
171
|
-
# messages should have a symbol, but for backward compatibility
|
|
172
|
-
# they may not.
|
|
173
|
-
(msg, descr) = msg_tuple
|
|
174
|
-
warnings.warn("[pylint 0.26] description of message %s doesn't include "
|
|
175
|
-
"a symbolic name" % msgid, DeprecationWarning)
|
|
176
|
-
symbol = None
|
|
177
|
-
options.setdefault('scope', default_scope)
|
|
178
|
-
return MessageDefinition(checker, msgid, msg, descr, symbol, **options)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
class MessageDefinition(object):
|
|
182
|
-
def __init__(self, checker, msgid, msg, descr, symbol, scope,
|
|
183
|
-
minversion=None, maxversion=None, old_names=None):
|
|
184
|
-
self.checker = checker
|
|
185
|
-
assert len(msgid) == 5, 'Invalid message id %s' % msgid
|
|
186
|
-
assert msgid[0] in MSG_TYPES, \
|
|
187
|
-
'Bad message type %s in %r' % (msgid[0], msgid)
|
|
188
|
-
self.msgid = msgid
|
|
189
|
-
self.msg = msg
|
|
190
|
-
self.descr = descr
|
|
191
|
-
self.symbol = symbol
|
|
192
|
-
self.scope = scope
|
|
193
|
-
self.minversion = minversion
|
|
194
|
-
self.maxversion = maxversion
|
|
195
|
-
self.old_names = old_names or []
|
|
196
|
-
|
|
197
|
-
def may_be_emitted(self):
|
|
198
|
-
"""return True if message may be emitted using the current interpreter"""
|
|
199
|
-
if self.minversion is not None and self.minversion > sys.version_info:
|
|
200
|
-
return False
|
|
201
|
-
if self.maxversion is not None and self.maxversion <= sys.version_info:
|
|
202
|
-
return False
|
|
203
|
-
return True
|
|
204
|
-
|
|
205
|
-
def format_help(self, checkerref=False):
|
|
206
|
-
"""return the help string for the given message id"""
|
|
207
|
-
desc = self.descr
|
|
208
|
-
if checkerref:
|
|
209
|
-
desc += ' This message belongs to the %s checker.' % \
|
|
210
|
-
self.checker.name
|
|
211
|
-
title = self.msg
|
|
212
|
-
if self.symbol:
|
|
213
|
-
msgid = '%s (%s)' % (self.symbol, self.msgid)
|
|
214
|
-
else:
|
|
215
|
-
msgid = self.msgid
|
|
216
|
-
if self.minversion or self.maxversion:
|
|
217
|
-
restr = []
|
|
218
|
-
if self.minversion:
|
|
219
|
-
restr.append('< %s' % '.'.join([str(n) for n in self.minversion]))
|
|
220
|
-
if self.maxversion:
|
|
221
|
-
restr.append('>= %s' % '.'.join([str(n) for n in self.maxversion]))
|
|
222
|
-
restr = ' or '.join(restr)
|
|
223
|
-
if checkerref:
|
|
224
|
-
desc += " It can't be emitted when using Python %s." % restr
|
|
225
|
-
else:
|
|
226
|
-
desc += " This message can't be emitted when using Python %s." % restr
|
|
227
|
-
desc = _normalize_text(' '.join(desc.split()), indent=' ')
|
|
228
|
-
if title != '%s':
|
|
229
|
-
title = title.splitlines()[0]
|
|
230
|
-
return ':%s: *%s*\n%s' % (msgid, title, desc)
|
|
231
|
-
return ':%s:\n%s' % (msgid, desc)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
class MessagesHandlerMixIn(object):
|
|
235
|
-
"""a mix-in class containing all the messages related methods for the main
|
|
236
|
-
lint class
|
|
237
|
-
"""
|
|
238
|
-
|
|
239
|
-
def __init__(self):
|
|
240
|
-
self._msgs_state = {}
|
|
241
|
-
self.msg_status = 0
|
|
242
|
-
|
|
243
|
-
def _checker_messages(self, checker):
|
|
244
|
-
for checker in self._checkers[checker.lower()]:
|
|
245
|
-
for msgid in checker.msgs:
|
|
246
|
-
yield msgid
|
|
247
|
-
|
|
248
|
-
def disable(self, msgid, scope='package', line=None, ignore_unknown=False):
|
|
249
|
-
"""don't output message of the given id"""
|
|
250
|
-
assert scope in ('package', 'module')
|
|
251
|
-
# handle disable=all by disabling all categories
|
|
252
|
-
if msgid == 'all':
|
|
253
|
-
for msgid in MSG_TYPES:
|
|
254
|
-
self.disable(msgid, scope, line)
|
|
255
|
-
return
|
|
256
|
-
# msgid is a category?
|
|
257
|
-
catid = category_id(msgid)
|
|
258
|
-
if catid is not None:
|
|
259
|
-
for _msgid in self.msgs_store._msgs_by_category.get(catid):
|
|
260
|
-
self.disable(_msgid, scope, line)
|
|
261
|
-
return
|
|
262
|
-
# msgid is a checker name?
|
|
263
|
-
if msgid.lower() in self._checkers:
|
|
264
|
-
msgs_store = self.msgs_store
|
|
265
|
-
for checker in self._checkers[msgid.lower()]:
|
|
266
|
-
for _msgid in checker.msgs:
|
|
267
|
-
if _msgid in msgs_store._alternative_names:
|
|
268
|
-
self.disable(_msgid, scope, line)
|
|
269
|
-
return
|
|
270
|
-
# msgid is report id?
|
|
271
|
-
if msgid.lower().startswith('rp'):
|
|
272
|
-
self.disable_report(msgid)
|
|
273
|
-
return
|
|
274
|
-
|
|
275
|
-
try:
|
|
276
|
-
# msgid is a symbolic or numeric msgid.
|
|
277
|
-
msg = self.msgs_store.check_message_id(msgid)
|
|
278
|
-
except UnknownMessage:
|
|
279
|
-
if ignore_unknown:
|
|
280
|
-
return
|
|
281
|
-
raise
|
|
282
|
-
|
|
283
|
-
if scope == 'module':
|
|
284
|
-
self.file_state.set_msg_status(msg, line, False)
|
|
285
|
-
if msg.symbol != 'locally-disabled':
|
|
286
|
-
self.add_message('locally-disabled', line=line,
|
|
287
|
-
args=(msg.symbol, msg.msgid))
|
|
288
|
-
|
|
289
|
-
else:
|
|
290
|
-
msgs = self._msgs_state
|
|
291
|
-
msgs[msg.msgid] = False
|
|
292
|
-
# sync configuration object
|
|
293
|
-
self.config.disable = [self._message_symbol(mid)
|
|
294
|
-
for mid, val in six.iteritems(msgs)
|
|
295
|
-
if not val]
|
|
296
|
-
|
|
297
|
-
def _message_symbol(self, msgid):
|
|
298
|
-
"""Get the message symbol of the given message id
|
|
299
|
-
|
|
300
|
-
Return the original message id if the message does not
|
|
301
|
-
exist.
|
|
302
|
-
"""
|
|
303
|
-
try:
|
|
304
|
-
return self.msgs_store.check_message_id(msgid).symbol
|
|
305
|
-
except UnknownMessage:
|
|
306
|
-
return msgid
|
|
307
|
-
|
|
308
|
-
def enable(self, msgid, scope='package', line=None, ignore_unknown=False):
|
|
309
|
-
"""reenable message of the given id"""
|
|
310
|
-
assert scope in ('package', 'module')
|
|
311
|
-
if msgid == 'all':
|
|
312
|
-
for msgid_ in MSG_TYPES:
|
|
313
|
-
self.enable(msgid_, scope=scope, line=line)
|
|
314
|
-
if not self._python3_porting_mode:
|
|
315
|
-
# Don't activate the python 3 porting checker if it
|
|
316
|
-
# wasn't activated explicitly.
|
|
317
|
-
self.disable('python3')
|
|
318
|
-
return
|
|
319
|
-
catid = category_id(msgid)
|
|
320
|
-
# msgid is a category?
|
|
321
|
-
if catid is not None:
|
|
322
|
-
for msgid in self.msgs_store._msgs_by_category.get(catid):
|
|
323
|
-
self.enable(msgid, scope, line)
|
|
324
|
-
return
|
|
325
|
-
# msgid is a checker name?
|
|
326
|
-
if msgid.lower() in self._checkers:
|
|
327
|
-
for checker in self._checkers[msgid.lower()]:
|
|
328
|
-
for msgid_ in checker.msgs:
|
|
329
|
-
self.enable(msgid_, scope, line)
|
|
330
|
-
return
|
|
331
|
-
# msgid is report id?
|
|
332
|
-
if msgid.lower().startswith('rp'):
|
|
333
|
-
self.enable_report(msgid)
|
|
334
|
-
return
|
|
335
|
-
|
|
336
|
-
try:
|
|
337
|
-
# msgid is a symbolic or numeric msgid.
|
|
338
|
-
msg = self.msgs_store.check_message_id(msgid)
|
|
339
|
-
except UnknownMessage:
|
|
340
|
-
if ignore_unknown:
|
|
341
|
-
return
|
|
342
|
-
raise
|
|
343
|
-
|
|
344
|
-
if scope == 'module':
|
|
345
|
-
self.file_state.set_msg_status(msg, line, True)
|
|
346
|
-
self.add_message('locally-enabled', line=line, args=(msg.symbol, msg.msgid))
|
|
347
|
-
else:
|
|
348
|
-
msgs = self._msgs_state
|
|
349
|
-
msgs[msg.msgid] = True
|
|
350
|
-
# sync configuration object
|
|
351
|
-
self.config.enable = [mid for mid, val in six.iteritems(msgs) if val]
|
|
352
|
-
|
|
353
|
-
def get_message_state_scope(self, msgid, line=None, confidence=UNDEFINED):
|
|
354
|
-
"""Returns the scope at which a message was enabled/disabled."""
|
|
355
|
-
if self.config.confidence and confidence.name not in self.config.confidence:
|
|
356
|
-
return MSG_STATE_CONFIDENCE
|
|
357
|
-
try:
|
|
358
|
-
if line in self.file_state._module_msgs_state[msgid]:
|
|
359
|
-
return MSG_STATE_SCOPE_MODULE
|
|
360
|
-
except (KeyError, TypeError):
|
|
361
|
-
return MSG_STATE_SCOPE_CONFIG
|
|
362
|
-
|
|
363
|
-
def is_message_enabled(self, msg_descr, line=None, confidence=None):
|
|
364
|
-
"""return true if the message associated to the given message id is
|
|
365
|
-
enabled
|
|
366
|
-
|
|
367
|
-
msgid may be either a numeric or symbolic message id.
|
|
368
|
-
"""
|
|
369
|
-
if self.config.confidence and confidence:
|
|
370
|
-
if confidence.name not in self.config.confidence:
|
|
371
|
-
return False
|
|
372
|
-
try:
|
|
373
|
-
msgid = self.msgs_store.check_message_id(msg_descr).msgid
|
|
374
|
-
except UnknownMessage:
|
|
375
|
-
# The linter checks for messages that are not registered
|
|
376
|
-
# due to version mismatch, just treat them as message IDs
|
|
377
|
-
# for now.
|
|
378
|
-
msgid = msg_descr
|
|
379
|
-
if line is None:
|
|
380
|
-
return self._msgs_state.get(msgid, True)
|
|
381
|
-
try:
|
|
382
|
-
return self.file_state._module_msgs_state[msgid][line]
|
|
383
|
-
except KeyError:
|
|
384
|
-
return self._msgs_state.get(msgid, True)
|
|
385
|
-
|
|
386
|
-
def add_message(self, msg_descr, line=None, node=None, args=None, confidence=UNDEFINED):
|
|
387
|
-
"""Adds a message given by ID or name.
|
|
388
|
-
|
|
389
|
-
If provided, the message string is expanded using args
|
|
390
|
-
|
|
391
|
-
AST checkers should must the node argument (but may optionally
|
|
392
|
-
provide line if the line number is different), raw and token checkers
|
|
393
|
-
must provide the line argument.
|
|
394
|
-
"""
|
|
395
|
-
msg_info = self.msgs_store.check_message_id(msg_descr)
|
|
396
|
-
msgid = msg_info.msgid
|
|
397
|
-
# backward compatibility, message may not have a symbol
|
|
398
|
-
symbol = msg_info.symbol or msgid
|
|
399
|
-
# Fatal messages and reports are special, the node/scope distinction
|
|
400
|
-
# does not apply to them.
|
|
401
|
-
if msgid[0] not in _SCOPE_EXEMPT:
|
|
402
|
-
if msg_info.scope == WarningScope.LINE:
|
|
403
|
-
assert node is None and line is not None, (
|
|
404
|
-
'Message %s must only provide line, got line=%s, node=%s' % (msgid, line, node))
|
|
405
|
-
elif msg_info.scope == WarningScope.NODE:
|
|
406
|
-
# Node-based warnings may provide an override line.
|
|
407
|
-
assert node is not None, 'Message %s must provide Node, got None'
|
|
408
|
-
|
|
409
|
-
if line is None and node is not None:
|
|
410
|
-
line = node.fromlineno
|
|
411
|
-
if hasattr(node, 'col_offset'):
|
|
412
|
-
col_offset = node.col_offset # XXX measured in bytes for utf-8, divide by two for chars?
|
|
413
|
-
else:
|
|
414
|
-
col_offset = None
|
|
415
|
-
# should this message be displayed
|
|
416
|
-
if not self.is_message_enabled(msgid, line, confidence):
|
|
417
|
-
self.file_state.handle_ignored_message(
|
|
418
|
-
self.get_message_state_scope(msgid, line, confidence),
|
|
419
|
-
msgid, line, node, args, confidence)
|
|
420
|
-
return
|
|
421
|
-
# update stats
|
|
422
|
-
msg_cat = MSG_TYPES[msgid[0]]
|
|
423
|
-
self.msg_status |= MSG_TYPES_STATUS[msgid[0]]
|
|
424
|
-
self.stats[msg_cat] += 1
|
|
425
|
-
self.stats['by_module'][self.current_name][msg_cat] += 1
|
|
426
|
-
try:
|
|
427
|
-
self.stats['by_msg'][symbol] += 1
|
|
428
|
-
except KeyError:
|
|
429
|
-
self.stats['by_msg'][symbol] = 1
|
|
430
|
-
# expand message ?
|
|
431
|
-
msg = msg_info.msg
|
|
432
|
-
if args:
|
|
433
|
-
msg %= args
|
|
434
|
-
# get module and object
|
|
435
|
-
if node is None:
|
|
436
|
-
module, obj = self.current_name, ''
|
|
437
|
-
abspath = self.current_file
|
|
438
|
-
else:
|
|
439
|
-
module, obj = get_module_and_frameid(node)
|
|
440
|
-
abspath = node.root().file
|
|
441
|
-
path = abspath.replace(self.reporter.path_strip_prefix, '')
|
|
442
|
-
# add the message
|
|
443
|
-
self.reporter.handle_message(
|
|
444
|
-
Message(msgid, symbol,
|
|
445
|
-
(abspath, path, module, obj, line or 1, col_offset or 0), msg, confidence))
|
|
446
|
-
|
|
447
|
-
def print_full_documentation(self):
|
|
448
|
-
"""output a full documentation in ReST format"""
|
|
449
|
-
print("Pylint global options and switches")
|
|
450
|
-
print("----------------------------------")
|
|
451
|
-
print("")
|
|
452
|
-
print("Pylint provides global options and switches.")
|
|
453
|
-
print("")
|
|
454
|
-
|
|
455
|
-
by_checker = {}
|
|
456
|
-
for checker in self.get_checkers():
|
|
457
|
-
if checker.name == 'master':
|
|
458
|
-
if checker.options:
|
|
459
|
-
for section, options in checker.options_by_section():
|
|
460
|
-
if section is None:
|
|
461
|
-
title = 'General options'
|
|
462
|
-
else:
|
|
463
|
-
title = '%s options' % section.capitalize()
|
|
464
|
-
print(title)
|
|
465
|
-
print('~' * len(title))
|
|
466
|
-
_rest_format_section(sys.stdout, None, options)
|
|
467
|
-
print("")
|
|
468
|
-
else:
|
|
469
|
-
try:
|
|
470
|
-
by_checker[checker.name][0] += checker.options_and_values()
|
|
471
|
-
by_checker[checker.name][1].update(checker.msgs)
|
|
472
|
-
by_checker[checker.name][2] += checker.reports
|
|
473
|
-
except KeyError:
|
|
474
|
-
by_checker[checker.name] = [list(checker.options_and_values()),
|
|
475
|
-
dict(checker.msgs),
|
|
476
|
-
list(checker.reports)]
|
|
477
|
-
|
|
478
|
-
print("Pylint checkers' options and switches")
|
|
479
|
-
print("-------------------------------------")
|
|
480
|
-
print("")
|
|
481
|
-
print("Pylint checkers can provide three set of features:")
|
|
482
|
-
print("")
|
|
483
|
-
print("* options that control their execution,")
|
|
484
|
-
print("* messages that they can raise,")
|
|
485
|
-
print("* reports that they can generate.")
|
|
486
|
-
print("")
|
|
487
|
-
print("Below is a list of all checkers and their features.")
|
|
488
|
-
print("")
|
|
489
|
-
|
|
490
|
-
for checker, (options, msgs, reports) in six.iteritems(by_checker):
|
|
491
|
-
title = '%s checker' % (checker.replace("_", " ").title())
|
|
492
|
-
print(title)
|
|
493
|
-
print('~' * len(title))
|
|
494
|
-
print("")
|
|
495
|
-
print("Verbatim name of the checker is ``%s``." % checker)
|
|
496
|
-
print("")
|
|
497
|
-
if options:
|
|
498
|
-
title = 'Options'
|
|
499
|
-
print(title)
|
|
500
|
-
print('^' * len(title))
|
|
501
|
-
_rest_format_section(sys.stdout, None, options)
|
|
502
|
-
print("")
|
|
503
|
-
if msgs:
|
|
504
|
-
title = 'Messages'
|
|
505
|
-
print(title)
|
|
506
|
-
print('~' * len(title))
|
|
507
|
-
for msgid, msg in sorted(six.iteritems(msgs),
|
|
508
|
-
key=lambda kv: (_MSG_ORDER.index(kv[0][0]), kv[1])):
|
|
509
|
-
msg = build_message_def(checker, msgid, msg)
|
|
510
|
-
print(msg.format_help(checkerref=False))
|
|
511
|
-
print("")
|
|
512
|
-
if reports:
|
|
513
|
-
title = 'Reports'
|
|
514
|
-
print(title)
|
|
515
|
-
print('~' * len(title))
|
|
516
|
-
for report in reports:
|
|
517
|
-
print(':%s: %s' % report[:2])
|
|
518
|
-
print("")
|
|
519
|
-
print("")
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
class FileState(object):
|
|
523
|
-
"""Hold internal state specific to the currently analyzed file"""
|
|
524
|
-
|
|
525
|
-
def __init__(self, modname=None):
|
|
526
|
-
self.base_name = modname
|
|
527
|
-
self._module_msgs_state = {}
|
|
528
|
-
self._raw_module_msgs_state = {}
|
|
529
|
-
self._ignored_msgs = collections.defaultdict(set)
|
|
530
|
-
self._suppression_mapping = {}
|
|
531
|
-
|
|
532
|
-
def collect_block_lines(self, msgs_store, module_node):
|
|
533
|
-
"""Walk the AST to collect block level options line numbers."""
|
|
534
|
-
for msg, lines in six.iteritems(self._module_msgs_state):
|
|
535
|
-
self._raw_module_msgs_state[msg] = lines.copy()
|
|
536
|
-
orig_state = self._module_msgs_state.copy()
|
|
537
|
-
self._module_msgs_state = {}
|
|
538
|
-
self._suppression_mapping = {}
|
|
539
|
-
self._collect_block_lines(msgs_store, module_node, orig_state)
|
|
540
|
-
|
|
541
|
-
def _collect_block_lines(self, msgs_store, node, msg_state):
|
|
542
|
-
"""Recursivly walk (depth first) AST to collect block level options line
|
|
543
|
-
numbers.
|
|
544
|
-
"""
|
|
545
|
-
for child in node.get_children():
|
|
546
|
-
self._collect_block_lines(msgs_store, child, msg_state)
|
|
547
|
-
first = node.fromlineno
|
|
548
|
-
last = node.tolineno
|
|
549
|
-
# first child line number used to distinguish between disable
|
|
550
|
-
# which are the first child of scoped node with those defined later.
|
|
551
|
-
# For instance in the code below:
|
|
552
|
-
#
|
|
553
|
-
# 1. def meth8(self):
|
|
554
|
-
# 2. """test late disabling"""
|
|
555
|
-
# 3. # pylint: disable=E1102
|
|
556
|
-
# 4. print self.blip
|
|
557
|
-
# 5. # pylint: disable=E1101
|
|
558
|
-
# 6. print self.bla
|
|
559
|
-
#
|
|
560
|
-
# E1102 should be disabled from line 1 to 6 while E1101 from line 5 to 6
|
|
561
|
-
#
|
|
562
|
-
# this is necessary to disable locally messages applying to class /
|
|
563
|
-
# function using their fromlineno
|
|
564
|
-
if (isinstance(node, (nodes.Module, nodes.ClassDef, nodes.FunctionDef))
|
|
565
|
-
and node.body):
|
|
566
|
-
firstchildlineno = node.body[0].fromlineno
|
|
567
|
-
else:
|
|
568
|
-
firstchildlineno = last
|
|
569
|
-
for msgid, lines in six.iteritems(msg_state):
|
|
570
|
-
for lineno, state in list(lines.items()):
|
|
571
|
-
original_lineno = lineno
|
|
572
|
-
if first > lineno or last < lineno:
|
|
573
|
-
continue
|
|
574
|
-
# Set state for all lines for this block, if the
|
|
575
|
-
# warning is applied to nodes.
|
|
576
|
-
if msgs_store.check_message_id(msgid).scope == WarningScope.NODE:
|
|
577
|
-
if lineno > firstchildlineno:
|
|
578
|
-
state = True
|
|
579
|
-
first_, last_ = node.block_range(lineno)
|
|
580
|
-
else:
|
|
581
|
-
first_ = lineno
|
|
582
|
-
last_ = last
|
|
583
|
-
for line in range(first_, last_+1):
|
|
584
|
-
# do not override existing entries
|
|
585
|
-
if line in self._module_msgs_state.get(msgid, ()):
|
|
586
|
-
continue
|
|
587
|
-
if line in lines: # state change in the same block
|
|
588
|
-
state = lines[line]
|
|
589
|
-
original_lineno = line
|
|
590
|
-
if not state:
|
|
591
|
-
self._suppression_mapping[(msgid, line)] = original_lineno
|
|
592
|
-
try:
|
|
593
|
-
self._module_msgs_state[msgid][line] = state
|
|
594
|
-
except KeyError:
|
|
595
|
-
self._module_msgs_state[msgid] = {line: state}
|
|
596
|
-
del lines[lineno]
|
|
597
|
-
|
|
598
|
-
def set_msg_status(self, msg, line, status):
|
|
599
|
-
"""Set status (enabled/disable) for a given message at a given line"""
|
|
600
|
-
assert line > 0
|
|
601
|
-
try:
|
|
602
|
-
self._module_msgs_state[msg.msgid][line] = status
|
|
603
|
-
except KeyError:
|
|
604
|
-
self._module_msgs_state[msg.msgid] = {line: status}
|
|
605
|
-
|
|
606
|
-
def handle_ignored_message(self, state_scope, msgid, line,
|
|
607
|
-
node, args, confidence): # pylint: disable=unused-argument
|
|
608
|
-
"""Report an ignored message.
|
|
609
|
-
|
|
610
|
-
state_scope is either MSG_STATE_SCOPE_MODULE or MSG_STATE_SCOPE_CONFIG,
|
|
611
|
-
depending on whether the message was disabled locally in the module,
|
|
612
|
-
or globally. The other arguments are the same as for add_message.
|
|
613
|
-
"""
|
|
614
|
-
if state_scope == MSG_STATE_SCOPE_MODULE:
|
|
615
|
-
try:
|
|
616
|
-
orig_line = self._suppression_mapping[(msgid, line)]
|
|
617
|
-
self._ignored_msgs[(msgid, orig_line)].add(line)
|
|
618
|
-
except KeyError:
|
|
619
|
-
pass
|
|
620
|
-
|
|
621
|
-
def iter_spurious_suppression_messages(self, msgs_store):
|
|
622
|
-
for warning, lines in six.iteritems(self._raw_module_msgs_state):
|
|
623
|
-
for line, enable in six.iteritems(lines):
|
|
624
|
-
if not enable and (warning, line) not in self._ignored_msgs:
|
|
625
|
-
yield 'useless-suppression', line, \
|
|
626
|
-
(msgs_store.get_msg_display_string(warning),)
|
|
627
|
-
# don't use iteritems here, _ignored_msgs may be modified by add_message
|
|
628
|
-
for (warning, from_), lines in list(self._ignored_msgs.items()):
|
|
629
|
-
for line in lines:
|
|
630
|
-
yield 'suppressed-message', line, \
|
|
631
|
-
(msgs_store.get_msg_display_string(warning), from_)
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
class MessagesStore(object):
|
|
635
|
-
"""The messages store knows information about every possible message but has
|
|
636
|
-
no particular state during analysis.
|
|
637
|
-
"""
|
|
638
|
-
|
|
639
|
-
def __init__(self):
|
|
640
|
-
# Primary registry for all active messages (i.e. all messages
|
|
641
|
-
# that can be emitted by pylint for the underlying Python
|
|
642
|
-
# version). It contains the 1:1 mapping from symbolic names
|
|
643
|
-
# to message definition objects.
|
|
644
|
-
self._messages = {}
|
|
645
|
-
# Maps alternative names (numeric IDs, deprecated names) to
|
|
646
|
-
# message definitions. May contain several names for each definition
|
|
647
|
-
# object.
|
|
648
|
-
self._alternative_names = {}
|
|
649
|
-
self._msgs_by_category = collections.defaultdict(list)
|
|
650
|
-
|
|
651
|
-
@property
|
|
652
|
-
def messages(self):
|
|
653
|
-
"""The list of all active messages."""
|
|
654
|
-
return six.itervalues(self._messages)
|
|
655
|
-
|
|
656
|
-
def add_renamed_message(self, old_id, old_symbol, new_symbol):
|
|
657
|
-
"""Register the old ID and symbol for a warning that was renamed.
|
|
658
|
-
|
|
659
|
-
This allows users to keep using the old ID/symbol in suppressions.
|
|
660
|
-
"""
|
|
661
|
-
msg = self.check_message_id(new_symbol)
|
|
662
|
-
msg.old_names.append((old_id, old_symbol))
|
|
663
|
-
self._alternative_names[old_id] = msg
|
|
664
|
-
self._alternative_names[old_symbol] = msg
|
|
665
|
-
|
|
666
|
-
def register_messages(self, checker):
|
|
667
|
-
"""register a dictionary of messages
|
|
668
|
-
|
|
669
|
-
Keys are message ids, values are a 2-uple with the message type and the
|
|
670
|
-
message itself
|
|
671
|
-
|
|
672
|
-
message ids should be a string of len 4, where the two first characters
|
|
673
|
-
are the checker id and the two last the message id in this checker
|
|
674
|
-
"""
|
|
675
|
-
chkid = None
|
|
676
|
-
for msgid, msg_tuple in six.iteritems(checker.msgs):
|
|
677
|
-
msg = build_message_def(checker, msgid, msg_tuple)
|
|
678
|
-
assert msg.symbol not in self._messages, \
|
|
679
|
-
'Message symbol %r is already defined' % msg.symbol
|
|
680
|
-
# avoid duplicate / malformed ids
|
|
681
|
-
assert msg.msgid not in self._alternative_names, \
|
|
682
|
-
'Message id %r is already defined' % msgid
|
|
683
|
-
assert chkid is None or chkid == msg.msgid[1:3], \
|
|
684
|
-
'Inconsistent checker part in message id %r' % msgid
|
|
685
|
-
chkid = msg.msgid[1:3]
|
|
686
|
-
self._messages[msg.symbol] = msg
|
|
687
|
-
self._alternative_names[msg.msgid] = msg
|
|
688
|
-
for old_id, old_symbol in msg.old_names:
|
|
689
|
-
self._alternative_names[old_id] = msg
|
|
690
|
-
self._alternative_names[old_symbol] = msg
|
|
691
|
-
self._msgs_by_category[msg.msgid[0]].append(msg.msgid)
|
|
692
|
-
|
|
693
|
-
def check_message_id(self, msgid):
|
|
694
|
-
"""returns the Message object for this message.
|
|
695
|
-
|
|
696
|
-
msgid may be either a numeric or symbolic id.
|
|
697
|
-
|
|
698
|
-
Raises UnknownMessage if the message id is not defined.
|
|
699
|
-
"""
|
|
700
|
-
if msgid[1:].isdigit():
|
|
701
|
-
msgid = msgid.upper()
|
|
702
|
-
for source in (self._alternative_names, self._messages):
|
|
703
|
-
try:
|
|
704
|
-
return source[msgid]
|
|
705
|
-
except KeyError:
|
|
706
|
-
pass
|
|
707
|
-
raise UnknownMessage('No such message id %s' % msgid)
|
|
708
|
-
|
|
709
|
-
def get_msg_display_string(self, msgid):
|
|
710
|
-
"""Generates a user-consumable representation of a message.
|
|
711
|
-
|
|
712
|
-
Can be just the message ID or the ID and the symbol.
|
|
713
|
-
"""
|
|
714
|
-
return repr(self.check_message_id(msgid).symbol)
|
|
715
|
-
|
|
716
|
-
def help_message(self, msgids):
|
|
717
|
-
"""display help messages for the given message identifiers"""
|
|
718
|
-
for msgid in msgids:
|
|
719
|
-
try:
|
|
720
|
-
print(self.check_message_id(msgid).format_help(checkerref=True))
|
|
721
|
-
print("")
|
|
722
|
-
except UnknownMessage as ex:
|
|
723
|
-
print(ex)
|
|
724
|
-
print("")
|
|
725
|
-
continue
|
|
726
|
-
|
|
727
|
-
def list_messages(self):
|
|
728
|
-
"""output full messages list documentation in ReST format"""
|
|
729
|
-
msgs = sorted(six.itervalues(self._messages), key=lambda msg: msg.msgid)
|
|
730
|
-
for msg in msgs:
|
|
731
|
-
if not msg.may_be_emitted():
|
|
732
|
-
continue
|
|
733
|
-
print(msg.format_help(checkerref=False))
|
|
734
|
-
print("")
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
class ReportsHandlerMixIn(object):
|
|
738
|
-
"""a mix-in class containing all the reports and stats manipulation
|
|
739
|
-
related methods for the main lint class
|
|
740
|
-
"""
|
|
741
|
-
def __init__(self):
|
|
742
|
-
self._reports = collections.defaultdict(list)
|
|
743
|
-
self._reports_state = {}
|
|
744
|
-
|
|
745
|
-
def report_order(self):
|
|
746
|
-
""" Return a list of reports, sorted in the order
|
|
747
|
-
in which they must be called.
|
|
748
|
-
"""
|
|
749
|
-
return list(self._reports)
|
|
750
|
-
|
|
751
|
-
def register_report(self, reportid, r_title, r_cb, checker):
|
|
752
|
-
"""register a report
|
|
753
|
-
|
|
754
|
-
reportid is the unique identifier for the report
|
|
755
|
-
r_title the report's title
|
|
756
|
-
r_cb the method to call to make the report
|
|
757
|
-
checker is the checker defining the report
|
|
758
|
-
"""
|
|
759
|
-
reportid = reportid.upper()
|
|
760
|
-
self._reports[checker].append((reportid, r_title, r_cb))
|
|
761
|
-
|
|
762
|
-
def enable_report(self, reportid):
|
|
763
|
-
"""disable the report of the given id"""
|
|
764
|
-
reportid = reportid.upper()
|
|
765
|
-
self._reports_state[reportid] = True
|
|
766
|
-
|
|
767
|
-
def disable_report(self, reportid):
|
|
768
|
-
"""disable the report of the given id"""
|
|
769
|
-
reportid = reportid.upper()
|
|
770
|
-
self._reports_state[reportid] = False
|
|
771
|
-
|
|
772
|
-
def report_is_enabled(self, reportid):
|
|
773
|
-
"""return true if the report associated to the given identifier is
|
|
774
|
-
enabled
|
|
775
|
-
"""
|
|
776
|
-
return self._reports_state.get(reportid, True)
|
|
777
|
-
|
|
778
|
-
def make_reports(self, stats, old_stats):
|
|
779
|
-
"""render registered reports"""
|
|
780
|
-
sect = Section('Report',
|
|
781
|
-
'%s statements analysed.'% (self.stats['statement']))
|
|
782
|
-
for checker in self.report_order():
|
|
783
|
-
for reportid, r_title, r_cb in self._reports[checker]:
|
|
784
|
-
if not self.report_is_enabled(reportid):
|
|
785
|
-
continue
|
|
786
|
-
report_sect = Section(r_title)
|
|
787
|
-
try:
|
|
788
|
-
r_cb(report_sect, stats, old_stats)
|
|
789
|
-
except EmptyReport:
|
|
790
|
-
continue
|
|
791
|
-
report_sect.report_id = reportid
|
|
792
|
-
sect.append(report_sect)
|
|
793
|
-
return sect
|
|
794
|
-
|
|
795
|
-
def add_stats(self, **kwargs):
|
|
796
|
-
"""add some stats entries to the statistic dictionary
|
|
797
|
-
raise an AssertionError if there is a key conflict
|
|
798
|
-
"""
|
|
799
|
-
for key, value in six.iteritems(kwargs):
|
|
800
|
-
if key[-1] == '_':
|
|
801
|
-
key = key[:-1]
|
|
802
|
-
assert key not in self.stats
|
|
803
|
-
self.stats[key] = value
|
|
804
|
-
return self.stats
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
def expand_modules(files_or_modules, black_list):
|
|
808
|
-
"""take a list of files/modules/packages and return the list of tuple
|
|
809
|
-
(file, module name) which have to be actually checked
|
|
810
|
-
"""
|
|
811
|
-
result = []
|
|
812
|
-
errors = []
|
|
813
|
-
for something in files_or_modules:
|
|
814
|
-
if exists(something):
|
|
815
|
-
# this is a file or a directory
|
|
816
|
-
try:
|
|
817
|
-
modname = '.'.join(modpath_from_file(something))
|
|
818
|
-
except ImportError:
|
|
819
|
-
modname = splitext(basename(something))[0]
|
|
820
|
-
if isdir(something):
|
|
821
|
-
filepath = join(something, '__init__.py')
|
|
822
|
-
else:
|
|
823
|
-
filepath = something
|
|
824
|
-
else:
|
|
825
|
-
# suppose it's a module or package
|
|
826
|
-
modname = something
|
|
827
|
-
try:
|
|
828
|
-
filepath = file_from_modpath(modname.split('.'))
|
|
829
|
-
if filepath is None:
|
|
830
|
-
continue
|
|
831
|
-
except (ImportError, SyntaxError) as ex:
|
|
832
|
-
# FIXME p3k : the SyntaxError is a Python bug and should be
|
|
833
|
-
# removed as soon as possible http://bugs.python.org/issue10588
|
|
834
|
-
errors.append({'key': 'fatal', 'mod': modname, 'ex': ex})
|
|
835
|
-
continue
|
|
836
|
-
filepath = normpath(filepath)
|
|
837
|
-
result.append({'path': filepath, 'name': modname, 'isarg': True,
|
|
838
|
-
'basepath': filepath, 'basename': modname})
|
|
839
|
-
if not (modname.endswith('.__init__') or modname == '__init__') \
|
|
840
|
-
and '__init__.py' in filepath:
|
|
841
|
-
for subfilepath in get_module_files(dirname(filepath), black_list):
|
|
842
|
-
if filepath == subfilepath:
|
|
843
|
-
continue
|
|
844
|
-
submodname = '.'.join(modpath_from_file(subfilepath))
|
|
845
|
-
result.append({'path': subfilepath, 'name': submodname,
|
|
846
|
-
'isarg': False,
|
|
847
|
-
'basepath': filepath, 'basename': modname})
|
|
848
|
-
return result, errors
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
class PyLintASTWalker(object):
|
|
852
|
-
|
|
853
|
-
def __init__(self, linter):
|
|
854
|
-
# callbacks per node types
|
|
855
|
-
self.nbstatements = 0
|
|
856
|
-
self.visit_events = collections.defaultdict(list)
|
|
857
|
-
self.leave_events = collections.defaultdict(list)
|
|
858
|
-
self.linter = linter
|
|
859
|
-
|
|
860
|
-
def _is_method_enabled(self, method):
|
|
861
|
-
if not hasattr(method, 'checks_msgs'):
|
|
862
|
-
return True
|
|
863
|
-
for msg_desc in method.checks_msgs:
|
|
864
|
-
if self.linter.is_message_enabled(msg_desc):
|
|
865
|
-
return True
|
|
866
|
-
return False
|
|
867
|
-
|
|
868
|
-
def add_checker(self, checker):
|
|
869
|
-
"""walk to the checker's dir and collect visit and leave methods"""
|
|
870
|
-
# XXX : should be possible to merge needed_checkers and add_checker
|
|
871
|
-
vcids = set()
|
|
872
|
-
lcids = set()
|
|
873
|
-
visits = self.visit_events
|
|
874
|
-
leaves = self.leave_events
|
|
875
|
-
for member in dir(checker):
|
|
876
|
-
cid = member[6:]
|
|
877
|
-
if cid == 'default':
|
|
878
|
-
continue
|
|
879
|
-
if member.startswith('visit_'):
|
|
880
|
-
v_meth = getattr(checker, member)
|
|
881
|
-
# don't use visit_methods with no activated message:
|
|
882
|
-
if self._is_method_enabled(v_meth):
|
|
883
|
-
visits[cid].append(v_meth)
|
|
884
|
-
vcids.add(cid)
|
|
885
|
-
elif member.startswith('leave_'):
|
|
886
|
-
l_meth = getattr(checker, member)
|
|
887
|
-
# don't use leave_methods with no activated message:
|
|
888
|
-
if self._is_method_enabled(l_meth):
|
|
889
|
-
leaves[cid].append(l_meth)
|
|
890
|
-
lcids.add(cid)
|
|
891
|
-
visit_default = getattr(checker, 'visit_default', None)
|
|
892
|
-
if visit_default:
|
|
893
|
-
for cls in nodes.ALL_NODE_CLASSES:
|
|
894
|
-
cid = cls.__name__.lower()
|
|
895
|
-
if cid not in vcids:
|
|
896
|
-
visits[cid].append(visit_default)
|
|
897
|
-
# for now we have no "leave_default" method in Pylint
|
|
898
|
-
|
|
899
|
-
def walk(self, astroid):
|
|
900
|
-
"""call visit events of astroid checkers for the given node, recurse on
|
|
901
|
-
its children, then leave events.
|
|
902
|
-
"""
|
|
903
|
-
cid = astroid.__class__.__name__.lower()
|
|
904
|
-
|
|
905
|
-
# Detect if the node is a new name for a deprecated alias.
|
|
906
|
-
# In this case, favour the methods for the deprecated
|
|
907
|
-
# alias if any, in order to maintain backwards
|
|
908
|
-
# compatibility.
|
|
909
|
-
old_cid = DEPRECATED_ALIASES.get(cid)
|
|
910
|
-
visit_events = ()
|
|
911
|
-
leave_events = ()
|
|
912
|
-
|
|
913
|
-
if old_cid:
|
|
914
|
-
visit_events = self.visit_events.get(old_cid, ())
|
|
915
|
-
leave_events = self.leave_events.get(old_cid, ())
|
|
916
|
-
if visit_events or leave_events:
|
|
917
|
-
msg = ("Implemented method {meth}_{old} instead of {meth}_{new}. "
|
|
918
|
-
"This will be supported until Pylint 2.0.")
|
|
919
|
-
if visit_events:
|
|
920
|
-
warnings.warn(msg.format(meth="visit", old=old_cid, new=cid),
|
|
921
|
-
PendingDeprecationWarning)
|
|
922
|
-
if leave_events:
|
|
923
|
-
warnings.warn(msg.format(meth="leave", old=old_cid, new=cid),
|
|
924
|
-
PendingDeprecationWarning)
|
|
925
|
-
|
|
926
|
-
visit_events = itertools.chain(visit_events,
|
|
927
|
-
self.visit_events.get(cid, ()))
|
|
928
|
-
leave_events = itertools.chain(leave_events,
|
|
929
|
-
self.leave_events.get(cid, ()))
|
|
930
|
-
|
|
931
|
-
if astroid.is_statement:
|
|
932
|
-
self.nbstatements += 1
|
|
933
|
-
# generate events for this node on each checker
|
|
934
|
-
for cb in visit_events or ():
|
|
935
|
-
cb(astroid)
|
|
936
|
-
# recurse on children
|
|
937
|
-
for child in astroid.get_children():
|
|
938
|
-
self.walk(child)
|
|
939
|
-
for cb in leave_events or ():
|
|
940
|
-
cb(astroid)
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
PY_EXTS = ('.py', '.pyc', '.pyo', '.pyw', '.so', '.dll')
|
|
944
|
-
|
|
945
|
-
def register_plugins(linter, directory):
|
|
946
|
-
"""load all module and package in the given directory, looking for a
|
|
947
|
-
'register' function in each one, used to register pylint checkers
|
|
948
|
-
"""
|
|
949
|
-
imported = {}
|
|
950
|
-
for filename in os.listdir(directory):
|
|
951
|
-
base, extension = splitext(filename)
|
|
952
|
-
if base in imported or base == '__pycache__':
|
|
953
|
-
continue
|
|
954
|
-
if extension in PY_EXTS and base != '__init__' or (
|
|
955
|
-
not extension and isdir(join(directory, base))):
|
|
956
|
-
try:
|
|
957
|
-
module = load_module_from_file(join(directory, filename))
|
|
958
|
-
except ValueError:
|
|
959
|
-
# empty module name (usually emacs auto-save files)
|
|
960
|
-
continue
|
|
961
|
-
except ImportError as exc:
|
|
962
|
-
print("Problem importing module %s: %s" % (filename, exc),
|
|
963
|
-
file=sys.stderr)
|
|
964
|
-
else:
|
|
965
|
-
if hasattr(module, 'register'):
|
|
966
|
-
module.register(linter)
|
|
967
|
-
imported[base] = 1
|
|
968
|
-
|
|
969
|
-
def get_global_option(checker, option, default=None):
|
|
970
|
-
""" Retrieve an option defined by the given *checker* or
|
|
971
|
-
by all known option providers.
|
|
972
|
-
|
|
973
|
-
It will look in the list of all options providers
|
|
974
|
-
until the given *option* will be found.
|
|
975
|
-
If the option wasn't found, the *default* value will be returned.
|
|
976
|
-
"""
|
|
977
|
-
# First, try in the given checker's config.
|
|
978
|
-
# After that, look in the options providers.
|
|
979
|
-
|
|
980
|
-
try:
|
|
981
|
-
return getattr(checker.config, option.replace("-", "_"))
|
|
982
|
-
except AttributeError:
|
|
983
|
-
pass
|
|
984
|
-
for provider in checker.linter.options_providers:
|
|
985
|
-
for options in provider.options:
|
|
986
|
-
if options[0] == option:
|
|
987
|
-
return getattr(provider.config, option.replace("-", "_"))
|
|
988
|
-
return default
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
def deprecated_option(shortname=None, opt_type=None, help_msg=None):
|
|
992
|
-
def _warn_deprecated(option, optname, *args): # pylint: disable=unused-argument
|
|
993
|
-
msg = ("Warning: option %s is obsolete and "
|
|
994
|
-
"it is slated for removal in Pylint 1.6.\n")
|
|
995
|
-
sys.stderr.write(msg % (optname,))
|
|
996
|
-
|
|
997
|
-
option = {
|
|
998
|
-
'help': help_msg,
|
|
999
|
-
'hide': True,
|
|
1000
|
-
'type': opt_type,
|
|
1001
|
-
'action': 'callback',
|
|
1002
|
-
'callback': _warn_deprecated,
|
|
1003
|
-
'deprecated': True
|
|
1004
|
-
}
|
|
1005
|
-
if shortname:
|
|
1006
|
-
option['shortname'] = shortname
|
|
1007
|
-
return option
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
def _splitstrip(string, sep=','):
|
|
1011
|
-
"""return a list of stripped string by splitting the string given as
|
|
1012
|
-
argument on `sep` (',' by default). Empty string are discarded.
|
|
1013
|
-
|
|
1014
|
-
>>> _splitstrip('a, b, c , 4,,')
|
|
1015
|
-
['a', 'b', 'c', '4']
|
|
1016
|
-
>>> _splitstrip('a')
|
|
1017
|
-
['a']
|
|
1018
|
-
>>>
|
|
1019
|
-
|
|
1020
|
-
:type string: str or unicode
|
|
1021
|
-
:param string: a csv line
|
|
1022
|
-
|
|
1023
|
-
:type sep: str or unicode
|
|
1024
|
-
:param sep: field separator, default to the comma (',')
|
|
1025
|
-
|
|
1026
|
-
:rtype: str or unicode
|
|
1027
|
-
:return: the unquoted string (or the input string if it wasn't quoted)
|
|
1028
|
-
"""
|
|
1029
|
-
return [word.strip() for word in string.split(sep) if word.strip()]
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
def _unquote(string):
|
|
1033
|
-
"""remove optional quotes (simple or double) from the string
|
|
1034
|
-
|
|
1035
|
-
:type string: str or unicode
|
|
1036
|
-
:param string: an optionally quoted string
|
|
1037
|
-
|
|
1038
|
-
:rtype: str or unicode
|
|
1039
|
-
:return: the unquoted string (or the input string if it wasn't quoted)
|
|
1040
|
-
"""
|
|
1041
|
-
if not string:
|
|
1042
|
-
return string
|
|
1043
|
-
if string[0] in '"\'':
|
|
1044
|
-
string = string[1:]
|
|
1045
|
-
if string[-1] in '"\'':
|
|
1046
|
-
string = string[:-1]
|
|
1047
|
-
return string
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
def _normalize_text(text, line_len=80, indent=''):
|
|
1051
|
-
"""Wrap the text on the given line length."""
|
|
1052
|
-
return '\n'.join(textwrap.wrap(text, width=line_len, initial_indent=indent,
|
|
1053
|
-
subsequent_indent=indent))
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
def _check_csv(value):
|
|
1057
|
-
if isinstance(value, (list, tuple)):
|
|
1058
|
-
return value
|
|
1059
|
-
return _splitstrip(value)
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
if six.PY2:
|
|
1063
|
-
def _encode(string, encoding):
|
|
1064
|
-
# pylint: disable=undefined-variable
|
|
1065
|
-
if isinstance(string, unicode):
|
|
1066
|
-
return string.encode(encoding)
|
|
1067
|
-
return str(string)
|
|
1068
|
-
else:
|
|
1069
|
-
def _encode(string, _):
|
|
1070
|
-
return str(string)
|
|
1071
|
-
|
|
1072
|
-
def _get_encoding(encoding, stream):
|
|
1073
|
-
encoding = encoding or getattr(stream, 'encoding', None)
|
|
1074
|
-
if not encoding:
|
|
1075
|
-
import locale
|
|
1076
|
-
encoding = locale.getpreferredencoding()
|
|
1077
|
-
return encoding
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
def _comment(string):
|
|
1081
|
-
"""return string as a comment"""
|
|
1082
|
-
lines = [line.strip() for line in string.splitlines()]
|
|
1083
|
-
return '# ' + ('%s# ' % os.linesep).join(lines)
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
def _format_option_value(optdict, value):
|
|
1087
|
-
"""return the user input's value from a 'compiled' value"""
|
|
1088
|
-
if isinstance(value, (list, tuple)):
|
|
1089
|
-
value = ','.join(value)
|
|
1090
|
-
elif isinstance(value, dict):
|
|
1091
|
-
value = ','.join('%s:%s' % (k, v) for k, v in value.items())
|
|
1092
|
-
elif hasattr(value, 'match'): # optdict.get('type') == 'regexp'
|
|
1093
|
-
# compiled regexp
|
|
1094
|
-
value = value.pattern
|
|
1095
|
-
elif optdict.get('type') == 'yn':
|
|
1096
|
-
value = value and 'yes' or 'no'
|
|
1097
|
-
elif isinstance(value, six.string_types) and value.isspace():
|
|
1098
|
-
value = "'%s'" % value
|
|
1099
|
-
return value
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
def _ini_format_section(stream, section, options, encoding=None, doc=None):
|
|
1103
|
-
"""format an options section using the INI format"""
|
|
1104
|
-
encoding = _get_encoding(encoding, stream)
|
|
1105
|
-
if doc:
|
|
1106
|
-
print(_encode(_comment(doc), encoding), file=stream)
|
|
1107
|
-
print('[%s]' % section, file=stream)
|
|
1108
|
-
_ini_format(stream, options, encoding)
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
def _ini_format(stream, options, encoding):
|
|
1112
|
-
"""format options using the INI format"""
|
|
1113
|
-
for optname, optdict, value in options:
|
|
1114
|
-
value = _format_option_value(optdict, value)
|
|
1115
|
-
help = optdict.get('help')
|
|
1116
|
-
if help:
|
|
1117
|
-
help = _normalize_text(help, line_len=79, indent='# ')
|
|
1118
|
-
print(file=stream)
|
|
1119
|
-
print(_encode(help, encoding), file=stream)
|
|
1120
|
-
else:
|
|
1121
|
-
print(file=stream)
|
|
1122
|
-
if value is None:
|
|
1123
|
-
print('#%s=' % optname, file=stream)
|
|
1124
|
-
else:
|
|
1125
|
-
value = _encode(value, encoding).strip()
|
|
1126
|
-
print('%s=%s' % (optname, value), file=stream)
|
|
1127
|
-
|
|
1128
|
-
format_section = _ini_format_section
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
def _rest_format_section(stream, section, options, encoding=None, doc=None):
|
|
1132
|
-
"""format an options section using as ReST formatted output"""
|
|
1133
|
-
encoding = _get_encoding(encoding, stream)
|
|
1134
|
-
if section:
|
|
1135
|
-
print('%s\n%s' % (section, "'"*len(section)), file=stream)
|
|
1136
|
-
if doc:
|
|
1137
|
-
print(_encode(_normalize_text(doc, line_len=79, indent=''), encoding), file=stream)
|
|
1138
|
-
print(file=stream)
|
|
1139
|
-
for optname, optdict, value in options:
|
|
1140
|
-
help = optdict.get('help')
|
|
1141
|
-
print(':%s:' % optname, file=stream)
|
|
1142
|
-
if help:
|
|
1143
|
-
help = _normalize_text(help, line_len=79, indent=' ')
|
|
1144
|
-
print(_encode(help, encoding), file=stream)
|
|
1145
|
-
if value:
|
|
1146
|
-
value = _encode(_format_option_value(optdict, value), encoding)
|
|
1147
|
-
print(file=stream)
|
|
1148
|
-
print(' Default: ``%s``' % value.replace("`` ", "```` ``"), file=stream)
|