Skip to content

Commit

Permalink
Automatic markdown and YAML formatting with Prettier (psf#874)
Browse files Browse the repository at this point in the history
  • Loading branch information
yhoiseth authored and ambv committed Oct 21, 2019
1 parent ba2733d commit a6d8669
Show file tree
Hide file tree
Showing 12 changed files with 761 additions and 858 deletions.
14 changes: 7 additions & 7 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
install:
- C:\Python36\python.exe -m pip install mypy
- C:\Python36\python.exe -m pip install -e .[d]
- C:\Python36\python.exe -m pip install mypy
- C:\Python36\python.exe -m pip install -e .[d]

# Not a C# project
build: off

test_script:
- C:\Python36\python.exe tests/test_black.py
- C:\Python36\python.exe -m mypy black.py blackd.py tests/test_black.py
- C:\Python36\python.exe tests/test_black.py
- C:\Python36\python.exe -m mypy black.py blackd.py tests/test_black.py

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

artifacts:
- path: dist/black.exe

deploy:
provider: GitHub
description: ''
description: ""
auth_token:
secure: uplI9CJ2dTGcEBCbZuIn+Qb4rC38hOoRSH9lcwuGCr5g9fSnhK1MZdNT6Cjf/mFL
on:
APPVEYOR_REPO_TAG: true

16 changes: 7 additions & 9 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Treat each other well

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

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

And if you *really* need to slap somebody, do it with a fish while
dancing.
And if you _really_ need to slap somebody, do it with a fish while dancing.
42 changes: 20 additions & 22 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
title: ""
labels: bug
assignees: ''

assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.
**Describe the bug** A clear and concise description of what the bug is.

**To Reproduce** Steps to reproduce the behavior:

**To Reproduce**
Steps to reproduce the behavior:
1. Take this file '...'
2. Run *Black* on it with these arguments '....'
2. Run _Black_ on it with these arguments '....'
3. See error

**Expected behavior**
A clear and concise description of what you expected to happen.
**Expected behavior** A clear and concise description of what you expected to happen.

**Environment (please complete the following information):**

- Version: [e.g. master]
- OS and Python version: [e.g. Linux/Python 3.7.4rc1]

**Does this bug also happen on master?**
To answer this, you have two options:
1. Use the online formatter at https://black.now.sh/?version=master, which will use the latest master branch.
2. Or run *Black* on your machine:
* create a new virtualenv (make sure it's the same Python version);
* clone this repository;
* run `pip install -e .`;
* make sure it's sane by running `python setup.py test`; and
* run `black` like you did last time.

**Additional context**
Add any other context about the problem here.
**Does this bug also happen on master?** To answer this, you have two options:

1. Use the online formatter at https://black.now.sh/?version=master, which will use the
latest master branch.
2. Or run _Black_ on your machine:
- create a new virtualenv (make sure it's the same Python version);
- clone this repository;
- run `pip install -e .`;
- make sure it's sane by running `python setup.py test`; and
- run `black` like you did last time.

**Additional context** Add any other context about the problem here.
21 changes: 10 additions & 11 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
title: ""
labels: enhancement
assignees: ''

assignees: ""
---

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

**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe the solution you'd like** A clear and concise description of what you want to
happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Describe alternatives you've considered** A clear and concise description of any
alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
**Additional context** Add any other context or screenshots about the feature request
here.
21 changes: 10 additions & 11 deletions .github/ISSUE_TEMPLATE/style_issue.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
---
name: Style issue
about: Help us improve the Black style
title: ''
title: ""
labels: design
assignees: ''

assignees: ""
---

**Describe the style change**
A clear and concise description of how the style can be improved.
**Describe the style change** A clear and concise description of how the style can be
improved.

**Examples in the current _Black_ style** Think of some short code snippets that show
how the current _Black_ style is not great:

**Examples in the current *Black* style**
Think of some short code snippets that show how the current *Black* style is not great:
```
def f():
"Make sure this code is blackened"""
pass
```

**Desired style**
How do you think *Black* should format the above snippets:
**Desired style** How do you think _Black_ should format the above snippets:

```
def f(
):
pass
```

**Additional context**
Add any other context about the problem here.
**Additional context** Add any other context about the problem here.
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ repos:
hooks:
- id: mypy
exclude: ^docs/conf.py

- repo: https://github.com/prettier/prettier
rev: 1.18.2
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]
16 changes: 8 additions & 8 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
- id: black
name: black
description: 'Black: The uncompromising Python code formatter'
entry: black
language: python
language_version: python3
require_serial: true
types: [python]
- id: black
name: black
description: "Black: The uncompromising Python code formatter"
entry: black
language: python
language_version: python3
require_serial: true
types: [python]
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ cache:
directories:
- $HOME/.cache/pre-commit
env:
- TEST_CMD="coverage run tests/test_black.py"
- TEST_CMD="coverage run tests/test_black.py"
install:
- pip install coverage coveralls pre-commit
- pip install -e '.[d]'
- pip install coverage coveralls pre-commit
- pip install -e '.[d]'
script:
- $TEST_CMD
- $TEST_CMD
after_success:
- coveralls
- coveralls
notifications:
on_success: change
on_failure: always
Expand Down
59 changes: 26 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,54 @@
# Contributing to *Black*

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

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

## Bird's eye view

In terms of inspiration, *Black* is about as configurable as *gofmt*.
This is deliberate.

Bug reports and fixes are always welcome! Please follow the [issue
template on GitHub](https://github.com/psf/black/issues/new) for best
results.
In terms of inspiration, _Black_ is about as configurable as _gofmt_. This is
deliberate.

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

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

## Technicalities

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

Install all development dependencies using:

```
$ pipenv install --dev
$ pipenv shell
$ pre-commit install
```
If you haven't used `pipenv` before but are comfortable with virtualenvs,
just run `pip install pipenv` in the virtualenv you're already using and
invoke the command above from the cloned *Black* repo. It will do the
correct thing.

If you haven't used `pipenv` before but are comfortable with virtualenvs, just run
`pip install pipenv` in the virtualenv you're already using and invoke the command above
from the cloned _Black_ repo. It will do the correct thing.

Before submitting pull requests, run tests with:

```
$ python setup.py test
```


## Hygiene

If you're fixing a bug, add a test. Run it first to confirm it fails,
then fix the bug, run it again to confirm it's really fixed.

If adding a new feature, add a test. In fact, always add a test. But
wait, before adding any large feature, first open an issue for us to
discuss the idea first.
If you're fixing a bug, add a test. Run it first to confirm it fails, then fix the bug,
run it again to confirm it's really fixed.

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

## Finally

Thanks again for your interest in improving the project! You're taking
action when most people decide to sit and watch.
Thanks again for your interest in improving the project! You're taking action when most
people decide to sit and watch.
Loading

0 comments on commit a6d8669

Please sign in to comment.