forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
clang format
Sergii Dymchenko edited this page Mar 22, 2022
·
4 revisions
If you arrived here due to a lint error, running the command given in the message will fix your problem.
This wiki covers how to set up clang-format as part of your workflow.
- Add
tools/git-clang-format
to your$PATH
. This is a modified version of the default git integration that fetches a pinned binary guaranteed to work with the CI and other PyTorch developers. Once its added to your$PATH
, runninggit clang-format
will invoke it. - To ensure your changes are always formatted, you can add
git clang-format
to your a pre-commit hook. PyTorch provides a pre-commit hook (instructions) that runs our standard linters, or you can make your own that just format:
# run in pytorch root
cat <<\EOF > .git/hooks/pre-commit
#!/bin/bash
set -e
git clang-format
EOF
chmod 755 .git/hooks/pre-commit
PyTorch presented to you with love by the PyTorch Team of contributors
- Install Prerequisites and Dependencies
- Fork, clone, and checkout the PyTorch source
- Build PyTorch from source
- Tips for developing PyTorch
- PyTorch Workflow Git cheatsheet
- Overview of the Pull Request Lifecycle
- Finding Or Creating Issues
- Pre Commit Checks
- Create a Pull Request
- Typical Pull Request Workflow
- Pull Request FAQs
- Getting Help
- Codebase structure
- Tensors, Operators, and Testing
- Autograd
- Dispatcher, Structured Kernels, and Codegen
- torch.nn
- CUDA basics
- Data (Optional)
- function transforms (Optional)