mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 09:04:41 +04:00
Merge pull request #2882 from pre-commit/languages-always-run
make some files trigger all languages
This commit is contained in:
commit
ee49d4289f
1 changed files with 12 additions and 1 deletions
|
|
@ -16,6 +16,15 @@ EXCLUDED = frozenset((
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
def _always_run() -> frozenset[str]:
|
||||||
|
ret = ['.github/workflows/languages.yml', 'testing/languages']
|
||||||
|
ret.extend(
|
||||||
|
os.path.join('pre_commit/resources', fname)
|
||||||
|
for fname in os.listdir('pre_commit/resources')
|
||||||
|
)
|
||||||
|
return frozenset(ret)
|
||||||
|
|
||||||
|
|
||||||
def _lang_files(lang: str) -> frozenset[str]:
|
def _lang_files(lang: str) -> frozenset[str]:
|
||||||
prog = f'''\
|
prog = f'''\
|
||||||
import json
|
import json
|
||||||
|
|
@ -47,10 +56,12 @@ def main() -> int:
|
||||||
if fname.endswith('.py') and fname != '__init__.py'
|
if fname.endswith('.py') and fname != '__init__.py'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
triggers_all = _always_run()
|
||||||
|
|
||||||
if not args.all:
|
if not args.all:
|
||||||
with concurrent.futures.ThreadPoolExecutor(os.cpu_count()) as exe:
|
with concurrent.futures.ThreadPoolExecutor(os.cpu_count()) as exe:
|
||||||
by_lang = {
|
by_lang = {
|
||||||
lang: files
|
lang: files | triggers_all
|
||||||
for lang, files in zip(langs, exe.map(_lang_files, langs))
|
for lang, files in zip(langs, exe.map(_lang_files, langs))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue