Skip to content

Commit

Permalink
cosmethics
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzwalthert committed Mar 5, 2021
1 parent de0375f commit 809c79e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pre_commit/languages/all.py
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pre_commit/languages/r.py
Expand Up @@ -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`.')
Expand Down
7 changes: 4 additions & 3 deletions testing/resources/r_hooks_repo/.pre-commit-hooks.yaml
Expand Up @@ -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
Expand All @@ -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 = ", ")
'
Expand Down
1 change: 0 additions & 1 deletion tests/languages/r_test.py
Expand Up @@ -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', '{{}}'])

Expand Down
2 changes: 0 additions & 2 deletions tests/repository_test.py
Expand Up @@ -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"')
Expand Down

0 comments on commit 809c79e

Please sign in to comment.