Please run the following command to enable the hooks.
azdev setup -c {azure_cli_repo_path} -r {azure_cli_extension_repo_path}
# if you install azdev which version is less than 0.1.84, you need to run the following command to enable the hooks
git config --local core.hooksPath .githooks
Every time you git commit or git push, please make sure you have activated the python environment and completed the azdev setup.
If you want to skip the verification, you can add --no-verify
to the git command.
The pre-commit hook (pre-commit.ps1
) performs the following checks:
- Verifies that azdev is active in your current environment
- Runs
azdev scan
on all staged files to detect potential secrets - If any secrets are detected, the commit will be blocked
- You can use
azdev mask
to remove secrets before committing - Alternatively, use
git commit --no-verify
to bypass the check
- You can use
The pre-push hooks (pre-push.sh
for bash and pre-push.ps1
for PowerShell) perform several quality checks:
- Verifies that azdev is active in your current environment
- Confirms azure-cli is installed in editable mode
- Checks if your branch needs rebasing against upstream/dev
- If rebasing is needed, displays instructions and provides a 5-second window to cancel
- Runs the following quality checks on changed files:
azdev lint
: Checks for linting issuesazdev style
: Verifies code style complianceazdev test
: Runs tests for modified code
- If any check fails, the push will be blocked
- Use
git push --no-verify
to bypass these checks (not recommended)
- Use
The hooks support both Windows (PowerShell) and Unix-like systems (Bash), automatically using the appropriate script for your environment.