Update the version of black used in pre-commit-config.yaml
- Dominant language
- Python
- Stars
- 49
- Forks
- 32
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
We're depending on an outdated version of `black` in our `pre-commit` config.
Version 20.8b of `black` has some improvements on how it handles trailing commas, which means it now expects certain code structures to be formatted slightly differently to our current formatting. We should update the version of `black` we're using and reformat our source files.
We could also take this opportunity to change the line-length `black` is using to 100 or less. Currently we use 120 as the line length. 120 is really too long and causes annoying wrapping when you have multiple vertical splits open in vim.
**To Reproduce**
From the mbed-tools root run the following:
`pip install --upgrade black`
`black --check src/`
**Expected behavior**
```
All done! ✨ 🍰 ✨
78 files would be left unchanged.
```
**Actual behavior**
```
would reformat src/mbed_tools/cli/configure.py
would reformat src/mbed_tools/cli/build.py
would reformat src/mbed_tools/devices/_internal/windows/usb_data_aggregation.py
would reformat src/mbed_tools/devices/_internal/windows/disk_aggregation.py
would reformat src/mbed_tools/project/mbed_program.py
Oh no! 💥 💔 💥
5 files would be reformatted, 73 files would be left unchanged.
```
Contributor guide
Research direction
Start with pre-commit-config.yaml and run the documented black --check src/ command from the mbed-tools root. Review the five source files listed in the issue, update the configured Black version and line length as decided, then reformat the affected files until the check reports all files unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100