MCPcopy Index your code
hub / github.com/pre-commit/pre-commit / _entry_validate

Function _entry_validate

pre_commit/languages/r.py:157–173  ·  view source on GitHub ↗

Allowed entries: # Rscript -e expr # Rscript path/to/file

(entry: list[str])

Source from the content-addressed store, hash-verified

155
156
157def _entry_validate(entry: list[str]) -> None:
158 """
159 Allowed entries:
160 # Rscript -e expr
161 # Rscript path/to/file
162 """
163 if entry[0] != 'Rscript':
164 raise ValueError('entry must start with `Rscript`.')
165
166 if entry[1] == '-e':
167 if len(entry) > 3:
168 raise ValueError('You can supply at most one expression.')
169 elif len(entry) > 2:
170 raise ValueError(
171 'The only valid syntax is `Rscript -e {expr}`'
172 'or `Rscript path/to/hook/script`',
173 )
174
175
176def _cmd_from_hook(

Callers 1

_cmd_from_hookFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected