Merge pull request #2882 from pre-commit/languages-always-run

make some files trigger all languages
This commit is contained in:
Anthony Sottile 2023-05-13 13:19:21 -07:00 committed by GitHub
commit ee49d4289f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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]:
prog = f'''\
import json
@ -47,10 +56,12 @@ def main() -> int:
if fname.endswith('.py') and fname != '__init__.py'
]
triggers_all = _always_run()
if not args.all:
with concurrent.futures.ThreadPoolExecutor(os.cpu_count()) as exe:
by_lang = {
lang: files
lang: files | triggers_all
for lang, files in zip(langs, exe.map(_lang_files, langs))
}