| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This repo contains pre-commit hooks for Duolingo development:
The main hook that runs several code formatters in parallel:
To minimize developer friction, we enable only rules whose violations can be fixed automatically and disable all rules whose violations require manual correction.
We run this hook on developer workstations and enforce it in CI for all production repos at Duolingo.
Pre-commit parallelizes runs across CPUs by default (similar to make -j), but its language: docker_image doesn't deduplicate image pulls. This hook speeds up pre-commit and minimizes data usage by precaching each Docker image once instead of pulling it $CPU_COUNT times on a cold cache.
All docker_image entries found in .pre-commit-config.yaml will be included, as well as any additional images provided to this hook as args. You should declare this hook as early as possible in config, before any other hooks that are meant to benefit from this one.
This hook synchronizes AI coding rules from .cursor/rules/ and .code_review/ directories to AI assistant configuration files (CLAUDE.md, AGENTS.md, .github/copilot-instructions.md). It generates two sections:
This ensures all AI coding assistants stay aware of the same rules and coding conventions.
Repo maintainers can declare these hooks in .pre-commit-config.yaml:
- repo: https://github.com/duolingo/pre-commit-hooks.git
rev: 1.16.2
hooks:
# Optimization hook for `language: docker_image`
- id: precache-docker
args: # Optional list of additional images to precache
- ubuntu:22.04
# Code formatting hook
- id: duolingo
args: # Optional
- --scala-version=3 # Defaults to Scala 2.12
# Sync AI rules hook (for repos with Cursor AI rules)
- id: sync-ai-rulesDirectories named build and node_modules are excluded by default - no need to declare them in the hook's exclude key.
Contributors can copy or symlink this repo's .editorconfig file to their home directory in order to have their text editors and IDEs automatically pick up the same linter/formatter settings that this hook uses.
Duolingo is hiring! Apply at https://www.duolingo.com/careers
| Back | FazBrowse Home | New Git URL |