forked from pydot/pydot
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to code formatter Black: Config and 1st run
[Black, The Uncompromising Code Formatter][1] promises to save the developers of `pydot` time and mental energy by taking control over code formatting. With this commit, we will start to find out. With `black` installed, you can now run `black .` in the top `pydot` directory and any formatting issues in pydot source files should get corrected automatically: ~/Development/pydot $ black . reformatted dot_parser.py reformatted setup.py reformatted test/pydot_unittest.py reformatted pydot.py All done! 4 files reformatted. Check out the documentation for more on the [Black code style][2] and options for [integrating it with your editor or git pre-commit][3]. This commit contains: - New `pyproject.toml`: Configuration of `black`. - Changed `.py` files: Results of the first run of `black` 21.5b2. Line length is kept at 79 characters for now. This is my personal preference because it allows for reasonable font size when using a phone, side-by-side diffs on a small laptop screen or 3-way diffs on larger screens. For easier review of the formatting changes made by `black`, this commit uses the `--skip-string-normalization` flag to prevent that single quotes are converted to double quotes already. The next commit will drop that flag, so the results of that conversion are shown there. A later commit will take care of the CI integration. Thanks to Kostis Anagnostopoulos for first suggesting `black` and to Sebastian Kalinowski and Hrishikesh Terdalkar for giving their reviews as well. Alternatives that were rejected: - `yapf`: Not clearly better formatting than `black`. More configuration options, but the cost of reaching agreement on all those options might offset the benefits of using a code formatter. - `autopep8`: Focusses mainly on PEP 8 compliance, meaning that a lot of other formatting issues would still need to be decided on manually, reducing the benefits of using a code formatter. As discussed in [pydot#265][265] and [pydot#267][267]. [1]: https://pypi.org/project/black/ [2]: https://black.readthedocs.io/en/latest/the_black_code_style/current_style.html [3]: https://black.readthedocs.io/en/latest/integrations/index.html [265]: pydot#265 [267]: pydot#267
- Loading branch information
1 parent
5af44e0
commit 65988af
Showing
6 changed files
with
419 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.