The Carbon language project has a number of tools used to assist in preparing contributions.
We use pre-commit to run various checks. This will automatically run important checks, including formatting.
To set up pre-commit:
pre-commit install
pre-commit configured for Carbon repos -- do not go
through the Quick start instructions.git commit or manually
with pre-commit run.
git add
will need to be run to include the modifications in the commit, and the
commit re-started.When modifying or adding pre-commit hooks, please run
pre-commit run --all-files to see what changes.
pre-commit enabled: If you're using pre-commit, it will run this. Installing and running manually is optional, but may be helpful.
We use Black to format Python code. Although Prettier is used for most languages, it doesn't support Python.
pre-commit enabled: If you're using pre-commit, it will run this. Installing and running manually is optional, but may be helpful.
We use codespell to spellcheck common errors. This won't catch every error; we're trying to balance true and false positives.
pre-commit enabled: If you're using pre-commit, it will run this. Installing and running manually is optional, but may be helpful.
We use markdown-toc to provide GitHub-compatible tables of contents for some documents.
If run manually, specify --bullets=- to use Prettier-compatible bullets, or
always run Prettier after markdown-toc.
pre-commit enabled: If you're using pre-commit, it will run this. Installing and running manually is optional, but may be helpful.
We use Prettier for formatting. There is an rc file for configuration.
If you use vim-prettier, the
.prettierrc.yaml should still apply as long as config_precedence is set to
the default file-override. However, we may need to add additional settings
where the vim-prettier default diverges from prettier, as we notice them.