Łukasz Langa
489d00ed8f
Support pyproject.toml
...
Fixes #65
2018-06-06 17:02:10 -07:00
Łukasz Langa
f71db23824
Move test data to data
2018-06-06 15:48:38 -07:00
Zsolt Dollenstein
33baccd88e
Change tests with stdin/out to exercise black.main ( #307 )
2018-06-06 15:42:50 -07:00
Łukasz Langa
7fc6ce9906
Fix handling of empty files
2018-06-04 19:04:29 -07:00
Łukasz Langa
728e5a2f1e
Properly format unified diff
...
Previously we weren't using timestamps.
2018-06-04 18:07:03 -07:00
Łukasz Langa
ed91dd4de6
Make source handling use sets instead of lists
...
Also, sort cached file output to be (more) deterministic.
2018-06-04 15:53:37 -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
4c352ad4be
Add --verbose
and report excluded paths in it, too
...
Fixes #283
2018-06-04 12:09:18 -07:00
Łukasz Langa
36bed855e1
Introduce "project root" as a concept
...
This is required for regular expressions in `--include=` and `--exclude=` not
to catch false positives from directories outside of the project.
2018-06-04 11:03:18 -07:00
Zsolt Dollenstein
ef903ecd46
Skip symlink test if can't create one ( #287 )
2018-06-01 14:47:07 -07:00
Łukasz Langa
8a82e0bf9a
Make empty --include mean "anything goes", simplify gen_python_files_in_dir
2018-05-31 19:40:07 -07:00
Mika⠙
51756a405c
Added --include and --exclude cli options ( #281 )
...
These 2 options allow you to pass in regular expressions that determine
whether files/directories are included or excluded in the recursive file
search.
Fixes #270
2018-05-31 17:51:15 -07:00
Łukasz Langa
8ebbd26888
Add --skip-string-normalization
...
Fixes #118
2018-05-30 12:56:16 -07:00
Łukasz Langa
023e61a254
Refactor --pyi and --py36 into FileMode
2018-05-29 01:53:54 -07:00
Luka Sterbic
e818260f1a
Class new line between docstrings / vars / methods ( #219 )
...
Partially addresses #144
2018-05-28 23:48:59 -07:00
Carl Meyer
07b1b2f3dd
Add --pyi and --py36 flags ( #249 )
...
Fixes #244 .
2018-05-23 11:01:26 -07:00
Jelle Zijlstra
14ba1bf8b6
Add support for pyi files ( #210 )
...
Fixes #207
2018-05-15 15:09:35 -04:00
Miguel Gaiowski
c667b85a7f
Check for broken symlinks before checking file data ( #202 )
2018-05-15 01:13:48 -04:00
Jelle Zijlstra
21c8dc85f5
Remove u prefix if unicode_literals is present ( #199 )
2018-05-09 18:26:41 -04:00
Łukasz Langa
1747c388bb
Discover whether a file is Python 3.6+ also by stars in calls
...
Fixes a pathological situation where if a function signature used a trailing
comma but was later reformatted to a single line (with the trailing comma
removed), Black would change its mind whether a file is Python
3.6-compatible between runs.
2018-05-08 21:57:09 -07:00
snlkapil
6dbb657681
Removing empty parentheses after class name ( #180 )
2018-05-07 10:15:24 -07:00
Christian Heimes
2d9eaafa97
Output something when no files are reformatted ( #190 )
...
Just executing ``black`` without any argument does not print any message
to stdout or stderr. It's rather confusing, because the user doesn't
know what happened.
In ``len(sources) == 0`` case, black now prints ``No paths given. Nothing to
do``.
Signed-off-by: Christian Heimes <christian@python.org>
2018-05-07 10:12:47 -07:00
Zsolt Dollenstein
9f096d5536
Format subscriptions in a PEP-8 compliant way ( #178 )
...
Fixes #157
2018-04-30 22:49:30 -07:00
Jonas Obrist
92957a41e3
Make cache work with non-default line lenghts ( #163 )
2018-04-24 11:56:50 -07:00
Łukasz Langa
52fda8b0e9
Support sticky standalone comments (comments preceding defs, classes, and decorators)
...
Fixes #56
Fixes #154
2018-04-24 11:50:31 -07:00
Vishwas B Sharma
29e97d1d4a
[ #154 ] Handle comments between decorators properly ( #166 )
2018-04-24 09:38:12 -07:00
Łukasz Langa
54d707e10a
Allow standalone comments to close code blocks
...
Fixes #16
Fixes #32
2018-04-23 16:17:12 -07:00
Łukasz Langa
06e95b1e9b
Show full path on diffs
...
Fixes #130
2018-04-23 12:00:03 -07:00
Zsolt Dollenstein
c012c70176
Fix tests on windows ( #159 )
2018-04-23 11:23:36 -07:00
Vishwas B Sharma
5e1e1a1820
[ #149 ] Make check and diff not mutually exclusive ( #161 )
...
Fixes #149 .
2018-04-23 11:23:11 -07:00
Łukasz Langa
8429f3a63b
Revert format_file_in_place()
and format_stdin_to_stdout()
to return bools
...
`Changed.CACHED` is meaningless for those two functions.
2018-04-18 17:46:03 -07:00
Jonas Obrist
639b62dcd3
Added caching ( #136 )
...
Black will cache already formatted files using their file size and
modification timestamp. The cache is per-user and will always be used
unless Black is used with --diff or with code provided via standard
input.
2018-04-18 17:27:07 -07:00
Łukasz Langa
a764f1bb3b
Generalize star expression handling
...
Fixes #132
2018-04-16 01:34:15 -07:00
Zsolt Dollenstein
8e7848c63e
Open temporary files with utf-8 encoding ( #126 )
...
This is not the default on Windows.
2018-04-12 11:19:21 -07:00
Łukasz Langa
cb5aadad74
Automatic parentheses management
...
Fixes #4
2018-04-11 01:36:18 -07:00
Łukasz Langa
1d45f6e6a1
Improve test coverage a bit
2018-03-31 15:46:09 -07:00
Łukasz Langa
a20a3eeb0f
Support --diff for both files and stdin
...
Fixes #87
2018-03-31 15:46:09 -07:00
Zsolt Dollenstein
80bd2b3134
Normalize string quotes ( #75 )
...
* Normalize string quotes
Convert single-quoted strings to double-quoted. Convert triple single-quoted strings to triple double-quoted. Do not touch any strings where conversion would increase the number of backslashes.
Fixes #51 .
* reformat Black itself
2018-03-31 11:21:25 -07:00
Łukasz Langa
17b22642f5
More comments tests
2018-03-29 21:19:20 -07:00
Łukasz Langa
c55d08d0b9
Remove standalone comment hacks
...
Now Black properly splits standalone comments within bracketed expressions.
They are treated as another type of split instead of being bolted on with
whitespace prefixes.
A related fix: now multiple comments might appear after a given leaf.
Fixes #22
2018-03-29 21:10:00 -07:00
Łukasz Langa
fc869039eb
Don't crash and burn on empty lines with trailing whitespace
...
Fixes #80
2018-03-26 18:41:25 -07:00
Łukasz Langa
0677a53937
Implement # fmt: off
and # fmt: on
...
Fixes #5
2018-03-23 17:16:08 -07:00
Łukasz Langa
7e1c5b2ba6
Introduce DebugVisitor.show() + tests
2018-03-23 16:08:05 -07:00
Łukasz Langa
6316e293ac
Automatic detection of deprecated Python 2 forms of print and exec
...
Note: if those are handled, you can't use --safe because this check is using
Python 3.6+ builtin AST.
Fixes #49
2018-03-22 23:19:23 -07:00
Łukasz Langa
8de552eb4f
Only return exit code 1 when --check is used
...
Also, output less confusing messages in --check.
Fixes #50
2018-03-22 17:33:44 -07:00
Łukasz Langa
591bedc2be
Support skipping AST printing on test failure
2018-03-20 18:55:04 -07:00
Łukasz Langa
d1e0d79e38
Don't write back stdin to stdout when --check is passed
2018-03-20 18:54:55 -07:00
Łukasz Langa
e911c79809
Don't remove single empty lines outside of bracketed expressions
...
Fixes #19
2018-03-20 18:54:19 -07:00
treuherz
10d8976a79
Add piping from stdin to stdout with a - ( #25 )
...
Being able to format code by piping it through the formatter makes it much easier to integrate with tools like google/vim-codefmt or Chiel92/vim-autoformat.
2018-03-19 11:07:10 -07:00
Łukasz Langa
9fea478022
Also run mypy on test_black.py
2018-03-15 23:55:22 -07:00