# Linters and Formatters
<!-- ## Formatting options we care about:
- sort imports
- trailing whitespaces
- string quotes (double vs single)
- multi-line brackers
- *TBD*
- *TBD*
- *TBD*
-->
## How is formatting currently taken care of:
- autoformatting in editor (`Shift` + `Option` + `F` in VSCode)
- commit hooks
- manually
- *TBD*
**Final Verdict: Pre-commit hooks**
## Popular auto-formatters:
* Black: https://github.com/psf/black
* YAPF: https://pypi.org/project/yapf/
* autopep8: https://github.com/hhatto/autopep8
[GA]: No preference, as long as the code is readable. Added links to documentation :point_up_2:
**Final Verdict: Black**
## Linters
* flake8
* pylint
* pycodestyle
**Final Verdict: Flake8**
## Editor-specific settings (if any):
### VSCODE
* VSCode: Download `ms-python.python` and make sure to pip install the formatters/linters OR alternatively, get the Python VS code extension from [marketplace](https://marketplace.visualstudio.com/items?itemName=ms-python.python).
* Install some [recommended](https://github.com/alan-turing-institute/ARC/blob/master/IDE/vscode/extensions.txt) extensions
* Update your local [settings.json](https://github.com/alan-turing-institute/ARC/blob/master/IDE/vscode/settings.json) file to setup the working environment for your current project.
### PYCHARM
TBD
## Pre-commit hooks for Black
[Pre-commit](https://pre-commit.com/index.html) files using [Black's](https://black.readthedocs.io/en/stable/integrations/source_version_control.html) pre-commit configuration. Add this to the `.pre-commit-config.yaml` in your repository:
```repos:
- repo: https://github.com/psf/black
rev: stable # Replace by any tag/version: https://github.com/psf/black/tags
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+```