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