1# Change Log 2# All notable changes to this project will be documented in this file. 3# This project adheres to [Semantic Versioning](http://semver.org/). 4 5## [0.32.0] 2021-12-26 6### Added 7- Look at the 'pyproject.toml' file to see if it contains ignore file information 8 for YAPF. 9- New entry point `yapf_api.FormatTree` for formatting lib2to3 concrete 10 syntax trees. 11- Add CI via GitHub Actions. 12### Changes 13- Change tests to support "pytest". 14- Reformat so that "flake8" is happy. 15- Use GitHub Actions instead of Travis for CI. 16- Clean up the FormatToken interface to limit how much it relies upon the 17 pytree node object. 18- Rename "unwrapped_line" module to "logical_line." 19- Rename "UnwrappedLine" class to "LogicalLine." 20### Fixed 21- Enable `BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF` knob for "pep8" style, so 22 method definitions inside a class are surrounded by a single blank line as 23 prescribed by PEP8. 24- Fixed the '...' token to be spaced after a colon. 25 26## [0.31.0] 2021-03-14 27### Added 28- Renamed 'master' brannch to 'main'. 29- Add 'BLANK_LINES_BETWEEN_TOP_LEVEL_IMPORTS_AND_VARIABLES' to support setting 30 a custom number of blank lines between top-level imports and variable 31 definitions. 32- Ignore end of line `# copybara:` directives when checking line length. 33- Look at the 'pyproject.toml' file to see if it contains style information for 34 YAPF. 35### Changed 36- Do not scan excluded directories. Prior versions would scan an excluded 37 folder then exclude its contents on a file by file basis. Preventing the 38 folder being scanned is faster. 39### Fixed 40- Exclude directories on Windows. 41 42## [0.30.0] 2020-04-23 43### Added 44- Added `SPACES_AROUND_LIST_DELIMITERS`, `SPACES_AROUND_DICT_DELIMITERS`, 45 and `SPACES_AROUND_TUPLE_DELIMITERS` to add spaces after the opening- 46 and before the closing-delimiters for lists, dicts, and tuples. 47- Adds `FORCE_MULTILINE_DICT` knob to ensure dictionaries always split, 48 even when shorter than the max line length. 49- New knob `SPACE_INSIDE_BRACKETS` to add spaces inside brackets, braces, and 50 parentheses. 51- New knob `SPACES_AROUND_SUBSCRIPT_COLON` to add spaces around the subscript / 52 slice operator. 53### Changed 54- Renamed "chromium" style to "yapf". Chromium will now use PEP-8 directly. 55- `CONTINUATION_ALIGN_STYLE` with `FIXED` or `VALIGN-RIGHT` now works with 56 space indentation. 57### Fixed 58- Honor a disable directive at the end of a multiline comment. 59- Don't require splitting before comments in a list when 60 `SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES` is set. The knob is meant for 61 values, not comments, which may be associated with the current line. 62- Don't over-indent a parameter list when not needed. But make sure it is 63 properly indented so that it doesn't collide with the lines afterwards. 64- Don't split between two-word comparison operators: "is not", "not in", etc. 65 66## [0.29.0] 2019-11-28 67### Added 68- Add the `--quiet` flag to suppress output. The return code is 1 if there are 69 changes, similarly to the `--diff` flag. 70- Add the `indent_closing_brackets` option. This is the same as the 71 `dedent_closing_brackets` option except the brackets are indented the same 72 as the previous line. 73### Changed 74- Collect a parameter list into a single object. This allows us to track how a 75 parameter list is formatted, keeping state along the way. This helps when 76 supporting Python 3 type annotations. 77- Catch and report `UnicodeDecodeError` exceptions. 78- Improved description of .yapfignore syntax. 79### Fixed 80- Format subscript lists so that splits are essentially free after a comma. 81- Don't add a space between a string and its subscript. 82- Extend discovery of '.style.yapf' & 'setup.cfg' files to search the root 83 directory as well. 84- Make sure we have parameters before we start calculating penalties for 85 splitting them. 86- Indicate if a class/function is nested to ensure blank lines when needed. 87- Fix extra indentation in async-for else statement. 88- A parameter list with no elements shouldn't count as exceeding the column 89 limit. 90- When splitting all comma separated values, don't treat the ending bracket as 91 special. 92- The "no blank lines between nested classes or functions" knob should only 93 apply to the first nested class or function, not all of them. 94 95## [0.28.0] 2019-07-11 96### Added 97- New knob `SPLIT_ALL_TOP_LEVEL_COMMA_SEPARATED_VALUES` is a variation on 98 `SPLIT_ALL_COMMA_SEPARATED_VALUES` in which, if a subexpression with a comma 99 fits in its starting line, then the subexpression is not split (thus avoiding 100 unnecessary splits). 101### Changed 102- Set `INDENT_DICTIONARY_VALUE` for Google style. 103- Set `JOIN_MULTIPLE_LINES = False` for Google style. 104### Fixed 105- `BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF=False` wasn't honored because the 106 number of newlines was erroneously calculated beforehand. 107- Lambda expressions shouldn't have an increased split penalty applied to the 108 'lambda' keyword. This prevents them from being properly formatted when they're 109 arguments to functions. 110- A comment with continuation markers (??) shouldn't mess with the lineno count. 111- Only emit unformatted if the "disable long line" is at the end of the line. 112 Otherwise we could mess up formatting for containers which have them 113 interspersed with code. 114- Fix a potential race condition by using the correct style for opening a file 115 which may not exist. 116 117## [0.27.0] 2019-04-07 118### Added 119- `SPLIT_BEFORE_ARITHMETIC_OPERATOR` splits before an arithmetic operator when 120 set. `SPLIT_PENALTY_ARITHMETIC_OPERATOR` allows you to set the split penalty 121 around arithmetic operators. 122### Changed 123- Catch lib2to3's "TokenError" exception and output a nicer message. 124### Fixed 125- Parse integer lists correctly, removing quotes if the list is within a 126 string. 127- Adjust the penalties of bitwise operands for '&' and '^', similar to '|'. 128- Avoid splitting after opening parens if SPLIT_BEFORE_FIRST_ARGUMENT is set 129 to False. 130- Adjust default SPLIT_PENALTY_AFTER_OPENING_BRACKET. 131- Re-enable removal of extra lines on the boundaries of formatted regions. 132- Adjust list splitting to avoid splitting before a dictionary element, because 133 those are likely to be split anyway. If we do split, it leads to horrible 134 looking code. 135- Dictionary arguments were broken in a recent version. It resulted in 136 unreadable formatting, where the remaining arguments were indented far more 137 than the dictionary. Fixed so that if the dictionary is the first argument in 138 a function call and doesn't fit on a single line, then it forces a split. 139- Improve the connectiveness between items in a list. This prevents random 140 splitting when it's not 100% necessary. 141- Don't remove a comment attached to a previous object just because it's part 142 of the "prefix" of a function/class node. 143 144## [0.26.0] 2019-02-08 145### Added 146- `ALLOW_SPLIT_BEFORE_DEFAULT_OR_NAMED_ASSIGNS` allows us to split before 147 default / named assignments. 148- `ARITHMETIC_PRECEDENCE_INDICATION` removes spacing around binary operators 149 if they have higher precedence than other operators in the same expression. 150### Changed 151- `SPACES_BEFORE_COMMENT` can now be assigned to a specific value (standard 152 behavior) or a list of column values. When assigned to a list, trailing 153 comments will be horizontally aligned to the first column value within 154 the list that is greater than the maximum line length in the block. 155- Don't modify the vertical spacing of a line that has a comment "pylint: 156 disable=line-too-long". The line is expected to be too long. 157- improved `CONTINUATION_ALIGN_STYLE` to accept quoted or underline-separated 158 option value for passing option with command line arguments. 159### Fixed 160- When retrieving the opening bracket make sure that it's actually an opening 161 bracket. 162- Don't completely deny a lambda formatting if it goes over the column limit. 163 Split only if absolutely necessary. 164- Bump up penalty for splitting before a dot ('.'). 165- Ignore pseudo tokens when calculating split penalties. 166- Increase the penalty for splitting before the first bit of a subscript. 167- Improve splitting before dictionary values. Look more closely to see if the 168 dictionary entry is a container. If so, then it's probably split over 169 multiple lines with the opening bracket on the same line as the key. 170 Therefore, we shouldn't enforce a split because of that. 171- Increase split penalty around exponent operator. 172- Correct spacing when using binary operators on strings with the 173 `NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS` option enabled. 174 175## [0.25.0] 2018-11-25 176### Added 177- Added `INDENT_BLANK_LINES` knob to select whether the blank lines are empty 178 or indented consistently with the current block. 179- Support additional file exclude patterns in .yapfignore file. 180### Fixed 181- Correctly determine if a scope is the last in line. It avoids a wrong 182 computation of the line end when determining if it must split after the 183 opening bracket with `DEDENT_CLOSING_BRACKETS` enabled. 184 185## [0.24.0] 2018-09-07 186### Added 187- Added 'SPLIT_BEFORE_DOT' knob to support "builder style" calls. The "builder 188 style" option didn't work as advertised. Lines would split after the dots, 189 not before them regardless of the penalties. 190### Changed 191- Support Python 3.7 in the tests. The old "comp_for" and "comp_if" nodes are 192 now "old_comp_for" and "old_comp_if" in lib2to3. 193### Fixed 194- Don't count inner function calls when marking arguments as named assignments. 195- Make sure that tuples and the like are formatted nicely if they all can't fit 196 on a single line. This is similar to how we format function calls within an 197 argument list. 198- Allow splitting in a subscript if it goes over the line limit. 199- Increase the split penalty for an if-expression. 200- Increase penalty for splitting in a subscript so that it's more likely to 201 split in a function call or other data literal. 202- Cloning a pytree node doesn't transfer its a annotations. Make sure we do 203 that so that we don't lose information. 204- Revert change that broke the "no_spaces_around_binary_operators" option. 205- The "--style-help" option would output string lists and sets in Python types. 206 If the output was used as a style, then it wouldn't parse those values 207 correctly. 208 209## [0.23.0] 2018-08-27 210### Added 211- `DISABLE_ENDING_COMMA_HEURISTIC` is a new knob to disable the heuristic which 212 splits a list onto separate lines if the list is comma-terminated. 213### Fixed 214- There's no need to increase N_TOKENS. In fact, it causes other things which 215 use lib2to3 to fail if called from YAPF. 216- Change the exception message instead of creating a new one that's just a 217 clone. 218- Make sure not to reformat when a line is disabled even if the --lines option 219 is specified. 220- The "no spaces around operators" flag wasn't correctly converting strings to 221 sets. Changed the regexp to handle it better. 222 223## [0.22.0] 2018-05-15 224### Added 225- The `BLANK_LINE_BEFORE_MODULE_DOCSTRING` knob adds a blank line before a 226 module's docstring. 227- The `SPLIT_ALL_COMMA_SEPARATED_VALUES` knob causes all lists, tuples, dicts 228 function defs, etc... to split on all values, instead of maximizing the 229 number of elements on each line, when not able to fit on a single line. 230### Changed 231- Improve the heuristic we use to determine when to split at the start of a 232 function call. First check whether or not all elements can fit in the space 233 without wrapping. If not, then we split. 234- Check all of the elements of a tuple. Similarly to how arguments are 235 analyzed. This allows tuples to be split more rationally. 236- Adjust splitting penalties around arithmetic operators so that the code can 237 flow more freely. The code must flow! 238- Try to meld an argument list's closing parenthesis to the last argument. 239### Fixed 240- Attempt to determine if long lambdas are allowed. This can be done on a 241 case-by-case basis with a "pylint" disable comment. 242- A comment before a decorator isn't part of the decorator's line. 243- Only force a new wrapped line after a comment in a decorator when it's the 244 first token in the decorator. 245 246## [0.21.0] 2018-03-18 247### Added 248- Introduce a new option of formatting multiline literals. Add 249 `SPLIT_BEFORE_CLOSING_BRACKET` knob to control whether closing bracket should 250 get their own line. 251- Added `CONTINUATION_ALIGN_STYLE` knob to choose continuation alignment style 252 when `USE_TABS` is enabled. 253- Add 'BLANK_LINES_AROUND_TOP_LEVEL_DEFINITION' knob to control the number 254 of blank lines between top-level function and class definitions. 255### Fixed 256- Don't split ellipses. 257 258## [0.20.2] 2018-02-12 259### Changed 260- Improve the speed at which files are excluded by ignoring them earlier. 261- Allow dictionaries to stay on a single line if they only have one entry 262### Fixed 263- Use tabs when constructing a continuation line when `USE_TABS` is enabled. 264- A dictionary entry may not end in a colon, but may be an "unpacking" 265 operation: `**foo`. Take that into account and don't split after the 266 unpacking operator. 267 268## [0.20.1] 2018-01-13 269### Fixed 270- Don't treat 'None' as a keyword if calling a function on it, like '__ne__()'. 271- use_tabs=True always uses a single tab per indentation level; spaces are 272 used for aligning vertically after that. 273- Relax the split of a paren at the end of an if statement. With 274 `dedent_closing_brackets` option requires that it be able to split there. 275 276## [0.20.0] 2017-11-14 277### Added 278- Improve splitting of comprehensions and generators. Add 279 `SPLIT_PENALTY_COMPREHENSION` knob to control preference for keeping 280 comprehensions on a single line and `SPLIT_COMPLEX_COMPREHENSION` to enable 281 splitting each clause of complex comprehensions onto its own line. 282### Changed 283- Take into account a named function argument when determining if we should 284 split before the first argument in a function call. 285- Split before the first argument in a function call if the arguments contain a 286 dictionary that doesn't fit on a single line. 287- Improve splitting of elements in a tuple. We want to split if there's a 288 function call in the tuple that doesn't fit on the line. 289### Fixed 290- Enforce spaces between ellipses and keywords. 291- When calculating the split penalty for a "trailer", process the child nodes 292 afterwards because their penalties may change. For example if a list 293 comprehension is an argument. 294- Don't enforce a split before a comment after the opening of a container if it 295 doesn't it on the current line. We try hard not to move such comments around. 296- Use a TextIOWrapper when reading from stdin in Python3. This is necessary for 297 some encodings, like cp936, used on Windows. 298- Remove the penalty for a split before the first argument in a function call 299 where the only argument is a generator expression. 300 301## [0.19.0] 2017-10-14 302### Added 303- Added `SPLIT_BEFORE_EXPRESSION_AFTER_OPENING_PAREN` that enforces a split 304 after the opening paren of an expression that's surrounded by parens. 305### Changed 306- Split before the ending bracket of a comma-terminated tuple / argument list 307 if it's not a single element tuple / arg list. 308### Fixed 309- Prefer to split after a comma in an argument list rather than in the middle 310 of an argument. 311- A non-multiline string may have newlines if it contains continuation markers 312 itself. Don't add a newline after the string when retaining the vertical 313 space. 314- Take into account the "async" keyword when determining if we must split 315 before the first argument. 316- Increase affinity for "atom" arguments in function calls. This helps prevent 317 lists from being separated when they don't need to be. 318- Don't place a dictionary argument on its own line if it's the last argument 319 in the function call where that function is part of a builder-style call. 320- Append the "var arg" type to a star in a star_expr. 321 322## [0.18.0] 2017-09-18 323### Added 324- Option `ALLOW_SPLIT_BEFORE_DICT_VALUE` allows a split before a value. If 325 False, then it won't be split even if it goes over the column limit. 326### Changed 327- Use spaces around the '=' in a typed name argument to align with 3.6 syntax. 328### Fixed 329- Allow semicolons if the line is disabled. 330- Fix issue where subsequent comments at decreasing levels of indentation 331 were improperly aligned and/or caused output with invalid syntax. 332- Fix issue where specifying a line range removed a needed line before a 333 comment. 334- Fix spacing between unary operators if one is 'not'. 335- Indent the dictionary value correctly if there's a multi-line key. 336- Don't remove needed spacing before a comment in a dict when in "chromium" 337 style. 338- Increase indent for continuation line with same indent as next logical line 339 with 'async with' statement. 340 341## [0.17.0] 2017-08-20 342### Added 343- Option `NO_SPACES_AROUND_SELECTED_BINARY_OPERATORS` prevents adding spaces 344 around selected binary operators, in accordance with the current style guide. 345### Changed 346- Adjust blank lines on formatting boundaries when using the `--lines` option. 347- Return 1 if a diff changed the code. This is in line with how GNU diff acts. 348- Add `-vv` flag to print out file names as they are processed 349### Fixed 350- Corrected how `DEDENT_CLOSING_BRACKETS` and `COALESCE_BRACKETS` interacted. 351- Fix return value to return a boolean. 352- Correct vim plugin not to clobber edited code if yapf returns an error. 353- Ensured comma-terminated tuples with multiple elements are split onto separate lines. 354 355## [0.16.3] 2017-07-13 356### Changed 357- Add filename information to a ParseError exception. 358### Fixed 359- A token that ends in a continuation marker may have more than one newline in 360 it, thus changing its "lineno" value. This can happen if multiple 361 continuation markers are used with no intervening tokens. Adjust the line 362 number to account for the lines covered by those markers. 363- Make sure to split after a comment even for "pseudo" parentheses. 364 365## [0.16.2] 2017-05-19 366### Fixed 367- Treat expansion operators ('*', '**') in a similar way to function calls to 368 avoid splitting directly after the opening parenthesis. 369- Increase the penalty for splitting after the start of a tuple. 370- Increase penalty for excess characters. 371- Check that we have enough children before trying to access them all. 372- Remove trailing whitespaces from comments. 373- Split before a function call in a list if the full list isn't able to fit on 374 a single line. 375- Trying not to split around the '=' of a named assign. 376- Changed split before the first argument behavior to ignore compound 377 statements like if and while, but not function declarations. 378- Changed coalesce brackets not to line split before closing bracket. 379 380## [0.16.1] 2017-03-22 381### Changed 382- Improved performance of cloning the format decision state object. This 383 improved the time in one *large* case from 273.485s to 234.652s. 384- Relax the requirement that a named argument needs to be on one line. Going 385 over the column limit is more of an issue to pylint than putting named args 386 on multiple lines. 387- Don't make splitting penalty decisions based on the original formatting. This 388 can and does lead to non-stable formatting, where yapf will reformat the same 389 code in different ways. 390### Fixed 391- Ensure splitting of arguments if there's a named assign present. 392- Prefer to coalesce opening brackets if it's not at the beginning of a 393 function call. 394- Prefer not to squish all of the elements in a function call over to the 395 right-hand side. Split the arguments instead. 396- We need to split a dictionary value if the first element is a comment anyway, 397 so don't force the split here. It's forced elsewhere. 398- Ensure tabs are used for continued indentation when USE_TABS is True. 399 400## [0.16.0] 2017-02-05 401### Added 402- The `EACH_DICT_ENTRY_ON_SEPARATE_LINE` knob indicates that each dictionary 403 entry should be in separate lines if the full dictionary isn't able to fit on 404 a single line. 405- The `SPLIT_BEFORE_DICT_SET_GENERATOR` knob splits before the `for` part of a 406 dictionary/set generator. 407- The `BLANK_LINE_BEFORE_CLASS_DOCSTRING` knob adds a blank line before a 408 class's docstring. 409- The `ALLOW_MULTILINE_DICTIONARY_KEYS` knob allows dictionary keys to span 410 more than one line. 411### Fixed 412- Split before all entries in a dict/set or list maker when comma-terminated, 413 even if there's only one entry. 414- Will now try to set O_BINARY mode on stdout under Windows and Python 2. 415- Avoid unneeded newline transformation when writing formatted code to 416 output on (affects only Python 2) 417 418## [0.15.2] 2017-01-29 419### Fixed 420- Don't perform a global split when a named assign is part of a function call 421 which itself is an argument to a function call. I.e., don't cause 'a' to 422 split here: 423 424 func(a, b, c, d(x, y, z=42)) 425- Allow splitting inside a subscript if it's a logical or bitwise operating. 426 This should keep the subscript mostly contiguous otherwise. 427 428## [0.15.1] 2017-01-21 429### Fixed 430- Don't insert a space between a type hint and the '=' sign. 431- The '@' operator can be used in Python 3 for matrix multiplication. Give the 432 '@' in the decorator a DECORATOR subtype to distinguish it. 433- Encourage the formatter to split at the beginning of an argument list instead 434 of in the middle. Especially if the middle is an empty parameter list. This 435 adjusts the affinity of binary and comparison operators. In particular, the 436 "not in" and other such operators don't want to have a split after it (or 437 before it) if at all possible. 438 439## [0.15.0] 2017-01-12 440### Added 441- Keep type annotations intact as much as possible. Don't try to split the over 442 multiple lines. 443### Fixed 444- When determining if each element in a dictionary can fit on a single line, we 445 are skipping dictionary entries. However, we need to ignore comments in our 446 calculations and implicitly concatenated strings, which are already placed on 447 separate lines. 448- Allow text before a "pylint" comment. 449- Also allow text before a "yapf: (disable|enable)" comment. 450 451## [0.14.0] 2016-11-21 452### Added 453- formatting can be run in parallel using the "-p" / "--parallel" flags. 454### Fixed 455- "not in" and "is not" should be subtyped as binary operators. 456- A non-Node dictionary value may have a comment before it. In those cases, we 457 want to avoid encompassing only the comment in pseudo parens. So we include 458 the actual value as well. 459- Adjust calculation so that pseudo-parentheses don't count towards the total 460 line length. 461- Don't count a dictionary entry as not fitting on a single line in a 462 dictionary. 463- Don't count pseudo-parentheses in the length of the line. 464 465## [0.13.2] 2016-10-22 466### Fixed 467- REGRESSION: A comment may have a prefix with newlines in it. When calculating 468 the prefix indent, we cannot take the newlines into account. Otherwise, the 469 comment will be misplaced causing the code to fail. 470 471## [0.13.1] 2016-10-17 472### Fixed 473- Correct emitting a diff that was accidentally removed. 474 475## [0.13.0] 2016-10-16 476### Added 477- Added support to retain the original line endings of the source code. 478 479### Fixed 480- Functions or classes with comments before them were reformatting the comments 481 even if the code was supposed to be ignored by the formatter. We now don't 482 adjust the whitespace before a function's comment if the comment is a 483 "disabled" line. We also don't count "# yapf: {disable|enable}" as a disabled 484 line, which seems logical. 485- It's not really more readable to split before a dictionary value if it's part 486 of a dictionary comprehension. 487- Enforce two blank lines after a function or class definition, even before a 488 comment. (But not between a decorator and a comment.) This is related to PEP8 489 error E305. 490- Remove O(n^2) algorithm from the line disabling logic. 491 492## [0.12.2] 2016-10-09 493### Fixed 494- If `style.SetGlobalStyle(<create pre-defined style>)` was called and then 495 `yapf_api.FormatCode` was called, the style set by the first call would be 496 lost, because it would return the style created by `DEFAULT_STYLE_FACTORY`, 497 which is set to PEP8 by default. Fix this by making the first call set which 498 factory we call as the "default" style. 499- Don't force a split before non-function call arguments. 500- A dictionary being used as an argument to a function call and which can exist 501 on a single line shouldn't be split. 502- Don't rely upon the original line break to determine if we should split 503 before the elements in a container. Especially split if there's a comment in 504 the container. 505- Don't add spaces between star and args in a lambda expression. 506- If a nested data structure terminates in a comma, then split before the first 507 element, but only if there's more than one element in the list. 508 509## [0.12.1] 2016-10-02 510### Changed 511- Dictionary values will be placed on the same line as the key if *all* of the 512 elements in the dictionary can be placed on one line. Otherwise, the 513 dictionary values will be placed on the next line. 514 515### Fixed 516- Prefer to split before a terminating r-paren in an argument list if the line 517 would otherwise go over the column limit. 518- Split before the first key in a dictionary if the dictionary cannot fit on a 519 single line. 520- Don't count "pylint" comments when determining if the line goes over the 521 column limit. 522- Don't count the argument list of a lambda as a named assign in a function 523 call. 524 525## [0.12.0] 2016-09-25 526### Added 527- Support formatting of typed names. Typed names are formatted a similar way to 528 how named arguments are formatted, except that there's a space after the 529 colon. 530- Add a knob, 'SPACES_AROUND_DEFAULT_OR_NAMED_ASSIGN', to allow adding spaces 531 around the assign operator on default or named assigns. 532 533## Changed 534- Turn "verification" off by default for external APIs. 535- If a function call in an argument list won't fit on the current line but will 536 fit on a line by itself, then split before the call so that it won't be split 537 up unnecessarily. 538 539## Fixed 540- Don't add space after power operator if the next operator's a unary operator. 541 542## [0.11.1] 2016-08-17 543### Changed 544- Issue #228: Return exit code 0 on success, regardless of whether files were 545 changed. (Previously, 0 meant success with no files 546 modified, and 2 meant success with at least one file modified.) 547 548### Fixed 549- Enforce splitting each element in a dictionary if comma terminated. 550- It's okay to split in the middle of a dotted name if the whole expression is 551 going to go over the column limit. 552- Asynchronous functions were going missing if they were preceded by a comment 553 (a what? exactly). The asynchronous function processing wasn't taking the 554 comment into account and thus skipping the whole function. 555- The splitting of arguments when comma terminated had a conflict. The split 556 penalty of the closing bracket was set to the maximum, but it shouldn't be if 557 the closing bracket is preceded by a comma. 558 559## [0.11.0] 2016-07-17 560### Added 561- The COALESCE_BRACKETS knob prevents splitting consecutive brackets when 562 DEDENT_CLOSING_BRACKETS is set. 563- Don't count "pylint" directives as exceeding the column limit. 564 565### Changed 566- We split all of the arguments to a function call if there's a named argument. 567 In this case, we want to split after the opening bracket too. This makes 568 things look a bit better. 569 570### Fixed 571- When retaining format of a multiline string with Chromium style, make sure 572 that the multiline string doesn't mess up where the following comma ends up. 573- Correct for when 'lib2to3' smooshes comments together into the same DEDENT 574 node. 575 576## [0.10.0] 2016-06-14 577### Added 578- Add a knob, 'USE_TABS', to allow using tabs for indentation. 579 580### Changed 581- Performance enhancements. 582 583### Fixed 584- Don't split an import list if it's not surrounded by parentheses. 585 586## [0.9.0] 2016-05-29 587### Added 588- Added a knob (SPLIT_PENALTY_BEFORE_IF_EXPR) to adjust the split penalty 589 before an if expression. This allows the user to place a list comprehension 590 all on one line. 591- Added a knob (SPLIT_BEFORE_FIRST_ARGUMENT) that encourages splitting before 592 the first element of a list of arguments or parameters if they are going to 593 be split anyway. 594- Added a knob (SPLIT_ARGUMENTS_WHEN_COMMA_TERMINATED) splits arguments to a 595 function if the list is terminated by a comma. 596 597### Fixed 598- Don't split before a first element list argument as we would before a first 599 element function call. 600- Don't penalize when we must split a line. 601- Allow splitting before the single argument in a function call. 602 603## [0.8.2] 2016-05-21 604### Fixed 605- Prefer not to split after the opening of a subscript. 606- Don't add space before the 'await' keyword if it's preceded by an opening 607 paren. 608- When we're setting the split penalty for a continuous list, we don't want to 609 mistake a comment at the end of that list as part of the list. 610- When calculating blank lines, don't assume the last seen object was a class 611 or function when we're in a class or function. 612- Don't count the closing scope when determining if the current scope is the 613 last scope on the line. 614 615## [0.8.1] 2016-05-18 616### Fixed 617- 'SPLIT_BEFORE_LOGICAL_OPERATOR' wasn't working correctly. The penalty was 618 being set incorrectly when it was part of a larger construct. 619- Don't separate a keyword, like "await", from a left paren. 620- Don't rely upon the original tokens' line number to determine if we should 621 perform splitting in Facebook mode. The line number isn't the line number of 622 the reformatted token, but the line number where it was in the original code. 623 Instead, we need to carefully determine if the line is liabel to be split and 624 act accordingly. 625 626## [0.8.0] 2016-05-10 627### Added 628- Add a knob, 'SPACES_AROUND_POWER_OPERATOR', to allow adding spaces around the 629 power operator. 630 631### Fixed 632- There shouldn't be a space between a decorator and an intervening comment. 633- If we split before a bitwise operator, then we assume that the programmer 634 knows what they're doing, more or less, and so we enforce a split before said 635 operator if one exists in the original program. 636- Strengthen the bond between a keyword and value argument. 637- Don't add a blank line after a multiline string. 638- If the "for" part of a list comprehension can exist on the starting line 639 without going over the column limit, then let it remain there. 640 641## [0.7.1] 2016-04-21 642### Fixed 643- Don't rewrite the file if there are no changes. 644- Ensure the proper number of blank lines before an async function. 645- Split after a bitwise operator when in PEP 8 mode. 646- Retain the splitting within a dictionary data literal between the key and 647 value. 648- Try to keep short function calls all on one line even if they're part of a 649 larger series of tokens. This stops us from splitting too much. 650 651## [0.7.0] 2016-04-09 652### Added 653- Support for Python 3.5. 654- Add 'ALLOW_MULTILINE_LAMBDAS' which allows lambdas to be formatted onto 655 multiple lines. 656 657### Fixed 658- Lessen penalty for splitting before a dictionary keyword. 659- Formatting of trailing comments on disabled formatting lines. 660- Disable / enable formatting at end of multi-line comment. 661 662## [0.6.3] 2016-03-06 663### Changed 664- Documentation updated. 665 666### Fixed 667- Fix spacing of multiline comments when formatting is disabled. 668 669## [0.6.2] 2015-11-01 670### Changed 671- Look at the 'setup.cfg' file to see if it contains style information for 672 YAPF. 673- Look at the '~/.config/yapf/style' file to see if it contains global style 674 information for YAPF. 675 676### Fixed 677- Make lists that can fit on one line more likely to stay together. 678- Correct formatting of '*args' and '**kwargs' when there are default values in 679 the argument list. 680 681## [0.6.1] 2015-10-24 682### Fixed 683- Make sure to align comments in data literals correctly. Also make sure we 684 don't count a "#." in a string as an i18n comment. 685- Retain proper vertical spacing before comments in a data literal. 686- Make sure that continuations from a compound statement are distinguished from 687 the succeeding line. 688- Ignore preceding comments when calculating what is a "dictionary maker". 689- Add a small penalty for splitting before a closing bracket. 690- Ensure that a space is enforced after we remove a pseudo-paren that's between 691 two names, keywords, numbers, etc. 692- Increase the penalty for splitting after a pseudo-paren. This could lead to 693 less readable code in some circumstances. 694 695## [0.6.0] 2015-10-18 696### Added 697- Add knob to indent the dictionary value if there is a split before it. 698 699### Changed 700- No longer check that a file is a "Python" file unless the '--recursive' flag 701 is specified. 702- No longer allow the user to specify a directory unless the '--recursive' flag 703 is specified. 704 705### Fixed 706- When determining if we should split a dictionary's value to a new line, use 707 the longest entry instead of the total dictionary's length. This allows the 708 formatter to reformat the dictionary in a more consistent manner. 709- Improve how list comprehensions are formatted. Make splitting dependent upon 710 whether the "comp_for" or "comp_if" goes over the column limit. 711- Don't over indent if expression hanging indents if we expect to dedent the 712 closing bracket. 713- Improve splitting heuristic when the first argument to a function call is 714 itself a function call with arguments. In cases like this, the remaining 715 arguments to the function call would look badly aligned, even though they are 716 technically correct (the best kind of correct!). 717- Improve splitting heuristic more so that if the first argument to a function 718 call is a data literal that will go over the column limit, then we want to 719 split before it. 720- Remove spaces around '**' operator. 721- Retain formatting of comments in the middle of an expression. 722- Don't add a newline to an empty file. 723- Over indent a function's parameter list if it's not distinguished from the 724 body of the function. 725 726## [0.5.0] 2015-10-11 727### Added 728- Add option to exclude files/directories from formatting. 729- Add a knob to control whether import names are split after the first '('. 730 731### Fixed 732- Indent the continuation of an if-then statement when it's not distinguished 733 from the body of the if-then. 734- Allow for sensible splitting of array indices where appropriate. 735- Prefer to not split before the ending bracket of an atom. This produces 736 better code in most cases. 737- Corrected how horizontal spaces were presevered in a disabled region. 738 739## [0.4.0] 2015-10-07 740### Added 741- Support for dedenting closing brackets, "facebook" style. 742 743### Fixed 744- Formatting of tokens after a multiline string didn't retain their horizontal 745 spacing. 746 747## [0.3.1] 2015-09-30 748### Fixed 749- Format closing scope bracket correctly when indentation size changes. 750 751## [0.3.0] 2015-09-20 752### Added 753- Return a 2 if the source changed, 1 on error, and 0 for no change. 754 755### Fixed 756- Make sure we format if the "lines" specified are in the middle of a 757 statement. 758 759## [0.2.9] - 2015-09-13 760### Fixed 761- Formatting of multiple files. It was halting after formatting the first file. 762 763## [0.2.8] - 2015-09-12 764### Added 765- Return a non-zero exit code if the source was changed. 766- Add bitwise operator splitting penalty and prefer to split before bitwise 767 operators. 768 769### Fixed 770- Retain vertical spacing between disabled and enabled lines. 771- Split only at start of named assign. 772- Retain comment position when formatting is disabled. 773- Honor splitting before or after logical ops. 774