Commit Graph

236 Commits

Author SHA1 Message Date
Hadi Alqattan
dd2f86ac0a
Support stable Python3.9. (#1748)
* Support stable Python3.9.

* Get back to 3.9-dev

* Add py39 to black usage.

* remove 3.9 temporarily.
2020-10-08 14:13:13 -07:00
Vipul
bc138d1263
End 'force-exclude' help message with a period (#1727)
It would be nice, if like other options help message, force-exclude's
help message also ends with a period punctuation mark.
2020-09-27 07:54:21 +02:00
Richard Si
c0a8e42243
Fix empty line handling when formatting typing stubs (#1646)
Black used to erroneously remove all empty lines between non-function
code and decorators when formatting typing stubs. Now a single empty
line is enforced.

I chose for putting empty lines around decorated classes that have empty
bodies since removing empty lines around such classes would cause a
formatting issue that seems to be impossible to fix.

For example:

```
class A: ...
@some_decorator
class B: ...
class C: ...
class D: ...

@some_other_decorator
def foo(): -> None: ...
```

It is easy to enforce no empty lines between class A, B, and C.
Just return 0, 0 for a line that is a decorator and precedes an stub
class. Fortunately before this commit, empty lines after that class
would be removed already.

Now let's look at the empty line between class D and function foo. In
this case, there should be an empty line there since it's class code next
to function code. The problem is that when deciding to add X empty lines
before a decorator, you can't tell whether it's before a class or a
function. If the decorator is before a function, then an empty line
is needed, while no empty lines are needed when the decorator is
before a class.

So even though I personally prefer no empty lines around decorated
classes, I had to go the other way surrounding decorated classes with
empty lines.

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2020-09-10 13:21:37 -07:00
Łukasz Langa
6b935a34d0
Clarify current trailing comma behavior in the docs 2020-09-01 13:24:31 +02:00
Łukasz Langa
1af648d0c1
Mention optional invalid W503 warning in pycodestyle 2020-09-01 13:18:46 +02:00
Richard Si
1d2d7264ec
Fix incorrect space before colon in if/while stmts (#1655)
* Fix incorrect space before colon in if/while stmts

Previously Black would format this code

```
if (foo := True):
	print(foo)
```

as

```
if (foo := True) :
	print(foo)
```

adding an incorrect space after the RPAR. Buggy code in the
normalize_invisible_parens function caused the colon to be wrapped in
invisible parentheses. The LPAR of that pair was then prefixed with a
single space at the request of the whitespace function.

This commit fixes the accidental skipping of a pre-condition check
which must return True before parenthesis normalization of a specific
child Leaf or Node can happen. The pre-condition check being skipped
was why the colon was wrapped in invisible parentheses.

* Add an entry in CHANGES.md
2020-08-31 14:20:05 -07:00
Jon Dufresne
573b8de544
Remove flake8 W503 from docs as it is ignored by default (#1661)
Fixes #1660
2020-08-31 14:18:43 -07:00
Richard Si
7fe19fac5b Fix multiline docstring quote normalization
The quotes of multiline docstrings are now only normalized when string
normalization is off, instead of the string normalization setting being
ignored and the quotes being *always* normalized.

I had to make a new test case and data file since the current pair for
docstrings only worked when there is no formatting difference between the
formatting results with string normalization on and off. I needed to add
tests for when there *are* differences between the two. So I split
test_docstring's test code when string normalization is disabled into a
new test case along with a new data file.
2020-08-27 01:59:41 +02:00
Łukasz Langa
235412635e
v20.8b1 2020-08-26 17:50:44 +02:00
Łukasz Langa
824d06f720
v20.8b0 2020-08-26 16:00:55 +02:00
Ned Twigg
4a065a43e1
Add links regarding Spotless integration for gradle/maven users (#1622)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2020-08-26 03:54:05 +02:00
Łukasz Langa
5faabb5616
Make doc generation a little smarter, update doc sections 2020-08-24 14:42:17 +02:00
Łukasz Langa
205f3b67fb Fix dealing with generated files in docs 2020-08-21 16:45:30 +02:00
Łukasz Langa
cb6f2198b8 Use properly renamed function name in docs 2020-08-21 16:45:30 +02:00
Łukasz Langa
05cc7ede6a Reformat docs/conf.py according to the new style 2020-08-21 16:45:30 +02:00
Richard Si
37a0020e07
Upgrade docs to Sphinx 3+ and add doc build test (#1613)
* Upgrade docs to Sphinx 3+
* Fix all the warnings...

- Fixed bad docstrings
- Fixed bad fenced code blocks in documentation
- Blocklisted some sections from being generated from the README
- Added missing documentation to index.rst
- Fixed an invalid autofunction directive in reference/reference_functions.rst
- Pin another documentation dependency

* Add documentation build test
2020-08-21 00:06:41 +02:00
Maximilian Cosmo Sitter
537ea8df35
Update to accomodate isort 5 release changes. (#1559)
Isort 5 introduced profiles and ensure_newline_before_comments options. Either needs to be added to work correctly with black.

Co-authored-by: Richard Si <63936253+ichard26@users.noreply.github.com>
2020-07-21 17:29:38 -07:00
Steven Maude
5010bb4279
Update curl command to use stable branch (#1543) 2020-07-15 11:36:14 -07:00
Richard Si
f90f50a743
Fix toml hashes and make it clear that only TOML is supported (#1510)
* Fix TOML hashes

* Make it clear that only TOML is supported
2020-06-19 22:29:53 -07:00
Bharat Raghunathan
e4c55b4887
Fix grammatical typos in black_primer and blackd (#1504) 2020-06-16 11:57:33 -07:00
Richard Si
7403d95862
Refactor docs / Maintenance of docs (#1456)
* Split code style and components documentation

Splits 'the_black_code_style', 'pragmatism', 'blackd',and 'black_primer'
into their own files. The exception being 'the_black_code_style' and
'pragmatism'. They have been merged into one 'the_black_code_style_and_pragmatism'
file.

These changes are being made because the README is becoming very long. And
a README isn't great if it dissuades its reader because of its length.

* Update the doc generation logic and configuration

With the moving of several sections in the README and the renaming of a
few files, 'conf.py' needs to be able to support custom sections.

This commit introduces DocSection which can be used to specify custom
sections of documentation. The information stored in DocSection will be
used by the process_sections function to read, process, and write the section
to CURRENT_DIR.

A large change has been made to the how the docs are prepared to be built.
Instead of just generating the files needed by reading the README, this
has a full chain of operations so custom sections are supported. First,
it reads the README and spits out a list of DocSection objects representing
the sections to be generated by process_sections. This is done since most
of the docs still live in README. Then along with the defined custom_sections
, the process_sections will be begin to process the DocSection objects.
It reads the information it needs to generate the section. Then fetches
the section's contents, calls processors required by the section to process
the section's contents, and finally writes the section to CURRENT_DIR.

This large change is so processing of the documentation can be done just
for the versions hosted on ReadTheDocs.org. An example processor using this
feature is a 'replace_links' processor. It will replace documentation
links that point to the docs hosted on GitHub with links that point to the
version hosted on ReadTheDocs.org. (I won't be coding that ATM)

This also means that files will be overwritten or created once the docs
have been built. It is annoying, since you have to 'git reset --hard'
and 'git clean -f -d' after each build, but there's nothing better. The old
system had the same side effects, so yeah :(

* Update filenames and delete unnecessary files

Update the filenames since 'the_black_code_style' and 'pragmatism' were
merged and 'contributing' was deleted in favor of 'contributing_to_black'.

All symlinks were deleted since their home (_build/generated) is no longer
used.

* Fix broken links and a few redirections

* Merge master into refactor_docs (manually done)

* Add my and most of @hugovk suggestions

Co-Authored-By: Hugo van Kemenade <hugovk@users.noreply.github.com>

* Add logging and improve configurability

Just some cleaning up up of the DocSection dataclass and added logging
support so you know what's going on.

* Rename a section and please the grammar gods of Black

Thanks @hugovk for the suggestion!

* Fix Markdown comments

* Add myself as an author :P

Seems like the right time.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2020-05-24 09:37:46 -07:00
Richard Si
0196437f8e
Scrollable sidebar (#1457)
* Make the sidebar navigation scrollable

This is necessary since we have so many documentation sections that even
on a desktop screen, the navigation can sometimes be clipped. The only
annoyance is that on Firefox, the scrollbar can't be hidden :(

* allow the docs to build
2020-05-23 11:56:50 -07:00
Kevin Kirsche
f3599b22d4
Fix typos (#1442) 2020-05-21 06:44:43 -07:00
Cooper Lees
b0f3798aab
Add black-primer docs (#1427)
* Add `black-primer` docs

- Document the idea, CLI args, config and a example run for `black-primer` in README.md
- Add to docs/index.rst

* Add @hugovk suggestions - Thanks.
2020-05-18 07:25:40 -07:00
Paul Meinhardt
45c98cf150
Fix Boolean values in pyproject.toml config (#1410)
Boolean values use lowercase identifiers in TOML.
https://github.com/toml-lang/toml#user-content-boolean
2020-05-13 12:51:04 -07:00
Giacomo Tagliabue
89c87d22e7
add --force-exclude argument (#1032)
Co-authored-by: Peter Yu <2057325+yukw777@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2020-05-08 07:47:26 -07:00
Richard Si
8c3c190f99
Add Black compatible configurations in documentation (#1366 & #1205) (#1371)
* Add Black compatible configs in docs ( #1366 & #1205)

When users of Black are starting a new project or are adding Black to their
existing projects, they will usually have to config their existing tools like
flake8 to be compatible with Black. Usually, these configs are the same across
different projects. Yet, there isn't any consolidated infomation on what configs
are compatible. Leaving users of Black to dig out any infomation they can find
in README.md.

* Fix a bad max-line-length value

* Clean up pylint's configs

* Add explanations for each configurations

Copying and pasting code without understanding it is a bad idea. This goes the same
for users copying and pasting configurations.

* Capitalize Pylint

* Link from the README

* Fix the isort configuration

I referenced the wrong source. I used a pesonal configuration, not a pure Black-
compatible configuration.

* Improve the config explanations

The explanation for the isort configuration was pretty bad. After having fixed the
configuration (see commit 01c55d1), improving the its explanation was necessary to
make it more user-friendly and understandable. Also added fenced code blocks of the
raw configuration options so the explanations make sense.

* Improve README wording slightly

* Add @hugovk, @JelleZijlstra + my suggestions

Co-authored-by: Cooper Lees <cooper@fb.com>
2020-05-08 07:26:29 -07:00
Autophagy
ede23ae7ff Add docstrings to fmt checking functions, add to docs
Follow up from #1325

Adds docstrings to the fmt checking functions.
Renames fmt_on to is_fmt_on.
Adds the functions to the autodocs.
2020-05-08 15:47:18 +02:00
Zsolt Dollenstein
9ed2542e93
Omit commit hash and date stamp from doc version (#1322)
This also removes the dependency on setuptools-scm while building the
docs.

Fixes #1104.
2020-03-28 19:06:00 -07:00
Zsolt Dollenstein
a33823e859
Fix readthedocs build (#1321)
* migrate to new rtd config format and pip

* no type field anymore

* use builtin re for docs
2020-03-27 11:43:41 +01:00
Łukasz Langa
5b552fab9d
Update the name of Mode in the reference docs, too 2020-03-04 23:19:21 +01:00
Łukasz Langa
e253f1260d
Introduce a section of docs about exceptions 2020-03-04 22:26:45 +01:00
Denis Laxalde
fb1ac69812 Simple docs cleanup (#1168)
* Remove reference to format_int_string in docs

The function got dropped in 250ba7f04b.

* Remove reference to is_python36 in docs

The function got removed in 36d3c516d3.
2019-11-22 20:38:46 -08:00
Yngve Høiseth
a6d866990e Automatic markdown and YAML formatting with Prettier (#874) 2019-10-21 11:42:46 +02:00
Andrey
6aef6c9d45 #455 Fix bug with tricky unicode symbols (#1047)
* add test for special unicode symbol which usual re can not process correctly
add regex lib which supports unicode 12.1.0 standard
replace re usage in project in favor to regex

* #455 fix dependency
2019-10-13 10:21:15 -07:00
Zsolt Dollenstein
0acad54c02 fix environment for readthedocs 2019-09-18 14:08:03 +01:00
Zsolt Dollenstein
47861a6a3b fix doc generation 2019-09-18 14:00:18 +01:00
Zsolt Dollenstein
c9689b80fb
fix doc generation 2019-08-21 16:41:11 +02:00
Zsolt Dollenstein
77b6ed1b70 Hello github.com/psf! 2019-07-22 21:41:45 +01:00
Hugo
4a953b7241 ambv/black -> python/black (#819) 2019-05-02 20:19:52 +01:00
Łukasz Langa
1610fd6bc5
Add trailing comma for single as imports, too 2018-09-26 08:26:35 -07:00
Łukasz Langa
41368138bb
Fix documentation build 2018-09-18 12:04:30 -07:00
Zsolt Dollenstein
a82f186787 blackd: a HTTP server for blackening (#460) 2018-09-17 10:02:25 -07:00
Jon Dufresne
6027cca10d Prefer https:// links where available (#485) 2018-08-28 13:00:05 +01:00
José Padilla
1e56d02cad Add playground link (#437) 2018-08-17 16:36:57 +01:00
Mariatta
257f7193fa Add travis badge and GitHub Fork banner to docs (#365) 2018-06-18 20:12:49 -07:00
Łukasz Langa
489d00ed8f Support pyproject.toml
Fixes #65
2018-06-06 17:02:10 -07:00
Łukasz Langa
affc0ec3f9 Update beta link in docs 2018-06-06 15:46:30 -07:00
Łukasz Langa
041ec995e5 Nits 2018-06-04 16:57:27 -07:00
Zsolt Dollenstein
00a302560b Preserve line endings when formatting a file in place (#288) 2018-06-04 15:52:06 -07:00
Łukasz Langa
dbe26161fa Reformat docs/conf.py, too. 2018-06-04 12:29:14 -07:00
Łukasz Langa
2ff05f2584 Fix dangling file in documentation 2018-05-28 23:19:40 -07:00
Łukasz Langa
dd4477b701 Always explode data structure literals
Fixes #152
2018-05-17 17:32:43 -07:00
Łukasz Langa
8b64e916f6 Simplify is_trivial_* methods 2018-05-15 13:25:00 -07:00
Łukasz Langa
3eea3aad86 Don't explode trailers that fit in a single line 2018-05-15 01:05:39 -07:00
Łukasz Langa
cfb003f51c Make parentheses invisible recursively in atoms
This fixes non-deterministic formatting when multiple pairs of removable
parentheses are used.

Fixes #183
2018-05-07 11:13:55 -07:00
David Szotten
e84dee52d9 Should this be "_cede_ control" (#187) 2018-05-02 20:25:23 -07:00
Łukasz Langa
b62bd4de75 Add explode_split to documentation 2018-04-24 14:27:21 -07:00
Łukasz Langa
2446941824 Remove dead code 2018-04-19 00:09:13 -07:00
Łukasz Langa
0a340e1f22 Update documentation
* Add "Ignore non-modified files" from the README
* Add missing functions to the reference
2018-04-18 18:19:04 -07:00
Łukasz Langa
a764f1bb3b Generalize star expression handling
Fixes #132
2018-04-16 01:34:15 -07:00
Zsolt Dollenstein
2104b7cdcb Handle unnecessarily escaped strings (#128) 2018-04-13 11:31:23 -07:00
Łukasz Langa
cb5aadad74 Automatic parentheses management
Fixes #4
2018-04-11 01:36:18 -07:00
Łukasz Langa
c4a477bc69 Link VCS integration in documentation 2018-04-05 13:45:16 -07:00
Zsolt Dollenstein
a42aef7806 Describe how string literals are handled (#96) 2018-03-31 14:42:48 -07:00
Mika⠙
3455389e48 Lines now break before all delimiters (#94)
The default behaviour is that now all lines break *before* delimiters,
instead of afterwards. The special cases for this are commas and
behaviour around args.

Resolves #73
2018-03-31 11:52:11 -07:00
Carol Willing
3c62b9cada float python in doc build 2018-03-30 06:17:44 -04:00
Carol Willing
d2f29f86f4 use conda for rtd 2018-03-29 20:31:02 -04:00
Łukasz Langa
b901d75deb Show __str__ in UnformattedLines 2018-03-28 19:31:40 -07:00
Łukasz Langa
653aa40579 Add DebugVisitor.show() to documentation under utility functions 2018-03-28 19:28:31 -07:00
Łukasz Langa
7f7b31058a More minor documentation-related changes 2018-03-28 19:03:16 -07:00
Łukasz Langa
d01460d939 Auto-generated documentation-related fixes 2018-03-28 17:43:18 -07:00
Carol Willing
a9f50cd0b5 document classes, functions, exceptions (#82) 2018-03-28 10:12:27 -07:00
Łukasz Langa
611737f9cc Big documentation deduplication
Most is not generated from README.md so we no longer have to remember to update
two Change Logs, and so on!

If we decide to diverge from the README in Sphinx, that's fine, too. We will
just create dedicated documents.
2018-03-26 18:39:02 -07:00
Łukasz Langa
fa7f3e9166 Improve pypi badge template 2018-03-26 02:27:14 -07:00
Łukasz Langa
4b8823e563 Self-host PyPI-related badges 2018-03-26 02:15:13 -07:00
Łukasz Langa
b38a3b94bd Any logo you like 2018-03-26 01:27:15 -07:00
Łukasz Langa
c5fd578279 18.3a4 2018-03-26 00:57:02 -07:00
Łukasz Langa
cbf010e0a2 The site is cleaner without the 'Related' cruft. 2018-03-26 00:42:29 -07:00
Łukasz Langa
0095701ff9 Not actually using the Model T logo after all 2018-03-24 18:05:37 -07:00
Łukasz Langa
fddf5d44d5 Link to ReadTheDocs 2018-03-24 18:03:50 -07:00
Łukasz Langa
8cf6bdb5b7 Compress the logos better 2018-03-24 17:58:47 -07:00
Łukasz Langa
be563a4748 More documentation fixes for ReadTheDocs 2018-03-24 17:54:13 -07:00
Łukasz Langa
9e31754284 Documentation fixes for ReadTheDocs 2018-03-24 17:15:48 -07:00
Łukasz Langa
0677a53937 Implement # fmt: off and # fmt: on
Fixes #5
2018-03-23 17:16:08 -07:00
Carol Willing
c98a6f134f add sphinx docs skeleton (#71) 2018-03-23 14:27:04 -07:00