▸case-01 We want to enforce automated code formatting and linting for all contributors in a multi-developer Git repository. Instead of asking every developer to manually copy custom shell scripts into their local `.git/hooks/` directory, set up a declarative, version-controlled YAML configuration file at the repository root using Python's pre-commit framework. Provide the full configuration file including official hooks for fixing trailing whitespace and verifying YAML syntax. | pass→pass | 11,660 | 18,545 | +59% | 1 | 1 | 0% | 1,877 | 2,524 | +34% | 0 | 0 | — |
▸case-02 In a Python project using `.pre-commit-config.yaml`, a developer configured `rev: main` for the `pre-commit-hooks` repository so the team always gets the newest checks automatically. However, this causes non-deterministic local commit behavior and network lag during commits. Show how the `rev` parameter should be configured in `.pre-commit-config.yaml` to ensure reproducible builds across the team. | pass→pass | 10,739 | 8,161 | -24% | 1 | 1 | 0% | 1,553 | 1,877 | +21% | 0 | 0 | — |
▸case-03 We are setting up a GitHub Actions CI workflow step to run our `.pre-commit-config.yaml` checks against the entire codebase on every pull request. A junior engineer added `pre-commit run` to the step, but it finishes instantly without checking any files because no files are staged in CI. What specific CLI invocation ensures all repository files are checked? | pass→pass | 6,470 | 4,932 | -24% | 1 | 1 | 0% | 947 | 1,172 | +24% | 0 | 0 | — |
▸case-04 An engineer needs to bypass only the `flake8` hook during an emergency hotfix commit, while allowing all other configured pre-commit hooks to run normally. Rather than passing `--no-verify` to bypass all safety hooks or commenting out lines in `.pre-commit-config.yaml`, demonstrate how to skip a single hook by identifier during `git commit` using environment variables. | pass→pass | 6,334 | 6,972 | +10% | 1 | 1 | 0% | 1,180 | 1,607 | +36% | 0 | 0 | — |
▸case-05 We have a slow integration test hook in `.pre-commit-config.yaml` that takes 30 seconds. Developers complain it delays local `git commit`. Show how to configure this hook's `stages` entry so it only triggers when executing `git push` rather than during local commits. | pass→pass | 5,991 | 9,182 | +53% | 1 | 1 | 0% | 1,090 | 1,741 | +60% | 0 | 0 | — |
▸case-06 A new team member cloned a repository containing a valid `.pre-commit-config.yaml` file. They made a local commit, but none of the hooks executed because the git hook script in `.git/hooks/pre-commit` was missing. Provide the single CLI command that installs the active framework hooks into `.git/hooks/`. | pass→fail | 1,972 | 2,949 | +50% | 1 | 1 | 0% | 293 | 622 | +112% | 0 | 0 | — |
▸case-07 Configure a hook in `.pre-commit-config.yaml` using `pre-commit/pre-commit-hooks` that prevents developers from accidentally committing binary files larger than 500KB into Git history. Avoid using external LFS tools or custom shell scripts. | pass→pass | 6,873 | 5,397 | -21% | 1 | 1 | 0% | 1,397 | 1,363 | -2% | 0 | 0 | — |
▸case-08 We need a pre-commit hook that runs a local repository script `./scripts/check-api-docs.sh` before every commit. This script is stored inside our repository and is not hosted in a remote Git hook repo. Provide the `.pre-commit-config.yaml` repository block required for this local script. | pass→pass | 5,783 | 6,858 | +19% | 1 | 1 | 0% | 1,008 | 1,452 | +44% | 0 | 0 | — |
▸case-09 A project needs to run `hadolint` to lint Dockerfiles during pre-commit, but team members do not have Haskell or Hadolint installed on their host machines. They do have Docker running locally. Provide the `.pre-commit-config.yaml` hook entry to run Hadolint via Docker without requiring local binary installation. | fail→fail | 9,677 | 9,411 | -3% | 1 | 1 | 0% | 1,520 | 2,193 | +44% | 0 | 0 | — |
▸case-10 In a Node.js project using Husky (v8/v9), developers want to execute `npm test` automatically before every local commit. A developer suggested adding `"husky": { "hooks": { "pre-commit": "npm test" } }` to `package.json`, which is deprecated in modern Husky. Explain the correct file location and file contents for modern Husky. | pass→pass | 8,691 | 12,131 | +40% | 1 | 1 | 0% | 1,543 | 2,207 | +43% | 0 | 0 | — |
▸case-11 In an embedded Linux CI/CD environment with no Python or Node.js runtime installed, author a standalone POSIX shell script for `.git/hooks/pre-commit` that inspects staged files and exits with a non-zero exit code if any staged file contains the string `DEBUG_FLAG = True`. | fail→pass | 14,634 | 41,160 | +181% | 1 | 1 | 0% | 2,757 | 6,506 | +136% | 0 | 0 | — |
▸case-12 A legacy repository's `.pre-commit-config.yaml` has 12 separate hook repositories pinned to outdated tags from two years ago. Rather than manually looking up every release tag on GitHub and updating each line by hand, what single command updates all pinned `rev` values to their latest release versions? | pass→pass | 3,449 | 3,829 | +11% | 1 | 1 | 0% | 727 | 1,116 | +54% | 0 | 0 | — |
▸case-13 Developers on a team frequently commit code directly to `main` and `release` branches locally on their workstations before creating pull requests. Rather than relying solely on server-side branch protection (which only triggers on push), configure the built-in pre-commit hook from `pre-commit/pre-commit-hooks` that blocks local commits directly onto `main` and `release`. | pass→pass | 9,882 | 11,641 | +18% | 1 | 1 | 0% | 1,576 | 2,169 | +38% | 0 | 0 | — |
▸case-14 In a JavaScript frontend project using Husky and `lint-staged`, a developer ran `eslint .` inside a git hook, which caused the linter to fail on unstaged files edited by other branch work. Explain how `lint-staged` prevents this by scoping linter execution. | pass→pass | 13,898 | 11,709 | -16% | 1 | 1 | 0% | 2,084 | 2,424 | +16% | 0 | 0 | — |
▸case-15 A developer manually created a custom native Git hook shell script at `.git/hooks/pre-commit` on macOS/Linux. However, when running `git commit`, Git bypasses the file completely without running any checks or throwing errors. What OS permission is missing and what command grants it? | pass→pass | 4,633 | 4,186 | -10% | 1 | 1 | 0% | 714 | 934 | +31% | 0 | 0 | — |
▸case-16 A repository shared between Windows and Linux developers suffers from constant line ending churn (`CRLF` vs `LF`). Instead of asking developers to manually run `dos2unix` before committing, configure the standard `pre-commit-hooks` check to automatically fix line endings to `LF` during commit. | pass→pass | 9,580 | 11,747 | +23% | 1 | 1 | 0% | 1,518 | 2,246 | +48% | 0 | 0 | — |
▸case-17 A team added hooks in `.pre-commit-config.yaml` configured with `stages: [pre-push]`. Running `pre-commit install` only installed `.git/hooks/pre-commit`, so `git push` operations do not execute the pre-push hooks. What CLI command installs the Git pre-push hook script into `.git/hooks/`? | pass→pass | 3,232 | 4,748 | +47% | 1 | 1 | 0% | 596 | 1,125 | +89% | 0 | 0 | — |
▸case-18 We want to configure the `ruff` pre-commit hook in `.pre-commit-config.yaml` to automatically fix auto-fixable lint issues when triggered. Show how command-line flags like `--fix` are passed to individual hooks in `.pre-commit-config.yaml`. | pass→pass | 7,578 | 8,680 | +15% | 1 | 1 | 0% | 1,376 | 1,686 | +23% | 0 | 0 | — |
▸case-19 In `.pre-commit-config.yaml`, we want a Python formatting hook to run only on files in the `services/` directory, while explicitly ignoring any files under `services/vendor/`. Explain how path inclusion and exclusion are defined for an individual hook entry. | pass→pass | 10,725 | 8,861 | -17% | 1 | 1 | 0% | 1,600 | 1,718 | +7% | 0 | 0 | — |
▸case-20 Configure a GitHub Actions workflow file (`.github/workflows/ci.yml`) that triggers on every `push` to `main`, checks out code with `actions/checkout@v4`, sets up Python 3.11 with `actions/setup-python@v5`, and runs `pytest`. Do not discuss git pre-commit hooks or local hook configuration. | pass→pass | 4,636 | 4,004 | -14% | 1 | 1 | 0% | 960 | 1,233 | +28% | 0 | 0 | — |
▸case-21 We want to enforce Conventional Commits formatting (e.g., `feat: add user login`) by linting commit messages using `commitlint` in a Node.js project. Show how to configure the `commit-msg` Git hook (as distinct from a `pre-commit` hook) and pass the commit message file path argument `$1` to `commitlint`. | pass→pass | 11,027 | 12,749 | +16% | 1 | 1 | 0% | 2,065 | 2,864 | +39% | 0 | 0 | — |
▸case-22 Write a native Git `post-commit` hook shell script located at `.git/hooks/post-commit` that outputs a desktop notification or log entry after a commit is saved. Explain why this hook cannot abort or roll back the commit if the notification fails. | pass→pass | 9,722 | 12,297 | +26% | 1 | 1 | 0% | 1,842 | 2,674 | +45% | 0 | 0 | — |
▸case-23 Write a multi-stage Dockerfile for a Go application that uses `golang:1.22-alpine` as the builder stage and `gcr.io/distroless/static-debian12` as the final runtime stage to keep the production image minimal. | pass→pass | 8,346 | 13,869 | +66% | 1 | 1 | 0% | 1,736 | 2,664 | +53% | 0 | 0 | — |