| 69 | === Automation === |
| 70 | |
| 71 | Use Black to format new files: |
| 72 | |
| 73 | |
| 74 | {{{ |
| 75 | black python_file.py |
| 76 | }}} |
| 77 | |
| 78 | Use Flake8 to check formatting of all files: |
| 79 | |
| 80 | {{{ |
| 81 | flake8 --extend-ignore=E203,E266,E501 --max-line-length=88 python_file.py |
| 82 | }}} |
| 83 | |
| 84 | If the file you changed gives too many error in lines you did not change, |
| 85 | see if the directory or any parent directory contains a file called .flake8 which |
| 86 | contains a less strict configuration for this legacy code. |
| 87 | Use it with the `--config` pararameter: |
| 88 | |
| 89 | {{{ |
| 90 | flake8 --config {path_to_flake8_file} {path_to_python_file} |
| 91 | }}} |
| 92 | |
| 93 | For example like this: |
| 94 | |
| 95 | {{{ |
| 96 | flake8 --config lib/python/.flake8 lib/python/temporal/register.py |
| 97 | }}} |