Format config sections as config, not as node tables - #242
Open
webdevred wants to merge 2 commits into
Open
Conversation
The formatter treated driveModes, mirrors, soundscape and the powertrain objects like node tables: it exploded compact structures across many lines and rewrote the numbers the authors wrote, turning [0.60, 0.00] into [0.6, 0]. Over the 4943 stock jbeam files these rules leave 523 files closer to how they were written, by 15380 lines, with the drivemodes files gaining 200 to 325 lines each. The rules come from PR #179, which sat five months behind master. AST fixtures regenerated with jbeam-edit-dump-ast; no example file changes, since none of them has these sections.
Seven config containers were written twice, once with ComplexNewLine: Force and again as .X.* with None, purely to stop the first rule reaching their children. The > operator says that directly, so the undo rules are gone. PreserveNumberFormat stays in a plain rule because it has to keep reaching down into those children. Measured over the 186 stock files that carry these sections: 184 format identically and two improve. Both are gearbox objects holding an array with line comments in it, where forcing the array inline used to rewrite the comments into block comments and leave the row looking broken.
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The shipped rulesets knew about
nodes,beamsand a handful of table-like sections, and treated everything else the same way. That is wrong for the config objects:driveModes,mirrors,soundscapeand the powertrain containers came out with their compact rows exploded across many lines, and with the numbers their authors wrote rewritten, so[0.60, 0.00]became[0.6, 0].Formatting every jbeam in the stock vehicle zips, extracted with
tools/extract-and-format-jbeam/corpus-extract.sh, these rules leave 523 files closer to how they were written, by 15380 lines. The drivemodes files gain 200 to 325 lines each.The seven config containers use the
>operator. Each was written twice before, once withComplexNewLine: Forceand again as.X.*withNone, purely to stop the first rule reaching its children.PreserveNumberFormatstays in a plain rule next to it, because it has to keep reaching down. Over the 186 stock files carrying these sections, 184 format identically to the old pair of rules and two improve: both are gearbox objects holding an array with line comments in it, where forcing the array inline used to rewrite the comments into block comments.Supersedes #179, which carried the same rules against a master 57 commits older and without the operator.