blacken-tree now blackens all of Leo's core without apparent problems

29 views
Skip to first unread message

Edward K. Ream

unread,
Sep 12, 2019, 7:12:42 PM9/12/19
to leo-editor
devel is now up to date with the beauty branch.  Today's work accomplishes the following:

1. Fixed several bugs in the essential SyntaxSanitizer class.

2. Created the "@test SyntaxSanitizer" unit test in unitTest.leo.  This is a strong test, and tests the SyntaxSanitizer class and the beautify and blacken commands.

3. Protected four methods, including g.angleBrackets(!), from being blackened.  Formerly, these methods relied on "<<" and ">>" being on different lines, so as to avoid a spurious section reference.  But black can put them back on the same line.  Now, lt and rt are defined (on separate lines) as "<<" and ">>". It's fine to put lt and rt on the same line.

4. With all these fixes, running blacken-tree on the "Core classes" node in leoPy.leo succeeds without serious problems.  Saving the outline then updates all the files.  All unit tests still pass.

Summary

The blacken commands now passes substantial tests. There are no known bugs. Imo, these commands are ready for serious testing.

However, I do not plan to blacken Leo's sources at this time.  I don't believe it would be particularly useful to do so, and I don't want to spend the required time looking at diffs.

I shall now turn my attention to the "orange is the new black" project.  Imo, improving Leo's beautify commands will be more useful for most Leonistas.  There surely will be more options to choose from :-)

Edward

Matt Wilkie

unread,
Sep 13, 2019, 1:27:44 AM9/13/19
to leo-editor
To make sure I catch the drift as I haven't been following closely: the Beautify commands will create the same results as Black (excepting overindented comments), but is using it's own code to get there? and is markedly faster? So it's really ....Black Beauty?

In that case, once the dust settles, maybe just use black for testing/validating beauty results and relegate it to unit tests. (No need for two sets of command for the same end.)

-matt

Edward K. Ream

unread,
Sep 13, 2019, 1:48:39 AM9/13/19
to leo-editor
On Fri, Sep 13, 2019 at 12:27 AM Matt Wilkie <map...@gmail.com> wrote:

To make sure I catch the drift as I haven't been following closely: the Beautify commands will create the same results as Black (excepting overindented comments), but is using it's own code to get there?

Correct
and is markedly faster?

Yes, at present.
So it's really ....Black Beauty?

I'm using "orange is the new black" for now, but I'll likely retain the legacy "beautify*" names.
In that case, once the dust settles, maybe just use black for testing/validating beauty results and relegate it to unit tests. (No need for two sets of command for the same end.)

Some people may want the "real" black.  I think the "black*" commands should remain.

Edward
Reply all
Reply to author
Forward
0 new messages