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,102 +0,0 @@
|
|
|
1
|
-
# This program is free software; you can redistribute it and/or modify it under
|
|
2
|
-
# the terms of the GNU General Public License as published by the Free Software
|
|
3
|
-
# Foundation; either version 2 of the License, or (at your option) any later
|
|
4
|
-
# version.
|
|
5
|
-
#
|
|
6
|
-
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
7
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
8
|
-
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
|
|
9
|
-
#
|
|
10
|
-
# You should have received a copy of the GNU General Public License along with
|
|
11
|
-
# this program; if not, write to the Free Software Foundation, Inc.,
|
|
12
|
-
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
13
|
-
"""Interfaces for Pylint objects"""
|
|
14
|
-
from collections import namedtuple
|
|
15
|
-
|
|
16
|
-
Confidence = namedtuple('Confidence', ['name', 'description'])
|
|
17
|
-
# Warning Certainties
|
|
18
|
-
HIGH = Confidence('HIGH', 'No false positive possible.')
|
|
19
|
-
INFERENCE = Confidence('INFERENCE', 'Warning based on inference result.')
|
|
20
|
-
INFERENCE_FAILURE = Confidence('INFERENCE_FAILURE',
|
|
21
|
-
'Warning based on inference with failures.')
|
|
22
|
-
UNDEFINED = Confidence('UNDEFINED',
|
|
23
|
-
'Warning without any associated confidence level.')
|
|
24
|
-
|
|
25
|
-
CONFIDENCE_LEVELS = [HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED]
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class Interface(object):
|
|
29
|
-
"""Base class for interfaces."""
|
|
30
|
-
@classmethod
|
|
31
|
-
def is_implemented_by(cls, instance):
|
|
32
|
-
return implements(instance, cls)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def implements(obj, interface):
|
|
36
|
-
"""Return true if the give object (maybe an instance or class) implements
|
|
37
|
-
the interface.
|
|
38
|
-
"""
|
|
39
|
-
kimplements = getattr(obj, '__implements__', ())
|
|
40
|
-
if not isinstance(kimplements, (list, tuple)):
|
|
41
|
-
kimplements = (kimplements,)
|
|
42
|
-
for implementedinterface in kimplements:
|
|
43
|
-
if issubclass(implementedinterface, interface):
|
|
44
|
-
return True
|
|
45
|
-
return False
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
class IChecker(Interface):
|
|
49
|
-
"""This is an base interface, not designed to be used elsewhere than for
|
|
50
|
-
sub interfaces definition.
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
def open(self):
|
|
54
|
-
"""called before visiting project (i.e set of modules)"""
|
|
55
|
-
|
|
56
|
-
def close(self):
|
|
57
|
-
"""called after visiting project (i.e set of modules)"""
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
class IRawChecker(IChecker):
|
|
61
|
-
"""interface for checker which need to parse the raw file
|
|
62
|
-
"""
|
|
63
|
-
|
|
64
|
-
def process_module(self, astroid):
|
|
65
|
-
""" process a module
|
|
66
|
-
|
|
67
|
-
the module's content is accessible via astroid.stream
|
|
68
|
-
"""
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
class ITokenChecker(IChecker):
|
|
72
|
-
"""Interface for checkers that need access to the token list."""
|
|
73
|
-
def process_tokens(self, tokens):
|
|
74
|
-
"""Process a module.
|
|
75
|
-
|
|
76
|
-
tokens is a list of all source code tokens in the file.
|
|
77
|
-
"""
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
class IAstroidChecker(IChecker):
|
|
81
|
-
""" interface for checker which prefers receive events according to
|
|
82
|
-
statement type
|
|
83
|
-
"""
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
class IReporter(Interface):
|
|
87
|
-
""" reporter collect messages and display results encapsulated in a layout
|
|
88
|
-
"""
|
|
89
|
-
def add_message(self, msg_id, location, msg):
|
|
90
|
-
"""add a message of a given type
|
|
91
|
-
|
|
92
|
-
msg_id is a message identifier
|
|
93
|
-
location is a 3-uple (module, object, line)
|
|
94
|
-
msg is the actual message
|
|
95
|
-
"""
|
|
96
|
-
|
|
97
|
-
def display_reports(self, layout):
|
|
98
|
-
"""display results encapsulated in the layout tree
|
|
99
|
-
"""
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
__all__ = ('IRawChecker', 'IAstroidChecker', 'ITokenChecker', 'IReporter')
|
|
@@ -1,1381 +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
|
-
""" %prog [options] module_or_package
|
|
17
|
-
|
|
18
|
-
Check that a module satisfies a coding standard (and more !).
|
|
19
|
-
|
|
20
|
-
%prog --help
|
|
21
|
-
|
|
22
|
-
Display this help message and exit.
|
|
23
|
-
|
|
24
|
-
%prog --help-msg <msg-id>[,<msg-id>]
|
|
25
|
-
|
|
26
|
-
Display help messages about given message identifiers and exit.
|
|
27
|
-
"""
|
|
28
|
-
from __future__ import print_function
|
|
29
|
-
|
|
30
|
-
import collections
|
|
31
|
-
import contextlib
|
|
32
|
-
import operator
|
|
33
|
-
import os
|
|
34
|
-
try:
|
|
35
|
-
import multiprocessing
|
|
36
|
-
except ImportError:
|
|
37
|
-
multiprocessing = None
|
|
38
|
-
import sys
|
|
39
|
-
import tokenize
|
|
40
|
-
import warnings
|
|
41
|
-
|
|
42
|
-
import six
|
|
43
|
-
|
|
44
|
-
import astroid
|
|
45
|
-
from astroid.__pkginfo__ import version as astroid_version
|
|
46
|
-
from astroid import modutils
|
|
47
|
-
from pylint import checkers
|
|
48
|
-
from pylint import interfaces
|
|
49
|
-
from pylint import reporters
|
|
50
|
-
from pylint import utils
|
|
51
|
-
from pylint import config
|
|
52
|
-
from pylint.__pkginfo__ import version
|
|
53
|
-
from pylint.reporters.ureports import nodes as report_nodes
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
MANAGER = astroid.MANAGER
|
|
57
|
-
INCLUDE_IDS_HELP = ("Deprecated. It was used to include message\'s "
|
|
58
|
-
"id in output. Use --msg-template instead.")
|
|
59
|
-
SYMBOLS_HELP = ("Deprecated. It was used to include symbolic ids of "
|
|
60
|
-
"messages in output. Use --msg-template instead.")
|
|
61
|
-
|
|
62
|
-
def _get_new_args(message):
|
|
63
|
-
location = (
|
|
64
|
-
message.abspath,
|
|
65
|
-
message.path,
|
|
66
|
-
message.module,
|
|
67
|
-
message.obj,
|
|
68
|
-
message.line,
|
|
69
|
-
message.column,
|
|
70
|
-
)
|
|
71
|
-
return (
|
|
72
|
-
message.msg_id,
|
|
73
|
-
message.symbol,
|
|
74
|
-
location,
|
|
75
|
-
message.msg,
|
|
76
|
-
message.confidence,
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
def _get_python_path(filepath):
|
|
80
|
-
dirname = os.path.realpath(os.path.expanduser(filepath))
|
|
81
|
-
if not os.path.isdir(dirname):
|
|
82
|
-
dirname = os.path.dirname(dirname)
|
|
83
|
-
while True:
|
|
84
|
-
if not os.path.exists(os.path.join(dirname, "__init__.py")):
|
|
85
|
-
return dirname
|
|
86
|
-
old_dirname = dirname
|
|
87
|
-
dirname = os.path.dirname(dirname)
|
|
88
|
-
if old_dirname == dirname:
|
|
89
|
-
return os.getcwd()
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
def _merge_stats(stats):
|
|
93
|
-
merged = {}
|
|
94
|
-
by_msg = collections.Counter()
|
|
95
|
-
for stat in stats:
|
|
96
|
-
message_stats = stat.pop('by_msg', {})
|
|
97
|
-
by_msg.update(message_stats)
|
|
98
|
-
|
|
99
|
-
for key, item in six.iteritems(stat):
|
|
100
|
-
if key not in merged:
|
|
101
|
-
merged[key] = item
|
|
102
|
-
else:
|
|
103
|
-
if isinstance(item, dict):
|
|
104
|
-
merged[key].update(item)
|
|
105
|
-
else:
|
|
106
|
-
merged[key] = merged[key] + item
|
|
107
|
-
|
|
108
|
-
merged['by_msg'] = by_msg
|
|
109
|
-
return merged
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
@contextlib.contextmanager
|
|
113
|
-
def _patch_sysmodules():
|
|
114
|
-
# Context manager that permits running pylint, on Windows, with -m switch
|
|
115
|
-
# and with --jobs, as in 'python -2 -m pylint .. --jobs'.
|
|
116
|
-
# For more details why this is needed,
|
|
117
|
-
# see Python issue http://bugs.python.org/issue10845.
|
|
118
|
-
|
|
119
|
-
mock_main = __name__ != '__main__' # -m switch
|
|
120
|
-
if mock_main:
|
|
121
|
-
sys.modules['__main__'] = sys.modules[__name__]
|
|
122
|
-
|
|
123
|
-
try:
|
|
124
|
-
yield
|
|
125
|
-
finally:
|
|
126
|
-
if mock_main:
|
|
127
|
-
sys.modules.pop('__main__')
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
# Python Linter class #########################################################
|
|
131
|
-
|
|
132
|
-
MSGS = {
|
|
133
|
-
'F0001': ('%s',
|
|
134
|
-
'fatal',
|
|
135
|
-
'Used when an error occurred preventing the analysis of a \
|
|
136
|
-
module (unable to find it for instance).'),
|
|
137
|
-
'F0002': ('%s: %s',
|
|
138
|
-
'astroid-error',
|
|
139
|
-
'Used when an unexpected error occurred while building the '
|
|
140
|
-
'Astroid representation. This is usually accompanied by a '
|
|
141
|
-
'traceback. Please report such errors !'),
|
|
142
|
-
'F0010': ('error while code parsing: %s',
|
|
143
|
-
'parse-error',
|
|
144
|
-
'Used when an exception occured while building the Astroid '
|
|
145
|
-
'representation which could be handled by astroid.'),
|
|
146
|
-
|
|
147
|
-
'I0001': ('Unable to run raw checkers on built-in module %s',
|
|
148
|
-
'raw-checker-failed',
|
|
149
|
-
'Used to inform that a built-in module has not been checked '
|
|
150
|
-
'using the raw checkers.'),
|
|
151
|
-
|
|
152
|
-
'I0010': ('Unable to consider inline option %r',
|
|
153
|
-
'bad-inline-option',
|
|
154
|
-
'Used when an inline option is either badly formatted or can\'t '
|
|
155
|
-
'be used inside modules.'),
|
|
156
|
-
|
|
157
|
-
'I0011': ('Locally disabling %s (%s)',
|
|
158
|
-
'locally-disabled',
|
|
159
|
-
'Used when an inline option disables a message or a messages '
|
|
160
|
-
'category.'),
|
|
161
|
-
'I0012': ('Locally enabling %s (%s)',
|
|
162
|
-
'locally-enabled',
|
|
163
|
-
'Used when an inline option enables a message or a messages '
|
|
164
|
-
'category.'),
|
|
165
|
-
'I0013': ('Ignoring entire file',
|
|
166
|
-
'file-ignored',
|
|
167
|
-
'Used to inform that the file will not be checked'),
|
|
168
|
-
'I0020': ('Suppressed %s (from line %d)',
|
|
169
|
-
'suppressed-message',
|
|
170
|
-
'A message was triggered on a line, but suppressed explicitly '
|
|
171
|
-
'by a disable= comment in the file. This message is not '
|
|
172
|
-
'generated for messages that are ignored due to configuration '
|
|
173
|
-
'settings.'),
|
|
174
|
-
'I0021': ('Useless suppression of %s',
|
|
175
|
-
'useless-suppression',
|
|
176
|
-
'Reported when a message is explicitly disabled for a line or '
|
|
177
|
-
'a block of code, but never triggered.'),
|
|
178
|
-
'I0022': ('Pragma "%s" is deprecated, use "%s" instead',
|
|
179
|
-
'deprecated-pragma',
|
|
180
|
-
'Some inline pylint options have been renamed or reworked, '
|
|
181
|
-
'only the most recent form should be used. '
|
|
182
|
-
'NOTE:skip-all is only available with pylint >= 0.26',
|
|
183
|
-
{'old_names': [('I0014', 'deprecated-disable-all')]}),
|
|
184
|
-
|
|
185
|
-
'E0001': ('%s',
|
|
186
|
-
'syntax-error',
|
|
187
|
-
'Used when a syntax error is raised for a module.'),
|
|
188
|
-
|
|
189
|
-
'E0011': ('Unrecognized file option %r',
|
|
190
|
-
'unrecognized-inline-option',
|
|
191
|
-
'Used when an unknown inline option is encountered.'),
|
|
192
|
-
'E0012': ('Bad option value %r',
|
|
193
|
-
'bad-option-value',
|
|
194
|
-
'Used when a bad value for an inline option is encountered.'),
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
if multiprocessing is not None:
|
|
199
|
-
class ChildLinter(multiprocessing.Process):
|
|
200
|
-
def run(self):
|
|
201
|
-
# pylint: disable=no-member, unbalanced-tuple-unpacking
|
|
202
|
-
tasks_queue, results_queue, self._config = self._args
|
|
203
|
-
|
|
204
|
-
self._config["jobs"] = 1 # Child does not parallelize any further.
|
|
205
|
-
self._python3_porting_mode = self._config.pop(
|
|
206
|
-
'python3_porting_mode', None)
|
|
207
|
-
self._plugins = self._config.pop('plugins', None)
|
|
208
|
-
|
|
209
|
-
# Run linter for received files/modules.
|
|
210
|
-
for file_or_module in iter(tasks_queue.get, 'STOP'):
|
|
211
|
-
result = self._run_linter(file_or_module[0])
|
|
212
|
-
try:
|
|
213
|
-
results_queue.put(result)
|
|
214
|
-
except Exception as ex:
|
|
215
|
-
print("internal error with sending report for module %s" %
|
|
216
|
-
file_or_module, file=sys.stderr)
|
|
217
|
-
print(ex, file=sys.stderr)
|
|
218
|
-
results_queue.put({})
|
|
219
|
-
|
|
220
|
-
def _run_linter(self, file_or_module):
|
|
221
|
-
linter = PyLinter()
|
|
222
|
-
|
|
223
|
-
# Register standard checkers.
|
|
224
|
-
linter.load_default_plugins()
|
|
225
|
-
# Load command line plugins.
|
|
226
|
-
if self._plugins:
|
|
227
|
-
linter.load_plugin_modules(self._plugins)
|
|
228
|
-
|
|
229
|
-
linter.load_configuration_from_config(self._config)
|
|
230
|
-
linter.set_reporter(reporters.CollectingReporter())
|
|
231
|
-
|
|
232
|
-
# Enable the Python 3 checker mode. This option is
|
|
233
|
-
# passed down from the parent linter up to here, since
|
|
234
|
-
# the Python 3 porting flag belongs to the Run class,
|
|
235
|
-
# instead of the Linter class.
|
|
236
|
-
if self._python3_porting_mode:
|
|
237
|
-
linter.python3_porting_mode()
|
|
238
|
-
|
|
239
|
-
# Run the checks.
|
|
240
|
-
linter.check(file_or_module)
|
|
241
|
-
|
|
242
|
-
msgs = [_get_new_args(m) for m in linter.reporter.messages]
|
|
243
|
-
return (file_or_module, linter.file_state.base_name, linter.current_name,
|
|
244
|
-
msgs, linter.stats, linter.msg_status)
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
class PyLinter(config.OptionsManagerMixIn,
|
|
248
|
-
utils.MessagesHandlerMixIn,
|
|
249
|
-
utils.ReportsHandlerMixIn,
|
|
250
|
-
checkers.BaseTokenChecker):
|
|
251
|
-
"""lint Python modules using external checkers.
|
|
252
|
-
|
|
253
|
-
This is the main checker controlling the other ones and the reports
|
|
254
|
-
generation. It is itself both a raw checker and an astroid checker in order
|
|
255
|
-
to:
|
|
256
|
-
* handle message activation / deactivation at the module level
|
|
257
|
-
* handle some basic but necessary stats'data (number of classes, methods...)
|
|
258
|
-
|
|
259
|
-
IDE plugins developpers: you may have to call
|
|
260
|
-
`astroid.builder.MANAGER.astroid_cache.clear()` accross run if you want
|
|
261
|
-
to ensure the latest code version is actually checked.
|
|
262
|
-
"""
|
|
263
|
-
|
|
264
|
-
__implements__ = (interfaces.ITokenChecker, )
|
|
265
|
-
|
|
266
|
-
name = 'master'
|
|
267
|
-
priority = 0
|
|
268
|
-
level = 0
|
|
269
|
-
msgs = MSGS
|
|
270
|
-
|
|
271
|
-
@staticmethod
|
|
272
|
-
def make_options():
|
|
273
|
-
return (('ignore',
|
|
274
|
-
{'type' : 'csv', 'metavar' : '<file>[,<file>...]',
|
|
275
|
-
'dest' : 'black_list', 'default' : ('CVS',),
|
|
276
|
-
'help' : 'Add files or directories to the blacklist. '
|
|
277
|
-
'They should be base names, not paths.'}),
|
|
278
|
-
('persistent',
|
|
279
|
-
{'default': True, 'type' : 'yn', 'metavar' : '<y_or_n>',
|
|
280
|
-
'level': 1,
|
|
281
|
-
'help' : 'Pickle collected data for later comparisons.'}),
|
|
282
|
-
|
|
283
|
-
('load-plugins',
|
|
284
|
-
{'type' : 'csv', 'metavar' : '<modules>', 'default' : (),
|
|
285
|
-
'level': 1,
|
|
286
|
-
'help' : 'List of plugins (as comma separated values of '
|
|
287
|
-
'python modules names) to load, usually to register '
|
|
288
|
-
'additional checkers.'}),
|
|
289
|
-
|
|
290
|
-
('output-format',
|
|
291
|
-
{'default': 'text', 'type': 'string', 'metavar' : '<format>',
|
|
292
|
-
'short': 'f',
|
|
293
|
-
'group': 'Reports',
|
|
294
|
-
'help' : 'Set the output format. Available formats are text,'
|
|
295
|
-
' parseable, colorized, msvs (visual studio) and html. You '
|
|
296
|
-
'can also give a reporter class, eg mypackage.mymodule.'
|
|
297
|
-
'MyReporterClass.'}),
|
|
298
|
-
|
|
299
|
-
('files-output',
|
|
300
|
-
{'default': 0, 'type' : 'yn', 'metavar' : '<y_or_n>',
|
|
301
|
-
'group': 'Reports', 'level': 1,
|
|
302
|
-
'help' : 'Put messages in a separate file for each module / '
|
|
303
|
-
'package specified on the command line instead of printing '
|
|
304
|
-
'them on stdout. Reports (if any) will be written in a file '
|
|
305
|
-
'name "pylint_global.[txt|html]".'}),
|
|
306
|
-
|
|
307
|
-
('reports',
|
|
308
|
-
{'default': 1, 'type' : 'yn', 'metavar' : '<y_or_n>',
|
|
309
|
-
'short': 'r',
|
|
310
|
-
'group': 'Reports',
|
|
311
|
-
'help' : 'Tells whether to display a full report or only the '
|
|
312
|
-
'messages'}),
|
|
313
|
-
|
|
314
|
-
('evaluation',
|
|
315
|
-
{'type' : 'string', 'metavar' : '<python_expression>',
|
|
316
|
-
'group': 'Reports', 'level': 1,
|
|
317
|
-
'default': '10.0 - ((float(5 * error + warning + refactor + '
|
|
318
|
-
'convention) / statement) * 10)',
|
|
319
|
-
'help' : 'Python expression which should return a note less '
|
|
320
|
-
'than 10 (10 is the highest note). You have access '
|
|
321
|
-
'to the variables errors warning, statement which '
|
|
322
|
-
'respectively contain the number of errors / '
|
|
323
|
-
'warnings messages and the total number of '
|
|
324
|
-
'statements analyzed. This is used by the global '
|
|
325
|
-
'evaluation report (RP0004).'}),
|
|
326
|
-
|
|
327
|
-
('comment', utils.deprecated_option(opt_type='yn')),
|
|
328
|
-
|
|
329
|
-
('confidence',
|
|
330
|
-
{'type' : 'multiple_choice', 'metavar': '<levels>',
|
|
331
|
-
'default': '',
|
|
332
|
-
'choices': [c.name for c in interfaces.CONFIDENCE_LEVELS],
|
|
333
|
-
'group': 'Messages control',
|
|
334
|
-
'help' : 'Only show warnings with the listed confidence levels.'
|
|
335
|
-
' Leave empty to show all. Valid levels: %s' % (
|
|
336
|
-
', '.join(c.name for c in interfaces.CONFIDENCE_LEVELS),)}),
|
|
337
|
-
|
|
338
|
-
('enable',
|
|
339
|
-
{'type' : 'csv', 'metavar': '<msg ids>',
|
|
340
|
-
'short': 'e',
|
|
341
|
-
'group': 'Messages control',
|
|
342
|
-
'help' : 'Enable the message, report, category or checker with the '
|
|
343
|
-
'given id(s). You can either give multiple identifier '
|
|
344
|
-
'separated by comma (,) or put this option multiple time '
|
|
345
|
-
'(only on the command line, not in the configuration file '
|
|
346
|
-
'where it should appear only once). '
|
|
347
|
-
'See also the "--disable" option for examples. '}),
|
|
348
|
-
|
|
349
|
-
('disable',
|
|
350
|
-
{'type' : 'csv', 'metavar': '<msg ids>',
|
|
351
|
-
'short': 'd',
|
|
352
|
-
'group': 'Messages control',
|
|
353
|
-
'help' : 'Disable the message, report, category or checker '
|
|
354
|
-
'with the given id(s). You can either give multiple identifiers'
|
|
355
|
-
' separated by comma (,) or put this option multiple times '
|
|
356
|
-
'(only on the command line, not in the configuration file '
|
|
357
|
-
'where it should appear only once).'
|
|
358
|
-
'You can also use "--disable=all" to disable everything first '
|
|
359
|
-
'and then reenable specific checks. For example, if you want '
|
|
360
|
-
'to run only the similarities checker, you can use '
|
|
361
|
-
'"--disable=all --enable=similarities". '
|
|
362
|
-
'If you want to run only the classes checker, but have no '
|
|
363
|
-
'Warning level messages displayed, use'
|
|
364
|
-
'"--disable=all --enable=classes --disable=W"'}),
|
|
365
|
-
|
|
366
|
-
('msg-template',
|
|
367
|
-
{'type' : 'string', 'metavar': '<template>',
|
|
368
|
-
'group': 'Reports',
|
|
369
|
-
'help' : ('Template used to display messages. '
|
|
370
|
-
'This is a python new-style format string '
|
|
371
|
-
'used to format the message information. '
|
|
372
|
-
'See doc for all details')
|
|
373
|
-
}),
|
|
374
|
-
|
|
375
|
-
('include-ids', utils.deprecated_option('i', 'yn', INCLUDE_IDS_HELP)),
|
|
376
|
-
('symbols', utils.deprecated_option('s', 'yn', SYMBOLS_HELP)),
|
|
377
|
-
|
|
378
|
-
('jobs',
|
|
379
|
-
{'type' : 'int', 'metavar': '<n-processes>',
|
|
380
|
-
'short': 'j',
|
|
381
|
-
'default': 1,
|
|
382
|
-
'help' : '''Use multiple processes to speed up Pylint.''',
|
|
383
|
-
}),
|
|
384
|
-
|
|
385
|
-
('unsafe-load-any-extension',
|
|
386
|
-
{'type': 'yn', 'metavar': '<yn>', 'default': False, 'hide': True,
|
|
387
|
-
'help': ('Allow loading of arbitrary C extensions. Extensions'
|
|
388
|
-
' are imported into the active Python interpreter and'
|
|
389
|
-
' may run arbitrary code.')}),
|
|
390
|
-
|
|
391
|
-
('extension-pkg-whitelist',
|
|
392
|
-
{'type': 'csv', 'metavar': '<pkg[,pkg]>', 'default': [],
|
|
393
|
-
'help': ('A comma-separated list of package or module names'
|
|
394
|
-
' from where C extensions may be loaded. Extensions are'
|
|
395
|
-
' loading into the active Python interpreter and may run'
|
|
396
|
-
' arbitrary code')}
|
|
397
|
-
),
|
|
398
|
-
|
|
399
|
-
('optimize-ast',
|
|
400
|
-
{'type': 'yn', 'metavar': '<yn>', 'default': False,
|
|
401
|
-
'help': ('Allow optimization of some AST trees. This will '
|
|
402
|
-
'activate a peephole AST optimizer, which will '
|
|
403
|
-
'apply various small optimizations. For instance, '
|
|
404
|
-
'it can be used to obtain the result of joining '
|
|
405
|
-
'multiple strings with the addition operator. '
|
|
406
|
-
'Joining a lot of strings can lead to a maximum '
|
|
407
|
-
'recursion error in Pylint and this flag can prevent '
|
|
408
|
-
'that. It has one side effect, the resulting AST '
|
|
409
|
-
'will be different than the one from reality.')}
|
|
410
|
-
),
|
|
411
|
-
)
|
|
412
|
-
|
|
413
|
-
option_groups = (
|
|
414
|
-
('Messages control', 'Options controling analysis messages'),
|
|
415
|
-
('Reports', 'Options related to output formating and reporting'),
|
|
416
|
-
)
|
|
417
|
-
|
|
418
|
-
def __init__(self, options=(), reporter=None, option_groups=(),
|
|
419
|
-
pylintrc=None):
|
|
420
|
-
# some stuff has to be done before ancestors initialization...
|
|
421
|
-
#
|
|
422
|
-
# messages store / checkers / reporter / astroid manager
|
|
423
|
-
self.msgs_store = utils.MessagesStore()
|
|
424
|
-
self.reporter = None
|
|
425
|
-
self._reporter_name = None
|
|
426
|
-
self._reporters = {}
|
|
427
|
-
self._checkers = collections.defaultdict(list)
|
|
428
|
-
self._pragma_lineno = {}
|
|
429
|
-
self._ignore_file = False
|
|
430
|
-
# visit variables
|
|
431
|
-
self.file_state = utils.FileState()
|
|
432
|
-
self.current_name = None
|
|
433
|
-
self.current_file = None
|
|
434
|
-
self.stats = None
|
|
435
|
-
# init options
|
|
436
|
-
self._external_opts = options
|
|
437
|
-
self.options = options + PyLinter.make_options()
|
|
438
|
-
self.option_groups = option_groups + PyLinter.option_groups
|
|
439
|
-
self._options_methods = {
|
|
440
|
-
'enable': self.enable,
|
|
441
|
-
'disable': self.disable}
|
|
442
|
-
self._bw_options_methods = {'disable-msg': self.disable,
|
|
443
|
-
'enable-msg': self.enable}
|
|
444
|
-
full_version = '%%prog %s, \nastroid %s\nPython %s' % (
|
|
445
|
-
version, astroid_version, sys.version)
|
|
446
|
-
utils.MessagesHandlerMixIn.__init__(self)
|
|
447
|
-
utils.ReportsHandlerMixIn.__init__(self)
|
|
448
|
-
super(PyLinter, self).__init__(
|
|
449
|
-
usage=__doc__,
|
|
450
|
-
version=full_version,
|
|
451
|
-
config_file=pylintrc or config.PYLINTRC)
|
|
452
|
-
checkers.BaseTokenChecker.__init__(self)
|
|
453
|
-
# provided reports
|
|
454
|
-
self.reports = (('RP0001', 'Messages by category',
|
|
455
|
-
report_total_messages_stats),
|
|
456
|
-
('RP0002', '% errors / warnings by module',
|
|
457
|
-
report_messages_by_module_stats),
|
|
458
|
-
('RP0003', 'Messages',
|
|
459
|
-
report_messages_stats),
|
|
460
|
-
('RP0004', 'Global evaluation',
|
|
461
|
-
self.report_evaluation),
|
|
462
|
-
)
|
|
463
|
-
self.register_checker(self)
|
|
464
|
-
self._dynamic_plugins = set()
|
|
465
|
-
self._python3_porting_mode = False
|
|
466
|
-
self._error_mode = False
|
|
467
|
-
self.load_provider_defaults()
|
|
468
|
-
if reporter:
|
|
469
|
-
self.set_reporter(reporter)
|
|
470
|
-
|
|
471
|
-
def load_default_plugins(self):
|
|
472
|
-
checkers.initialize(self)
|
|
473
|
-
reporters.initialize(self)
|
|
474
|
-
# Make sure to load the default reporter, because
|
|
475
|
-
# the option has been set before the plugins had been loaded.
|
|
476
|
-
if not self.reporter:
|
|
477
|
-
self._load_reporter()
|
|
478
|
-
|
|
479
|
-
def load_plugin_modules(self, modnames):
|
|
480
|
-
"""take a list of module names which are pylint plugins and load
|
|
481
|
-
and register them
|
|
482
|
-
"""
|
|
483
|
-
for modname in modnames:
|
|
484
|
-
if modname in self._dynamic_plugins:
|
|
485
|
-
continue
|
|
486
|
-
self._dynamic_plugins.add(modname)
|
|
487
|
-
module = modutils.load_module_from_name(modname)
|
|
488
|
-
module.register(self)
|
|
489
|
-
|
|
490
|
-
def _load_reporter(self):
|
|
491
|
-
name = self._reporter_name.lower()
|
|
492
|
-
if name in self._reporters:
|
|
493
|
-
self.set_reporter(self._reporters[name]())
|
|
494
|
-
else:
|
|
495
|
-
qname = self._reporter_name
|
|
496
|
-
module = modutils.load_module_from_name(
|
|
497
|
-
modutils.get_module_part(qname))
|
|
498
|
-
class_name = qname.split('.')[-1]
|
|
499
|
-
reporter_class = getattr(module, class_name)
|
|
500
|
-
self.set_reporter(reporter_class())
|
|
501
|
-
|
|
502
|
-
def set_reporter(self, reporter):
|
|
503
|
-
"""set the reporter used to display messages and reports"""
|
|
504
|
-
self.reporter = reporter
|
|
505
|
-
reporter.linter = self
|
|
506
|
-
|
|
507
|
-
def set_option(self, optname, value, action=None, optdict=None):
|
|
508
|
-
"""overridden from config.OptionsProviderMixin to handle some
|
|
509
|
-
special options
|
|
510
|
-
"""
|
|
511
|
-
if optname in self._options_methods or \
|
|
512
|
-
optname in self._bw_options_methods:
|
|
513
|
-
if value:
|
|
514
|
-
try:
|
|
515
|
-
meth = self._options_methods[optname]
|
|
516
|
-
except KeyError:
|
|
517
|
-
meth = self._bw_options_methods[optname]
|
|
518
|
-
warnings.warn('%s is deprecated, replace it by %s' % (optname,
|
|
519
|
-
optname.split('-')[0]),
|
|
520
|
-
DeprecationWarning)
|
|
521
|
-
value = utils._check_csv(value)
|
|
522
|
-
if isinstance(value, (list, tuple)):
|
|
523
|
-
for _id in value:
|
|
524
|
-
meth(_id, ignore_unknown=True)
|
|
525
|
-
else:
|
|
526
|
-
meth(value)
|
|
527
|
-
return # no need to call set_option, disable/enable methods do it
|
|
528
|
-
elif optname == 'output-format':
|
|
529
|
-
self._reporter_name = value
|
|
530
|
-
# If the reporters are already available, load
|
|
531
|
-
# the reporter class.
|
|
532
|
-
if self._reporters:
|
|
533
|
-
self._load_reporter()
|
|
534
|
-
|
|
535
|
-
try:
|
|
536
|
-
checkers.BaseTokenChecker.set_option(self, optname,
|
|
537
|
-
value, action, optdict)
|
|
538
|
-
except config.UnsupportedAction:
|
|
539
|
-
print('option %s can\'t be read from config file' % \
|
|
540
|
-
optname, file=sys.stderr)
|
|
541
|
-
|
|
542
|
-
def register_reporter(self, reporter_class):
|
|
543
|
-
self._reporters[reporter_class.name] = reporter_class
|
|
544
|
-
|
|
545
|
-
def report_order(self):
|
|
546
|
-
reports = sorted(self._reports, key=lambda x: getattr(x, 'name', ''))
|
|
547
|
-
try:
|
|
548
|
-
# Remove the current reporter and add it
|
|
549
|
-
# at the end of the list.
|
|
550
|
-
reports.pop(reports.index(self))
|
|
551
|
-
except ValueError:
|
|
552
|
-
pass
|
|
553
|
-
else:
|
|
554
|
-
reports.append(self)
|
|
555
|
-
return reports
|
|
556
|
-
|
|
557
|
-
# checkers manipulation methods ############################################
|
|
558
|
-
|
|
559
|
-
def register_checker(self, checker):
|
|
560
|
-
"""register a new checker
|
|
561
|
-
|
|
562
|
-
checker is an object implementing IRawChecker or / and IAstroidChecker
|
|
563
|
-
"""
|
|
564
|
-
assert checker.priority <= 0, 'checker priority can\'t be >= 0'
|
|
565
|
-
self._checkers[checker.name].append(checker)
|
|
566
|
-
for r_id, r_title, r_cb in checker.reports:
|
|
567
|
-
self.register_report(r_id, r_title, r_cb, checker)
|
|
568
|
-
self.register_options_provider(checker)
|
|
569
|
-
if hasattr(checker, 'msgs'):
|
|
570
|
-
self.msgs_store.register_messages(checker)
|
|
571
|
-
checker.load_defaults()
|
|
572
|
-
|
|
573
|
-
# Register the checker, but disable all of its messages.
|
|
574
|
-
# TODO(cpopa): we should have a better API for this.
|
|
575
|
-
if not getattr(checker, 'enabled', True):
|
|
576
|
-
self.disable(checker.name)
|
|
577
|
-
|
|
578
|
-
def disable_noerror_messages(self):
|
|
579
|
-
for msgcat, msgids in six.iteritems(self.msgs_store._msgs_by_category):
|
|
580
|
-
if msgcat == 'E':
|
|
581
|
-
for msgid in msgids:
|
|
582
|
-
self.enable(msgid)
|
|
583
|
-
else:
|
|
584
|
-
for msgid in msgids:
|
|
585
|
-
self.disable(msgid)
|
|
586
|
-
|
|
587
|
-
def disable_reporters(self):
|
|
588
|
-
"""disable all reporters"""
|
|
589
|
-
for _reporters in six.itervalues(self._reports):
|
|
590
|
-
for report_id, _, _ in _reporters:
|
|
591
|
-
self.disable_report(report_id)
|
|
592
|
-
|
|
593
|
-
def error_mode(self):
|
|
594
|
-
"""error mode: enable only errors; no reports, no persistent"""
|
|
595
|
-
self._error_mode = True
|
|
596
|
-
self.disable_noerror_messages()
|
|
597
|
-
self.disable('miscellaneous')
|
|
598
|
-
if self._python3_porting_mode:
|
|
599
|
-
self.disable('all')
|
|
600
|
-
for msg_id in self._checker_messages('python3'):
|
|
601
|
-
if msg_id.startswith('E'):
|
|
602
|
-
self.enable(msg_id)
|
|
603
|
-
else:
|
|
604
|
-
self.disable('python3')
|
|
605
|
-
self.set_option('reports', False)
|
|
606
|
-
self.set_option('persistent', False)
|
|
607
|
-
|
|
608
|
-
def python3_porting_mode(self):
|
|
609
|
-
"""Disable all other checkers and enable Python 3 warnings."""
|
|
610
|
-
self.disable('all')
|
|
611
|
-
self.enable('python3')
|
|
612
|
-
if self._error_mode:
|
|
613
|
-
# The error mode was activated, using the -E flag.
|
|
614
|
-
# So we'll need to enable only the errors from the
|
|
615
|
-
# Python 3 porting checker.
|
|
616
|
-
for msg_id in self._checker_messages('python3'):
|
|
617
|
-
if msg_id.startswith('E'):
|
|
618
|
-
self.enable(msg_id)
|
|
619
|
-
else:
|
|
620
|
-
self.disable(msg_id)
|
|
621
|
-
self._python3_porting_mode = True
|
|
622
|
-
|
|
623
|
-
# block level option handling #############################################
|
|
624
|
-
#
|
|
625
|
-
# see func_block_disable_msg.py test case for expected behaviour
|
|
626
|
-
|
|
627
|
-
def process_tokens(self, tokens):
|
|
628
|
-
"""process tokens from the current module to search for module/block
|
|
629
|
-
level options
|
|
630
|
-
"""
|
|
631
|
-
control_pragmas = {'disable', 'enable'}
|
|
632
|
-
for (tok_type, content, start, _, _) in tokens:
|
|
633
|
-
if tok_type != tokenize.COMMENT:
|
|
634
|
-
continue
|
|
635
|
-
match = utils.OPTION_RGX.search(content)
|
|
636
|
-
if match is None:
|
|
637
|
-
continue
|
|
638
|
-
if match.group(1).strip() == "disable-all" or \
|
|
639
|
-
match.group(1).strip() == 'skip-file':
|
|
640
|
-
if match.group(1).strip() == "disable-all":
|
|
641
|
-
self.add_message('deprecated-pragma', line=start[0],
|
|
642
|
-
args=('disable-all', 'skip-file'))
|
|
643
|
-
self.add_message('file-ignored', line=start[0])
|
|
644
|
-
self._ignore_file = True
|
|
645
|
-
return
|
|
646
|
-
try:
|
|
647
|
-
opt, value = match.group(1).split('=', 1)
|
|
648
|
-
except ValueError:
|
|
649
|
-
self.add_message('bad-inline-option', args=match.group(1).strip(),
|
|
650
|
-
line=start[0])
|
|
651
|
-
continue
|
|
652
|
-
opt = opt.strip()
|
|
653
|
-
if opt in self._options_methods or opt in self._bw_options_methods:
|
|
654
|
-
try:
|
|
655
|
-
meth = self._options_methods[opt]
|
|
656
|
-
except KeyError:
|
|
657
|
-
meth = self._bw_options_methods[opt]
|
|
658
|
-
# found a "(dis|en)able-msg" pragma deprecated suppresssion
|
|
659
|
-
self.add_message('deprecated-pragma', line=start[0],
|
|
660
|
-
args=(opt, opt.replace('-msg', '')))
|
|
661
|
-
for msgid in utils._splitstrip(value):
|
|
662
|
-
# Add the line where a control pragma was encountered.
|
|
663
|
-
if opt in control_pragmas:
|
|
664
|
-
self._pragma_lineno[msgid] = start[0]
|
|
665
|
-
|
|
666
|
-
try:
|
|
667
|
-
if (opt, msgid) == ('disable', 'all'):
|
|
668
|
-
self.add_message('deprecated-pragma', line=start[0],
|
|
669
|
-
args=('disable=all', 'skip-file'))
|
|
670
|
-
self.add_message('file-ignored', line=start[0])
|
|
671
|
-
self._ignore_file = True
|
|
672
|
-
return
|
|
673
|
-
meth(msgid, 'module', start[0])
|
|
674
|
-
except utils.UnknownMessage:
|
|
675
|
-
self.add_message('bad-option-value', args=msgid, line=start[0])
|
|
676
|
-
else:
|
|
677
|
-
self.add_message('unrecognized-inline-option', args=opt, line=start[0])
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
# code checking methods ###################################################
|
|
681
|
-
|
|
682
|
-
def get_checkers(self):
|
|
683
|
-
"""return all available checkers as a list"""
|
|
684
|
-
return [self] + [c for _checkers in six.itervalues(self._checkers)
|
|
685
|
-
for c in _checkers if c is not self]
|
|
686
|
-
|
|
687
|
-
def prepare_checkers(self):
|
|
688
|
-
"""return checkers needed for activated messages and reports"""
|
|
689
|
-
if not self.config.reports:
|
|
690
|
-
self.disable_reporters()
|
|
691
|
-
# get needed checkers
|
|
692
|
-
neededcheckers = [self]
|
|
693
|
-
for checker in self.get_checkers()[1:]:
|
|
694
|
-
# fatal errors should not trigger enable / disabling a checker
|
|
695
|
-
messages = set(msg for msg in checker.msgs
|
|
696
|
-
if msg[0] != 'F' and self.is_message_enabled(msg))
|
|
697
|
-
if (messages or
|
|
698
|
-
any(self.report_is_enabled(r[0]) for r in checker.reports)):
|
|
699
|
-
neededcheckers.append(checker)
|
|
700
|
-
# Sort checkers by priority
|
|
701
|
-
neededcheckers = sorted(neededcheckers,
|
|
702
|
-
key=operator.attrgetter('priority'),
|
|
703
|
-
reverse=True)
|
|
704
|
-
return neededcheckers
|
|
705
|
-
|
|
706
|
-
def should_analyze_file(self, modname, path): # pylint: disable=unused-argument, no-self-use
|
|
707
|
-
"""Returns whether or not a module should be checked.
|
|
708
|
-
|
|
709
|
-
This implementation returns True for all python source file, indicating
|
|
710
|
-
that all files should be linted.
|
|
711
|
-
|
|
712
|
-
Subclasses may override this method to indicate that modules satisfying
|
|
713
|
-
certain conditions should not be linted.
|
|
714
|
-
|
|
715
|
-
:param str modname: The name of the module to be checked.
|
|
716
|
-
:param str path: The full path to the source code of the module.
|
|
717
|
-
:returns: True if the module should be checked.
|
|
718
|
-
:rtype: bool
|
|
719
|
-
"""
|
|
720
|
-
return path.endswith('.py')
|
|
721
|
-
|
|
722
|
-
def check(self, files_or_modules):
|
|
723
|
-
"""main checking entry: check a list of files or modules from their
|
|
724
|
-
name.
|
|
725
|
-
"""
|
|
726
|
-
# initialize msgs_state now that all messages have been registered into
|
|
727
|
-
# the store
|
|
728
|
-
for msg in self.msgs_store.messages:
|
|
729
|
-
if not msg.may_be_emitted():
|
|
730
|
-
self._msgs_state[msg.msgid] = False
|
|
731
|
-
|
|
732
|
-
if not isinstance(files_or_modules, (list, tuple)):
|
|
733
|
-
files_or_modules = (files_or_modules,)
|
|
734
|
-
|
|
735
|
-
if self.config.jobs == 1:
|
|
736
|
-
with fix_import_path(files_or_modules):
|
|
737
|
-
self._do_check(files_or_modules)
|
|
738
|
-
else:
|
|
739
|
-
with _patch_sysmodules():
|
|
740
|
-
self._parallel_check(files_or_modules)
|
|
741
|
-
|
|
742
|
-
def _get_jobs_config(self):
|
|
743
|
-
child_config = collections.OrderedDict()
|
|
744
|
-
filter_options = {'symbols', 'include-ids', 'long-help'}
|
|
745
|
-
filter_options.update((opt_name for opt_name, _ in self._external_opts))
|
|
746
|
-
for opt_providers in six.itervalues(self._all_options):
|
|
747
|
-
for optname, optdict, val in opt_providers.options_and_values():
|
|
748
|
-
if optdict.get('deprecated'):
|
|
749
|
-
continue
|
|
750
|
-
|
|
751
|
-
if optname not in filter_options:
|
|
752
|
-
child_config[optname] = utils._format_option_value(
|
|
753
|
-
optdict, val)
|
|
754
|
-
child_config['python3_porting_mode'] = self._python3_porting_mode
|
|
755
|
-
child_config['plugins'] = self._dynamic_plugins
|
|
756
|
-
return child_config
|
|
757
|
-
|
|
758
|
-
def _parallel_task(self, files_or_modules):
|
|
759
|
-
# Prepare configuration for child linters.
|
|
760
|
-
child_config = self._get_jobs_config()
|
|
761
|
-
|
|
762
|
-
children = []
|
|
763
|
-
manager = multiprocessing.Manager()
|
|
764
|
-
tasks_queue = manager.Queue()
|
|
765
|
-
results_queue = manager.Queue()
|
|
766
|
-
|
|
767
|
-
for _ in range(self.config.jobs):
|
|
768
|
-
child_linter = ChildLinter(args=(tasks_queue, results_queue,
|
|
769
|
-
child_config))
|
|
770
|
-
child_linter.start()
|
|
771
|
-
children.append(child_linter)
|
|
772
|
-
|
|
773
|
-
# Send files to child linters.
|
|
774
|
-
expanded_files = self.expand_files(files_or_modules)
|
|
775
|
-
for files_or_module in expanded_files:
|
|
776
|
-
path = files_or_module['path']
|
|
777
|
-
tasks_queue.put([path])
|
|
778
|
-
|
|
779
|
-
# collect results from child linters
|
|
780
|
-
failed = False
|
|
781
|
-
for _ in expanded_files:
|
|
782
|
-
try:
|
|
783
|
-
result = results_queue.get()
|
|
784
|
-
except Exception as ex:
|
|
785
|
-
print("internal error while receiving results from child linter",
|
|
786
|
-
file=sys.stderr)
|
|
787
|
-
print(ex, file=sys.stderr)
|
|
788
|
-
failed = True
|
|
789
|
-
break
|
|
790
|
-
yield result
|
|
791
|
-
|
|
792
|
-
# Stop child linters and wait for their completion.
|
|
793
|
-
for _ in range(self.config.jobs):
|
|
794
|
-
tasks_queue.put('STOP')
|
|
795
|
-
for child in children:
|
|
796
|
-
child.join()
|
|
797
|
-
|
|
798
|
-
if failed:
|
|
799
|
-
print("Error occured, stopping the linter.", file=sys.stderr)
|
|
800
|
-
sys.exit(32)
|
|
801
|
-
|
|
802
|
-
def _parallel_check(self, files_or_modules):
|
|
803
|
-
# Reset stats.
|
|
804
|
-
self.open()
|
|
805
|
-
|
|
806
|
-
all_stats = []
|
|
807
|
-
module = None
|
|
808
|
-
for result in self._parallel_task(files_or_modules):
|
|
809
|
-
(
|
|
810
|
-
_,
|
|
811
|
-
self.file_state.base_name,
|
|
812
|
-
module,
|
|
813
|
-
messages,
|
|
814
|
-
stats,
|
|
815
|
-
msg_status
|
|
816
|
-
) = result
|
|
817
|
-
|
|
818
|
-
for msg in messages:
|
|
819
|
-
msg = utils.Message(*msg)
|
|
820
|
-
self.set_current_module(module)
|
|
821
|
-
self.reporter.handle_message(msg)
|
|
822
|
-
|
|
823
|
-
all_stats.append(stats)
|
|
824
|
-
self.msg_status |= msg_status
|
|
825
|
-
|
|
826
|
-
self.stats = _merge_stats(all_stats)
|
|
827
|
-
self.current_name = module
|
|
828
|
-
|
|
829
|
-
# Insert stats data to local checkers.
|
|
830
|
-
for checker in self.get_checkers():
|
|
831
|
-
if checker is not self:
|
|
832
|
-
checker.stats = self.stats
|
|
833
|
-
|
|
834
|
-
def _do_check(self, files_or_modules):
|
|
835
|
-
walker = utils.PyLintASTWalker(self)
|
|
836
|
-
_checkers = self.prepare_checkers()
|
|
837
|
-
tokencheckers = [c for c in _checkers
|
|
838
|
-
if interfaces.implements(c, interfaces.ITokenChecker)
|
|
839
|
-
and c is not self]
|
|
840
|
-
rawcheckers = [c for c in _checkers
|
|
841
|
-
if interfaces.implements(c, interfaces.IRawChecker)]
|
|
842
|
-
# notify global begin
|
|
843
|
-
for checker in _checkers:
|
|
844
|
-
checker.open()
|
|
845
|
-
if interfaces.implements(checker, interfaces.IAstroidChecker):
|
|
846
|
-
walker.add_checker(checker)
|
|
847
|
-
# build ast and check modules or packages
|
|
848
|
-
for descr in self.expand_files(files_or_modules):
|
|
849
|
-
modname, filepath = descr['name'], descr['path']
|
|
850
|
-
if not descr['isarg'] and not self.should_analyze_file(modname, filepath):
|
|
851
|
-
continue
|
|
852
|
-
if self.config.files_output:
|
|
853
|
-
reportfile = 'pylint_%s.%s' % (modname, self.reporter.extension)
|
|
854
|
-
self.reporter.set_output(open(reportfile, 'w'))
|
|
855
|
-
self.set_current_module(modname, filepath)
|
|
856
|
-
# get the module representation
|
|
857
|
-
ast_node = self.get_ast(filepath, modname)
|
|
858
|
-
if ast_node is None:
|
|
859
|
-
continue
|
|
860
|
-
# XXX to be correct we need to keep module_msgs_state for every
|
|
861
|
-
# analyzed module (the problem stands with localized messages which
|
|
862
|
-
# are only detected in the .close step)
|
|
863
|
-
self.file_state = utils.FileState(descr['basename'])
|
|
864
|
-
self._ignore_file = False
|
|
865
|
-
# fix the current file (if the source file was not available or
|
|
866
|
-
# if it's actually a c extension)
|
|
867
|
-
self.current_file = ast_node.file # pylint: disable=maybe-no-member
|
|
868
|
-
self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
|
|
869
|
-
# warn about spurious inline messages handling
|
|
870
|
-
spurious_messages = self.file_state.iter_spurious_suppression_messages(self.msgs_store)
|
|
871
|
-
for msgid, line, args in spurious_messages:
|
|
872
|
-
self.add_message(msgid, line, None, args)
|
|
873
|
-
# notify global end
|
|
874
|
-
self.stats['statement'] = walker.nbstatements
|
|
875
|
-
for checker in reversed(_checkers):
|
|
876
|
-
checker.close()
|
|
877
|
-
|
|
878
|
-
def expand_files(self, modules):
|
|
879
|
-
"""get modules and errors from a list of modules and handle errors
|
|
880
|
-
"""
|
|
881
|
-
result, errors = utils.expand_modules(modules, self.config.black_list)
|
|
882
|
-
for error in errors:
|
|
883
|
-
message = modname = error["mod"]
|
|
884
|
-
key = error["key"]
|
|
885
|
-
self.set_current_module(modname)
|
|
886
|
-
if key == "fatal":
|
|
887
|
-
message = str(error["ex"]).replace(os.getcwd() + os.sep, '')
|
|
888
|
-
self.add_message(key, args=message)
|
|
889
|
-
return result
|
|
890
|
-
|
|
891
|
-
def set_current_module(self, modname, filepath=None):
|
|
892
|
-
"""set the name of the currently analyzed module and
|
|
893
|
-
init statistics for it
|
|
894
|
-
"""
|
|
895
|
-
if not modname and filepath is None:
|
|
896
|
-
return
|
|
897
|
-
self.reporter.on_set_current_module(modname, filepath)
|
|
898
|
-
self.current_name = modname
|
|
899
|
-
self.current_file = filepath or modname
|
|
900
|
-
self.stats['by_module'][modname] = {}
|
|
901
|
-
self.stats['by_module'][modname]['statement'] = 0
|
|
902
|
-
for msg_cat in six.itervalues(utils.MSG_TYPES):
|
|
903
|
-
self.stats['by_module'][modname][msg_cat] = 0
|
|
904
|
-
|
|
905
|
-
def get_ast(self, filepath, modname):
|
|
906
|
-
"""return a ast(roid) representation for a module"""
|
|
907
|
-
try:
|
|
908
|
-
return MANAGER.ast_from_file(filepath, modname, source=True)
|
|
909
|
-
except astroid.AstroidBuildingException as ex:
|
|
910
|
-
if isinstance(ex.args[0], SyntaxError):
|
|
911
|
-
ex = ex.args[0]
|
|
912
|
-
self.add_message('syntax-error',
|
|
913
|
-
line=ex.lineno or 0,
|
|
914
|
-
args=ex.msg)
|
|
915
|
-
else:
|
|
916
|
-
self.add_message('parse-error', args=ex)
|
|
917
|
-
except Exception as ex: # pylint: disable=broad-except
|
|
918
|
-
import traceback
|
|
919
|
-
traceback.print_exc()
|
|
920
|
-
self.add_message('astroid-error', args=(ex.__class__, ex))
|
|
921
|
-
|
|
922
|
-
def check_astroid_module(self, ast_node, walker,
|
|
923
|
-
rawcheckers, tokencheckers):
|
|
924
|
-
"""Check a module from its astroid representation."""
|
|
925
|
-
try:
|
|
926
|
-
tokens = utils.tokenize_module(ast_node)
|
|
927
|
-
except tokenize.TokenError as ex:
|
|
928
|
-
self.add_message('syntax-error', line=ex.args[1][0], args=ex.args[0])
|
|
929
|
-
return
|
|
930
|
-
|
|
931
|
-
if not ast_node.pure_python:
|
|
932
|
-
self.add_message('raw-checker-failed', args=ast_node.name)
|
|
933
|
-
else:
|
|
934
|
-
#assert astroid.file.endswith('.py')
|
|
935
|
-
# invoke ITokenChecker interface on self to fetch module/block
|
|
936
|
-
# level options
|
|
937
|
-
self.process_tokens(tokens)
|
|
938
|
-
if self._ignore_file:
|
|
939
|
-
return False
|
|
940
|
-
# walk ast to collect line numbers
|
|
941
|
-
self.file_state.collect_block_lines(self.msgs_store, ast_node)
|
|
942
|
-
# run raw and tokens checkers
|
|
943
|
-
for checker in rawcheckers:
|
|
944
|
-
checker.process_module(ast_node)
|
|
945
|
-
for checker in tokencheckers:
|
|
946
|
-
checker.process_tokens(tokens)
|
|
947
|
-
# generate events to astroid checkers
|
|
948
|
-
walker.walk(ast_node)
|
|
949
|
-
return True
|
|
950
|
-
|
|
951
|
-
# IAstroidChecker interface #################################################
|
|
952
|
-
|
|
953
|
-
def open(self):
|
|
954
|
-
"""initialize counters"""
|
|
955
|
-
self.stats = {'by_module' : {},
|
|
956
|
-
'by_msg' : {},
|
|
957
|
-
}
|
|
958
|
-
MANAGER.optimize_ast = self.config.optimize_ast
|
|
959
|
-
MANAGER.always_load_extensions = self.config.unsafe_load_any_extension
|
|
960
|
-
MANAGER.extension_package_whitelist.update(
|
|
961
|
-
self.config.extension_pkg_whitelist)
|
|
962
|
-
for msg_cat in six.itervalues(utils.MSG_TYPES):
|
|
963
|
-
self.stats[msg_cat] = 0
|
|
964
|
-
|
|
965
|
-
def generate_reports(self):
|
|
966
|
-
"""close the whole package /module, it's time to make reports !
|
|
967
|
-
|
|
968
|
-
if persistent run, pickle results for later comparison
|
|
969
|
-
"""
|
|
970
|
-
# Display whatever messages are left on the reporter.
|
|
971
|
-
self.reporter.display_messages(report_nodes.Section())
|
|
972
|
-
|
|
973
|
-
if self.file_state.base_name is not None:
|
|
974
|
-
# load previous results if any
|
|
975
|
-
previous_stats = config.load_results(self.file_state.base_name)
|
|
976
|
-
# XXX code below needs refactoring to be more reporter agnostic
|
|
977
|
-
self.reporter.on_close(self.stats, previous_stats)
|
|
978
|
-
if self.config.reports:
|
|
979
|
-
sect = self.make_reports(self.stats, previous_stats)
|
|
980
|
-
if self.config.files_output:
|
|
981
|
-
filename = 'pylint_global.' + self.reporter.extension
|
|
982
|
-
self.reporter.set_output(open(filename, 'w'))
|
|
983
|
-
else:
|
|
984
|
-
sect = report_nodes.Section()
|
|
985
|
-
if self.config.reports:
|
|
986
|
-
self.reporter.display_reports(sect)
|
|
987
|
-
# save results if persistent run
|
|
988
|
-
if self.config.persistent:
|
|
989
|
-
config.save_results(self.stats, self.file_state.base_name)
|
|
990
|
-
else:
|
|
991
|
-
self.reporter.on_close(self.stats, {})
|
|
992
|
-
|
|
993
|
-
# specific reports ########################################################
|
|
994
|
-
|
|
995
|
-
def report_evaluation(self, sect, stats, previous_stats):
|
|
996
|
-
"""make the global evaluation report"""
|
|
997
|
-
# check with at least check 1 statements (usually 0 when there is a
|
|
998
|
-
# syntax error preventing pylint from further processing)
|
|
999
|
-
if stats['statement'] == 0:
|
|
1000
|
-
raise utils.EmptyReport()
|
|
1001
|
-
# get a global note for the code
|
|
1002
|
-
evaluation = self.config.evaluation
|
|
1003
|
-
try:
|
|
1004
|
-
note = eval(evaluation, {}, self.stats) # pylint: disable=eval-used
|
|
1005
|
-
except Exception as ex: # pylint: disable=broad-except
|
|
1006
|
-
msg = 'An exception occurred while rating: %s' % ex
|
|
1007
|
-
else:
|
|
1008
|
-
stats['global_note'] = note
|
|
1009
|
-
msg = 'Your code has been rated at %.2f/10' % note
|
|
1010
|
-
pnote = previous_stats.get('global_note')
|
|
1011
|
-
if pnote is not None:
|
|
1012
|
-
msg += ' (previous run: %.2f/10, %+.2f)' % (pnote, note - pnote)
|
|
1013
|
-
sect.append(report_nodes.Text(msg))
|
|
1014
|
-
|
|
1015
|
-
# some reporting functions ####################################################
|
|
1016
|
-
|
|
1017
|
-
def report_total_messages_stats(sect, stats, previous_stats):
|
|
1018
|
-
"""make total errors / warnings report"""
|
|
1019
|
-
lines = ['type', 'number', 'previous', 'difference']
|
|
1020
|
-
lines += checkers.table_lines_from_stats(stats, previous_stats,
|
|
1021
|
-
('convention', 'refactor',
|
|
1022
|
-
'warning', 'error'))
|
|
1023
|
-
sect.append(report_nodes.Table(children=lines, cols=4, rheaders=1))
|
|
1024
|
-
|
|
1025
|
-
def report_messages_stats(sect, stats, _):
|
|
1026
|
-
"""make messages type report"""
|
|
1027
|
-
if not stats['by_msg']:
|
|
1028
|
-
# don't print this report when we didn't detected any errors
|
|
1029
|
-
raise utils.EmptyReport()
|
|
1030
|
-
in_order = sorted([(value, msg_id)
|
|
1031
|
-
for msg_id, value in six.iteritems(stats['by_msg'])
|
|
1032
|
-
if not msg_id.startswith('I')])
|
|
1033
|
-
in_order.reverse()
|
|
1034
|
-
lines = ('message id', 'occurrences')
|
|
1035
|
-
for value, msg_id in in_order:
|
|
1036
|
-
lines += (msg_id, str(value))
|
|
1037
|
-
sect.append(report_nodes.Table(children=lines, cols=2, rheaders=1))
|
|
1038
|
-
|
|
1039
|
-
def report_messages_by_module_stats(sect, stats, _):
|
|
1040
|
-
"""make errors / warnings by modules report"""
|
|
1041
|
-
if len(stats['by_module']) == 1:
|
|
1042
|
-
# don't print this report when we are analysing a single module
|
|
1043
|
-
raise utils.EmptyReport()
|
|
1044
|
-
by_mod = collections.defaultdict(dict)
|
|
1045
|
-
for m_type in ('fatal', 'error', 'warning', 'refactor', 'convention'):
|
|
1046
|
-
total = stats[m_type]
|
|
1047
|
-
for module in six.iterkeys(stats['by_module']):
|
|
1048
|
-
mod_total = stats['by_module'][module][m_type]
|
|
1049
|
-
if total == 0:
|
|
1050
|
-
percent = 0
|
|
1051
|
-
else:
|
|
1052
|
-
percent = float((mod_total)*100) / total
|
|
1053
|
-
by_mod[module][m_type] = percent
|
|
1054
|
-
sorted_result = []
|
|
1055
|
-
for module, mod_info in six.iteritems(by_mod):
|
|
1056
|
-
sorted_result.append((mod_info['error'],
|
|
1057
|
-
mod_info['warning'],
|
|
1058
|
-
mod_info['refactor'],
|
|
1059
|
-
mod_info['convention'],
|
|
1060
|
-
module))
|
|
1061
|
-
sorted_result.sort()
|
|
1062
|
-
sorted_result.reverse()
|
|
1063
|
-
lines = ['module', 'error', 'warning', 'refactor', 'convention']
|
|
1064
|
-
for line in sorted_result:
|
|
1065
|
-
# Don't report clean modules.
|
|
1066
|
-
if all(entry == 0 for entry in line[:-1]):
|
|
1067
|
-
continue
|
|
1068
|
-
lines.append(line[-1])
|
|
1069
|
-
for val in line[:-1]:
|
|
1070
|
-
lines.append('%.2f' % val)
|
|
1071
|
-
if len(lines) == 5:
|
|
1072
|
-
raise utils.EmptyReport()
|
|
1073
|
-
sect.append(report_nodes.Table(children=lines, cols=5, rheaders=1))
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
# utilities ###################################################################
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
class ArgumentPreprocessingError(Exception):
|
|
1080
|
-
"""Raised if an error occurs during argument preprocessing."""
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
def preprocess_options(args, search_for):
|
|
1084
|
-
"""look for some options (keys of <search_for>) which have to be processed
|
|
1085
|
-
before others
|
|
1086
|
-
|
|
1087
|
-
values of <search_for> are callback functions to call when the option is
|
|
1088
|
-
found
|
|
1089
|
-
"""
|
|
1090
|
-
i = 0
|
|
1091
|
-
while i < len(args):
|
|
1092
|
-
arg = args[i]
|
|
1093
|
-
if arg.startswith('--'):
|
|
1094
|
-
try:
|
|
1095
|
-
option, val = arg[2:].split('=', 1)
|
|
1096
|
-
except ValueError:
|
|
1097
|
-
option, val = arg[2:], None
|
|
1098
|
-
try:
|
|
1099
|
-
cb, takearg = search_for[option]
|
|
1100
|
-
except KeyError:
|
|
1101
|
-
i += 1
|
|
1102
|
-
else:
|
|
1103
|
-
del args[i]
|
|
1104
|
-
if takearg and val is None:
|
|
1105
|
-
if i >= len(args) or args[i].startswith('-'):
|
|
1106
|
-
msg = 'Option %s expects a value' % option
|
|
1107
|
-
raise ArgumentPreprocessingError(msg)
|
|
1108
|
-
val = args[i]
|
|
1109
|
-
del args[i]
|
|
1110
|
-
elif not takearg and val is not None:
|
|
1111
|
-
msg = "Option %s doesn't expects a value" % option
|
|
1112
|
-
raise ArgumentPreprocessingError(msg)
|
|
1113
|
-
cb(option, val)
|
|
1114
|
-
else:
|
|
1115
|
-
i += 1
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
@contextlib.contextmanager
|
|
1119
|
-
def fix_import_path(args):
|
|
1120
|
-
"""Prepare sys.path for running the linter checks.
|
|
1121
|
-
|
|
1122
|
-
Within this context, each of the given arguments is importable.
|
|
1123
|
-
Paths are added to sys.path in corresponding order to the arguments.
|
|
1124
|
-
We avoid adding duplicate directories to sys.path.
|
|
1125
|
-
`sys.path` is reset to its original value upon exitign this context.
|
|
1126
|
-
"""
|
|
1127
|
-
orig = list(sys.path)
|
|
1128
|
-
changes = []
|
|
1129
|
-
for arg in args:
|
|
1130
|
-
path = _get_python_path(arg)
|
|
1131
|
-
if path in changes:
|
|
1132
|
-
continue
|
|
1133
|
-
else:
|
|
1134
|
-
changes.append(path)
|
|
1135
|
-
sys.path[:] = changes + sys.path
|
|
1136
|
-
try:
|
|
1137
|
-
yield
|
|
1138
|
-
finally:
|
|
1139
|
-
sys.path[:] = orig
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
class Run(object):
|
|
1143
|
-
"""helper class to use as main for pylint :
|
|
1144
|
-
|
|
1145
|
-
run(*sys.argv[1:])
|
|
1146
|
-
"""
|
|
1147
|
-
LinterClass = PyLinter
|
|
1148
|
-
option_groups = (
|
|
1149
|
-
('Commands', 'Options which are actually commands. Options in this \
|
|
1150
|
-
group are mutually exclusive.'),
|
|
1151
|
-
)
|
|
1152
|
-
|
|
1153
|
-
def __init__(self, args, reporter=None, exit=True):
|
|
1154
|
-
self._rcfile = None
|
|
1155
|
-
self._plugins = []
|
|
1156
|
-
try:
|
|
1157
|
-
preprocess_options(args, {
|
|
1158
|
-
# option: (callback, takearg)
|
|
1159
|
-
'init-hook': (cb_init_hook, True),
|
|
1160
|
-
'rcfile': (self.cb_set_rcfile, True),
|
|
1161
|
-
'load-plugins': (self.cb_add_plugins, True),
|
|
1162
|
-
})
|
|
1163
|
-
except ArgumentPreprocessingError as ex:
|
|
1164
|
-
print(ex, file=sys.stderr)
|
|
1165
|
-
sys.exit(32)
|
|
1166
|
-
|
|
1167
|
-
self.linter = linter = self.LinterClass((
|
|
1168
|
-
('rcfile',
|
|
1169
|
-
{'action' : 'callback', 'callback' : lambda *args: 1,
|
|
1170
|
-
'type': 'string', 'metavar': '<file>',
|
|
1171
|
-
'help' : 'Specify a configuration file.'}),
|
|
1172
|
-
|
|
1173
|
-
('init-hook',
|
|
1174
|
-
{'action' : 'callback', 'callback' : lambda *args: 1,
|
|
1175
|
-
'type' : 'string', 'metavar': '<code>',
|
|
1176
|
-
'level': 1,
|
|
1177
|
-
'help' : 'Python code to execute, usually for sys.path '
|
|
1178
|
-
'manipulation such as pygtk.require().'}),
|
|
1179
|
-
|
|
1180
|
-
('help-msg',
|
|
1181
|
-
{'action' : 'callback', 'type' : 'string', 'metavar': '<msg-id>',
|
|
1182
|
-
'callback' : self.cb_help_message,
|
|
1183
|
-
'group': 'Commands',
|
|
1184
|
-
'help' : 'Display a help message for the given message id and '
|
|
1185
|
-
'exit. The value may be a comma separated list of message ids.'}),
|
|
1186
|
-
|
|
1187
|
-
('list-msgs',
|
|
1188
|
-
{'action' : 'callback', 'metavar': '<msg-id>',
|
|
1189
|
-
'callback' : self.cb_list_messages,
|
|
1190
|
-
'group': 'Commands', 'level': 1,
|
|
1191
|
-
'help' : "Generate pylint's messages."}),
|
|
1192
|
-
|
|
1193
|
-
('list-conf-levels',
|
|
1194
|
-
{'action' : 'callback',
|
|
1195
|
-
'callback' : cb_list_confidence_levels,
|
|
1196
|
-
'group': 'Commands', 'level': 1,
|
|
1197
|
-
'help' : "Generate pylint's messages."}),
|
|
1198
|
-
|
|
1199
|
-
('full-documentation',
|
|
1200
|
-
{'action' : 'callback', 'metavar': '<msg-id>',
|
|
1201
|
-
'callback' : self.cb_full_documentation,
|
|
1202
|
-
'group': 'Commands', 'level': 1,
|
|
1203
|
-
'help' : "Generate pylint's full documentation."}),
|
|
1204
|
-
|
|
1205
|
-
('generate-rcfile',
|
|
1206
|
-
{'action' : 'callback', 'callback' : self.cb_generate_config,
|
|
1207
|
-
'group': 'Commands',
|
|
1208
|
-
'help' : 'Generate a sample configuration file according to '
|
|
1209
|
-
'the current configuration. You can put other options '
|
|
1210
|
-
'before this one to get them in the generated '
|
|
1211
|
-
'configuration.'}),
|
|
1212
|
-
|
|
1213
|
-
('generate-man',
|
|
1214
|
-
{'action' : 'callback', 'callback' : self.cb_generate_manpage,
|
|
1215
|
-
'group': 'Commands',
|
|
1216
|
-
'help' : "Generate pylint's man page.", 'hide': True}),
|
|
1217
|
-
|
|
1218
|
-
('errors-only',
|
|
1219
|
-
{'action' : 'callback', 'callback' : self.cb_error_mode,
|
|
1220
|
-
'short': 'E',
|
|
1221
|
-
'help' : 'In error mode, checkers without error messages are '
|
|
1222
|
-
'disabled and for others, only the ERROR messages are '
|
|
1223
|
-
'displayed, and no reports are done by default'''}),
|
|
1224
|
-
|
|
1225
|
-
('py3k',
|
|
1226
|
-
{'action' : 'callback', 'callback' : self.cb_python3_porting_mode,
|
|
1227
|
-
'help' : 'In Python 3 porting mode, all checkers will be '
|
|
1228
|
-
'disabled and only messages emitted by the porting '
|
|
1229
|
-
'checker will be displayed'}),
|
|
1230
|
-
|
|
1231
|
-
('profile', utils.deprecated_option(opt_type='yn')),
|
|
1232
|
-
|
|
1233
|
-
), option_groups=self.option_groups, pylintrc=self._rcfile)
|
|
1234
|
-
# register standard checkers
|
|
1235
|
-
linter.load_default_plugins()
|
|
1236
|
-
# load command line plugins
|
|
1237
|
-
linter.load_plugin_modules(self._plugins)
|
|
1238
|
-
# add some help section
|
|
1239
|
-
linter.add_help_section('Environment variables', config.ENV_HELP, level=1)
|
|
1240
|
-
# pylint: disable=bad-continuation
|
|
1241
|
-
linter.add_help_section('Output',
|
|
1242
|
-
'Using the default text output, the message format is : \n'
|
|
1243
|
-
' \n'
|
|
1244
|
-
' MESSAGE_TYPE: LINE_NUM:[OBJECT:] MESSAGE \n'
|
|
1245
|
-
' \n'
|
|
1246
|
-
'There are 5 kind of message types : \n'
|
|
1247
|
-
' * (C) convention, for programming standard violation \n'
|
|
1248
|
-
' * (R) refactor, for bad code smell \n'
|
|
1249
|
-
' * (W) warning, for python specific problems \n'
|
|
1250
|
-
' * (E) error, for probable bugs in the code \n'
|
|
1251
|
-
' * (F) fatal, if an error occurred which prevented pylint from doing further\n'
|
|
1252
|
-
'processing.\n'
|
|
1253
|
-
, level=1)
|
|
1254
|
-
linter.add_help_section('Output status code',
|
|
1255
|
-
'Pylint should leave with following status code: \n'
|
|
1256
|
-
' * 0 if everything went fine \n'
|
|
1257
|
-
' * 1 if a fatal message was issued \n'
|
|
1258
|
-
' * 2 if an error message was issued \n'
|
|
1259
|
-
' * 4 if a warning message was issued \n'
|
|
1260
|
-
' * 8 if a refactor message was issued \n'
|
|
1261
|
-
' * 16 if a convention message was issued \n'
|
|
1262
|
-
' * 32 on usage error \n'
|
|
1263
|
-
' \n'
|
|
1264
|
-
'status 1 to 16 will be bit-ORed so you can know which different categories has\n'
|
|
1265
|
-
'been issued by analysing pylint output status code\n',
|
|
1266
|
-
level=1)
|
|
1267
|
-
# read configuration
|
|
1268
|
-
linter.disable('suppressed-message')
|
|
1269
|
-
linter.disable('useless-suppression')
|
|
1270
|
-
linter.read_config_file()
|
|
1271
|
-
config_parser = linter.cfgfile_parser
|
|
1272
|
-
# run init hook, if present, before loading plugins
|
|
1273
|
-
if config_parser.has_option('MASTER', 'init-hook'):
|
|
1274
|
-
cb_init_hook('init-hook',
|
|
1275
|
-
utils._unquote(config_parser.get('MASTER',
|
|
1276
|
-
'init-hook')))
|
|
1277
|
-
# is there some additional plugins in the file configuration, in
|
|
1278
|
-
if config_parser.has_option('MASTER', 'load-plugins'):
|
|
1279
|
-
plugins = utils._splitstrip(
|
|
1280
|
-
config_parser.get('MASTER', 'load-plugins'))
|
|
1281
|
-
linter.load_plugin_modules(plugins)
|
|
1282
|
-
# now we can load file config and command line, plugins (which can
|
|
1283
|
-
# provide options) have been registered
|
|
1284
|
-
linter.load_config_file()
|
|
1285
|
-
if reporter:
|
|
1286
|
-
# if a custom reporter is provided as argument, it may be overridden
|
|
1287
|
-
# by file parameters, so re-set it here, but before command line
|
|
1288
|
-
# parsing so it's still overrideable by command line option
|
|
1289
|
-
linter.set_reporter(reporter)
|
|
1290
|
-
try:
|
|
1291
|
-
args = linter.load_command_line_configuration(args)
|
|
1292
|
-
except SystemExit as exc:
|
|
1293
|
-
if exc.code == 2: # bad options
|
|
1294
|
-
exc.code = 32
|
|
1295
|
-
raise
|
|
1296
|
-
if not args:
|
|
1297
|
-
print(linter.help())
|
|
1298
|
-
sys.exit(32)
|
|
1299
|
-
|
|
1300
|
-
if linter.config.jobs < 0:
|
|
1301
|
-
print("Jobs number (%d) should be greater than 0"
|
|
1302
|
-
% linter.config.jobs, file=sys.stderr)
|
|
1303
|
-
sys.exit(32)
|
|
1304
|
-
if linter.config.jobs > 1 or linter.config.jobs == 0:
|
|
1305
|
-
if multiprocessing is None:
|
|
1306
|
-
print("Multiprocessing library is missing, "
|
|
1307
|
-
"fallback to single process", file=sys.stderr)
|
|
1308
|
-
linter.set_option("jobs", 1)
|
|
1309
|
-
else:
|
|
1310
|
-
if linter.config.jobs == 0:
|
|
1311
|
-
linter.config.jobs = multiprocessing.cpu_count()
|
|
1312
|
-
|
|
1313
|
-
# insert current working directory to the python path to have a correct
|
|
1314
|
-
# behaviour
|
|
1315
|
-
with fix_import_path(args):
|
|
1316
|
-
linter.check(args)
|
|
1317
|
-
linter.generate_reports()
|
|
1318
|
-
if exit:
|
|
1319
|
-
sys.exit(self.linter.msg_status)
|
|
1320
|
-
|
|
1321
|
-
def cb_set_rcfile(self, name, value):
|
|
1322
|
-
"""callback for option preprocessing (i.e. before option parsing)"""
|
|
1323
|
-
self._rcfile = value
|
|
1324
|
-
|
|
1325
|
-
def cb_add_plugins(self, name, value):
|
|
1326
|
-
"""callback for option preprocessing (i.e. before option parsing)"""
|
|
1327
|
-
self._plugins.extend(utils._splitstrip(value))
|
|
1328
|
-
|
|
1329
|
-
def cb_error_mode(self, *args, **kwargs):
|
|
1330
|
-
"""error mode:
|
|
1331
|
-
* disable all but error messages
|
|
1332
|
-
* disable the 'miscellaneous' checker which can be safely deactivated in
|
|
1333
|
-
debug
|
|
1334
|
-
* disable reports
|
|
1335
|
-
* do not save execution information
|
|
1336
|
-
"""
|
|
1337
|
-
self.linter.error_mode()
|
|
1338
|
-
|
|
1339
|
-
def cb_generate_config(self, *args, **kwargs):
|
|
1340
|
-
"""optik callback for sample config file generation"""
|
|
1341
|
-
self.linter.generate_config(skipsections=('COMMANDS',))
|
|
1342
|
-
sys.exit(0)
|
|
1343
|
-
|
|
1344
|
-
def cb_generate_manpage(self, *args, **kwargs):
|
|
1345
|
-
"""optik callback for sample config file generation"""
|
|
1346
|
-
from pylint import __pkginfo__
|
|
1347
|
-
self.linter.generate_manpage(__pkginfo__)
|
|
1348
|
-
sys.exit(0)
|
|
1349
|
-
|
|
1350
|
-
def cb_help_message(self, option, optname, value, parser):
|
|
1351
|
-
"""optik callback for printing some help about a particular message"""
|
|
1352
|
-
self.linter.msgs_store.help_message(utils._splitstrip(value))
|
|
1353
|
-
sys.exit(0)
|
|
1354
|
-
|
|
1355
|
-
def cb_full_documentation(self, option, optname, value, parser):
|
|
1356
|
-
"""optik callback for printing full documentation"""
|
|
1357
|
-
self.linter.print_full_documentation()
|
|
1358
|
-
sys.exit(0)
|
|
1359
|
-
|
|
1360
|
-
def cb_list_messages(self, option, optname, value, parser): # FIXME
|
|
1361
|
-
"""optik callback for printing available messages"""
|
|
1362
|
-
self.linter.msgs_store.list_messages()
|
|
1363
|
-
sys.exit(0)
|
|
1364
|
-
|
|
1365
|
-
def cb_python3_porting_mode(self, *args, **kwargs):
|
|
1366
|
-
"""Activate only the python3 porting checker."""
|
|
1367
|
-
self.linter.python3_porting_mode()
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
def cb_list_confidence_levels(option, optname, value, parser):
|
|
1371
|
-
for level in interfaces.CONFIDENCE_LEVELS:
|
|
1372
|
-
print('%-18s: %s' % level)
|
|
1373
|
-
sys.exit(0)
|
|
1374
|
-
|
|
1375
|
-
def cb_init_hook(optname, value):
|
|
1376
|
-
"""exec arbitrary code to set sys.path for instance"""
|
|
1377
|
-
exec(value) # pylint: disable=exec-used
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
if __name__ == '__main__':
|
|
1381
|
-
Run(sys.argv[1:])
|