Skip to content

Commit a6d8669

Browse files
yhoisethambv
authored andcommitted
Automatic markdown and YAML formatting with Prettier (#874)
1 parent ba2733d commit a6d8669

12 files changed

+761
-858
lines changed

.appveyor.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
install:
2-
- C:\Python36\python.exe -m pip install mypy
3-
- C:\Python36\python.exe -m pip install -e .[d]
2+
- C:\Python36\python.exe -m pip install mypy
3+
- C:\Python36\python.exe -m pip install -e .[d]
44

55
# Not a C# project
66
build: off
77

88
test_script:
9-
- C:\Python36\python.exe tests/test_black.py
10-
- C:\Python36\python.exe -m mypy black.py blackd.py tests/test_black.py
9+
- C:\Python36\python.exe tests/test_black.py
10+
- C:\Python36\python.exe -m mypy black.py blackd.py tests/test_black.py
1111

1212
after_test:
1313
- C:\Python36\python.exe -m pip install pyinstaller
14-
- "%CMD_IN_ENV% C:\\Python36\\python.exe -m PyInstaller --clean -F --add-data blib2to3/;blib2to3 black.py"
14+
- "%CMD_IN_ENV% C:\\Python36\\python.exe -m PyInstaller --clean -F --add-data
15+
blib2to3/;blib2to3 black.py"
1516

1617
artifacts:
1718
- path: dist/black.exe
1819

1920
deploy:
2021
provider: GitHub
21-
description: ''
22+
description: ""
2223
auth_token:
2324
secure: uplI9CJ2dTGcEBCbZuIn+Qb4rC38hOoRSH9lcwuGCr5g9fSnhK1MZdNT6Cjf/mFL
2425
on:
2526
APPVEYOR_REPO_TAG: true
26-

.github/CODE_OF_CONDUCT.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
# Treat each other well
22

3-
Everyone participating in the *Black* project, and in particular in the
4-
issue tracker, pull requests, and social media activity, is expected
5-
to treat other people with respect and more generally to follow the
6-
guidelines articulated in the [Python Community Code of
7-
Conduct](https://www.python.org/psf/codeofconduct/).
3+
Everyone participating in the _Black_ project, and in particular in the issue tracker,
4+
pull requests, and social media activity, is expected to treat other people with respect
5+
and more generally to follow the guidelines articulated in the
6+
[Python Community Code of Conduct](https://www.python.org/psf/codeofconduct/).
87

9-
At the same time, humor is encouraged. In fact, basic familiarity with
10-
Monty Python's Flying Circus is expected. We are not savages.
8+
At the same time, humor is encouraged. In fact, basic familiarity with Monty Python's
9+
Flying Circus is expected. We are not savages.
1110

12-
And if you *really* need to slap somebody, do it with a fish while
13-
dancing.
11+
And if you _really_ need to slap somebody, do it with a fish while dancing.

.github/ISSUE_TEMPLATE/bug_report.md

+20-22
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
11
---
22
name: Bug report
33
about: Create a report to help us improve
4-
title: ''
4+
title: ""
55
labels: bug
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

10-
**Describe the bug**
11-
A clear and concise description of what the bug is.
9+
**Describe the bug** A clear and concise description of what the bug is.
10+
11+
**To Reproduce** Steps to reproduce the behavior:
1212

13-
**To Reproduce**
14-
Steps to reproduce the behavior:
1513
1. Take this file '...'
16-
2. Run *Black* on it with these arguments '....'
14+
2. Run _Black_ on it with these arguments '....'
1715
3. See error
1816

19-
**Expected behavior**
20-
A clear and concise description of what you expected to happen.
17+
**Expected behavior** A clear and concise description of what you expected to happen.
2118

2219
**Environment (please complete the following information):**
20+
2321
- Version: [e.g. master]
2422
- OS and Python version: [e.g. Linux/Python 3.7.4rc1]
2523

26-
**Does this bug also happen on master?**
27-
To answer this, you have two options:
28-
1. Use the online formatter at https://black.now.sh/?version=master, which will use the latest master branch.
29-
2. Or run *Black* on your machine:
30-
* create a new virtualenv (make sure it's the same Python version);
31-
* clone this repository;
32-
* run `pip install -e .`;
33-
* make sure it's sane by running `python setup.py test`; and
34-
* run `black` like you did last time.
35-
36-
**Additional context**
37-
Add any other context about the problem here.
24+
**Does this bug also happen on master?** To answer this, you have two options:
25+
26+
1. Use the online formatter at https://black.now.sh/?version=master, which will use the
27+
latest master branch.
28+
2. Or run _Black_ on your machine:
29+
- create a new virtualenv (make sure it's the same Python version);
30+
- clone this repository;
31+
- run `pip install -e .`;
32+
- make sure it's sane by running `python setup.py test`; and
33+
- run `black` like you did last time.
34+
35+
**Additional context** Add any other context about the problem here.
+10-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: ''
4+
title: ""
55
labels: enhancement
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

10-
**Is your feature request related to a problem? Please describe.**
11-
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
9+
**Is your feature request related to a problem? Please describe.** A clear and concise
10+
description of what the problem is. Ex. I'm always frustrated when [...]
1211

13-
**Describe the solution you'd like**
14-
A clear and concise description of what you want to happen.
12+
**Describe the solution you'd like** A clear and concise description of what you want to
13+
happen.
1514

16-
**Describe alternatives you've considered**
17-
A clear and concise description of any alternative solutions or features you've considered.
15+
**Describe alternatives you've considered** A clear and concise description of any
16+
alternative solutions or features you've considered.
1817

19-
**Additional context**
20-
Add any other context or screenshots about the feature request here.
18+
**Additional context** Add any other context or screenshots about the feature request
19+
here.

.github/ISSUE_TEMPLATE/style_issue.md

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
---
22
name: Style issue
33
about: Help us improve the Black style
4-
title: ''
4+
title: ""
55
labels: design
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

10-
**Describe the style change**
11-
A clear and concise description of how the style can be improved.
9+
**Describe the style change** A clear and concise description of how the style can be
10+
improved.
11+
12+
**Examples in the current _Black_ style** Think of some short code snippets that show
13+
how the current _Black_ style is not great:
1214

13-
**Examples in the current *Black* style**
14-
Think of some short code snippets that show how the current *Black* style is not great:
1515
```
1616
def f():
1717
"Make sure this code is blackened"""
1818
pass
1919
```
2020

21-
**Desired style**
22-
How do you think *Black* should format the above snippets:
21+
**Desired style** How do you think _Black_ should format the above snippets:
22+
2323
```
2424
def f(
2525
):
2626
pass
2727
```
2828

29-
**Additional context**
30-
Add any other context about the problem here.
29+
**Additional context** Add any other context about the problem here.

.pre-commit-config.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ repos:
2222
hooks:
2323
- id: mypy
2424
exclude: ^docs/conf.py
25+
26+
- repo: https://github.com/prettier/prettier
27+
rev: 1.18.2
28+
hooks:
29+
- id: prettier
30+
args: [--prose-wrap=always, --print-width=88]

.pre-commit-hooks.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
- id: black
2-
name: black
3-
description: 'Black: The uncompromising Python code formatter'
4-
entry: black
5-
language: python
6-
language_version: python3
7-
require_serial: true
8-
types: [python]
1+
- id: black
2+
name: black
3+
description: "Black: The uncompromising Python code formatter"
4+
entry: black
5+
language: python
6+
language_version: python3
7+
require_serial: true
8+
types: [python]

.travis.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ cache:
44
directories:
55
- $HOME/.cache/pre-commit
66
env:
7-
- TEST_CMD="coverage run tests/test_black.py"
7+
- TEST_CMD="coverage run tests/test_black.py"
88
install:
9-
- pip install coverage coveralls pre-commit
10-
- pip install -e '.[d]'
9+
- pip install coverage coveralls pre-commit
10+
- pip install -e '.[d]'
1111
script:
12-
- $TEST_CMD
12+
- $TEST_CMD
1313
after_success:
14-
- coveralls
14+
- coveralls
1515
notifications:
1616
on_success: change
1717
on_failure: always

CONTRIBUTING.md

+26-33
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,54 @@
1-
# Contributing to *Black*
2-
3-
Welcome! Happy to see you willing to make the project better. Have you
4-
read the entire [user documentation](https://black.readthedocs.io/en/latest/)
5-
yet?
1+
# Contributing to _Black_
62

3+
Welcome! Happy to see you willing to make the project better. Have you read the entire
4+
[user documentation](https://black.readthedocs.io/en/latest/) yet?
75

86
## Bird's eye view
97

10-
In terms of inspiration, *Black* is about as configurable as *gofmt*.
11-
This is deliberate.
12-
13-
Bug reports and fixes are always welcome! Please follow the [issue
14-
template on GitHub](https://github.com/psf/black/issues/new) for best
15-
results.
8+
In terms of inspiration, _Black_ is about as configurable as _gofmt_. This is
9+
deliberate.
1610

17-
Before you suggest a new feature or configuration knob, ask yourself why
18-
you want it. If it enables better integration with some workflow, fixes
19-
an inconsistency, speeds things up, and so on - go for it! On the other
20-
hand, if your answer is "because I don't like a particular formatting"
21-
then you're not ready to embrace *Black* yet. Such changes are unlikely
22-
to get accepted. You can still try but prepare to be disappointed.
11+
Bug reports and fixes are always welcome! Please follow the
12+
[issue template on GitHub](https://github.com/psf/black/issues/new) for best results.
2313

14+
Before you suggest a new feature or configuration knob, ask yourself why you want it. If
15+
it enables better integration with some workflow, fixes an inconsistency, speeds things
16+
up, and so on - go for it! On the other hand, if your answer is "because I don't like a
17+
particular formatting" then you're not ready to embrace _Black_ yet. Such changes are
18+
unlikely to get accepted. You can still try but prepare to be disappointed.
2419

2520
## Technicalities
2621

27-
Development on the latest version of Python is preferred. As of this
28-
writing it's 3.8. You can use any operating system. I am using macOS
29-
myself and CentOS at work.
22+
Development on the latest version of Python is preferred. As of this writing it's 3.8.
23+
You can use any operating system. I am using macOS myself and CentOS at work.
3024

3125
Install all development dependencies using:
26+
3227
```
3328
$ pipenv install --dev
3429
$ pipenv shell
3530
$ pre-commit install
3631
```
37-
If you haven't used `pipenv` before but are comfortable with virtualenvs,
38-
just run `pip install pipenv` in the virtualenv you're already using and
39-
invoke the command above from the cloned *Black* repo. It will do the
40-
correct thing.
32+
33+
If you haven't used `pipenv` before but are comfortable with virtualenvs, just run
34+
`pip install pipenv` in the virtualenv you're already using and invoke the command above
35+
from the cloned _Black_ repo. It will do the correct thing.
4136

4237
Before submitting pull requests, run tests with:
38+
4339
```
4440
$ python setup.py test
4541
```
4642

47-
4843
## Hygiene
4944

50-
If you're fixing a bug, add a test. Run it first to confirm it fails,
51-
then fix the bug, run it again to confirm it's really fixed.
52-
53-
If adding a new feature, add a test. In fact, always add a test. But
54-
wait, before adding any large feature, first open an issue for us to
55-
discuss the idea first.
45+
If you're fixing a bug, add a test. Run it first to confirm it fails, then fix the bug,
46+
run it again to confirm it's really fixed.
5647

48+
If adding a new feature, add a test. In fact, always add a test. But wait, before adding
49+
any large feature, first open an issue for us to discuss the idea first.
5750

5851
## Finally
5952

60-
Thanks again for your interest in improving the project! You're taking
61-
action when most people decide to sit and watch.
53+
Thanks again for your interest in improving the project! You're taking action when most
54+
people decide to sit and watch.

0 commit comments

Comments
 (0)