diff --git a/pre_commit/languages/all.py b/pre_commit/languages/all.py index 9e69f701b..409b43506 100644 --- a/pre_commit/languages/all.py +++ b/pre_commit/languages/all.py @@ -41,7 +41,7 @@ class Language(NamedTuple): # TODO: back to modules + Protocol: https://github.com/python/mypy/issues/5018 languages = { - # BEGIN GENERATED (./testing/gen-languages-all) + # BEGIN GENERATED (testing/gen-languages-all) 'conda': Language(name='conda', ENVIRONMENT_DIR=conda.ENVIRONMENT_DIR, get_default_version=conda.get_default_version, healthy=conda.healthy, install_environment=conda.install_environment, run_hook=conda.run_hook), # noqa: E501 'coursier': Language(name='coursier', ENVIRONMENT_DIR=coursier.ENVIRONMENT_DIR, get_default_version=coursier.get_default_version, healthy=coursier.healthy, install_environment=coursier.install_environment, run_hook=coursier.run_hook), # noqa: E501 'docker': Language(name='docker', ENVIRONMENT_DIR=docker.ENVIRONMENT_DIR, get_default_version=docker.get_default_version, healthy=docker.healthy, install_environment=docker.install_environment, run_hook=docker.run_hook), # noqa: E501 diff --git a/pre_commit/languages/r.py b/pre_commit/languages/r.py index d2163d648..67cf1ebf7 100644 --- a/pre_commit/languages/r.py +++ b/pre_commit/languages/r.py @@ -51,10 +51,9 @@ def _prefix_if_file_entry( def _entry_validate(entry: Sequence[str]) -> None: """ - # allowed entries: + Allowed entries: # Rscript -e expr # Rscript path/to/file - # TODO what if expr is x;2? not captured by shlex.split() """ if entry[0] != 'Rscript': raise ValueError('entry must start with `Rscript`.') diff --git a/testing/resources/r_hooks_repo/.pre-commit-hooks.yaml b/testing/resources/r_hooks_repo/.pre-commit-hooks.yaml index e44278981..b3545d969 100644 --- a/testing/resources/r_hooks_repo/.pre-commit-hooks.yaml +++ b/testing/resources/r_hooks_repo/.pre-commit-hooks.yaml @@ -20,7 +20,8 @@ name: Say hi entry: Rscript -e '1+1' -e '3' --no-cache3 language: r - types: [r]# real world + types: [r] +# real world - id: hello-world name: Say hi entry: Rscript hello-world.R @@ -32,8 +33,8 @@ entry: | Rscript -e 'stopifnot( - packageVersion("rprojroot") == "1.0", - packageVersion("gli.clu") == "0.0.0.9000" + packageVersion("rprojroot") == "1.0", + packageVersion("gli.clu") == "0.0.0.9000" ) cat(commandArgs(trailingOnly = TRUE), "from R!\n", sep = ", ") ' diff --git a/tests/languages/r_test.py b/tests/languages/r_test.py index a62325066..5c046efed 100644 --- a/tests/languages/r_test.py +++ b/tests/languages/r_test.py @@ -97,7 +97,6 @@ def test_r_parsing_expr_args_in_entry2(tempdir_factory, store): def test_r_parsing_expr_non_Rscirpt(tempdir_factory, store): - with pytest.raises(ValueError) as execinfo: r._entry_validate(['AnotherScript', '-e', '{{}}']) diff --git a/tests/repository_test.py b/tests/repository_test.py index d667a64bd..114780dc3 100644 --- a/tests/repository_test.py +++ b/tests/repository_test.py @@ -349,8 +349,6 @@ def test_run_ruby_hook_with_disable_shared_gems( tempdir_factory, store, tmpdir, - - ): """Make sure a Gemfile in the project doesn't interfere.""" tmpdir.join('Gemfile').write('gem "lol_hai"')