Skip to content

Commit

Permalink
Merge pull request #2882 from pre-commit/languages-always-run
Browse files Browse the repository at this point in the history
make some files trigger all languages
  • Loading branch information
asottile committed May 13, 2023
2 parents 0deb445 + 926071b commit ee49d42
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion testing/languages
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
}

Expand Down

0 comments on commit ee49d42

Please sign in to comment.