Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Issue 546613003: Add a new 'format-webkitpy' command that will reformat code to the style guide. (Closed)

Created:
6 years, 3 months ago by Dirk Pranke
Modified:
6 years, 3 months ago
Reviewers:
ojan, tonyg, nduca, eseidel
CC:
blink-reviews, ghost stip (do not use), iannucci
Project:
blink
Visibility:
Public.

Description

Add a new 'format-webkitpy' command that will reformat code to the style guide. This is an experimental utility based on autopep8 and lib2to3. It is capable of reformatting to either the Blink or Chromium style guides (the difference between the two is that Blink uses 132c lines, unix_hacker naming for functions and methods, a 4-space indent, and prefers single-quoted string literals, whereas Chromium uses 80c lines, InitialCaps for functions and methods, a 2-space indent, and double-quoted literals). Note that format-webkitpy does *not* convert method names between the two conventions, since that is a potentially unsafe thing to do. It is probably possible to write a lib2to3 fixer that does do this relatively safely, but that was more work than I felt like doing for an initial go. As part of this, we add autopep8 into webkitpy third_party (lib2to3 is part of the standard lib) and update pep8, which hadn't been updated for years. This patch also adds some simple helper methods to Executive() to do parallel map calls using multiprocessing (and to mock them out properly) so that client code doesn't need to be aware of the hoop-jumping you need to do since hosts aren't picklable. This part of the code is still a little crufty. BUG= Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=181690

Patch Set 1 : ready for review #

Total comments: 6

Patch Set 2 : remove hack from test/main.py #

Unified diffs Side-by-side diffs Delta from patch set Stats (+5366 lines, -751 lines) Patch
A Tools/Scripts/format-webkitpy View 1 chunk +11 lines, -0 lines 0 comments Download
M Tools/Scripts/webkitpy/common/system/executive.py View 1 chunk +10 lines, -7 lines 0 comments Download
M Tools/Scripts/webkitpy/common/system/executive_mock.py View 1 chunk +3 lines, -0 lines 0 comments Download
M Tools/Scripts/webkitpy/common/system/systemhost.py View 2 chunks +5 lines, -5 lines 0 comments Download
M Tools/Scripts/webkitpy/common/system/systemhost_mock.py View 2 chunks +3 lines, -5 lines 0 comments Download
A + Tools/Scripts/webkitpy/formatter/__init__.py View 0 chunks +-1 lines, --1 lines 0 comments Download
A Tools/Scripts/webkitpy/formatter/__main__.py View 1 chunk +11 lines, -0 lines 0 comments Download
A Tools/Scripts/webkitpy/formatter/fix_double_quote_strings.py View 1 chunk +29 lines, -0 lines 0 comments Download
A Tools/Scripts/webkitpy/formatter/fix_single_quote_strings.py View 1 chunk +29 lines, -0 lines 0 comments Download
A Tools/Scripts/webkitpy/formatter/main.py View 1 chunk +83 lines, -0 lines 0 comments Download
A Tools/Scripts/webkitpy/formatter/main_unittest.py View 1 chunk +86 lines, -0 lines 0 comments Download
M Tools/Scripts/webkitpy/thirdparty/README.chromium View 2 chunks +13 lines, -3 lines 0 comments Download
A Tools/Scripts/webkitpy/thirdparty/autopep8.py View 1 chunk +3664 lines, -0 lines 0 comments Download
M Tools/Scripts/webkitpy/thirdparty/pep8.py View 23 chunks +1420 lines, -732 lines 0 comments Download

Messages

Total messages: 10 (5 generated)
Dirk Pranke
Hi all, I'd like to land a new tool that automatically formats Python code to ...
6 years, 3 months ago (2014-09-06 00:47:55 UTC) #2
eseidel
lgtm The infra repo is gonna want something like this. https://codereview.chromium.org/546613003/diff/60001/Tools/Scripts/webkitpy/common/system/executive.py File Tools/Scripts/webkitpy/common/system/executive.py (right): https://codereview.chromium.org/546613003/diff/60001/Tools/Scripts/webkitpy/common/system/executive.py#newcode481 ...
6 years, 3 months ago (2014-09-09 23:10:56 UTC) #6
Dirk Pranke
https://codereview.chromium.org/546613003/diff/60001/Tools/Scripts/webkitpy/common/system/executive.py File Tools/Scripts/webkitpy/common/system/executive.py (right): https://codereview.chromium.org/546613003/diff/60001/Tools/Scripts/webkitpy/common/system/executive.py#newcode481 Tools/Scripts/webkitpy/common/system/executive.py:481: return pool.map(thunk, arglist) On 2014/09/09 23:10:55, eseidel wrote: > ...
6 years, 3 months ago (2014-09-09 23:32:22 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dpranke@chromium.org/546613003/80001
6 years, 3 months ago (2014-09-09 23:41:21 UTC) #9
commit-bot: I haz the power
6 years, 3 months ago (2014-09-10 00:45:30 UTC) #10
Message was sent while issue was closed.
Committed patchset #2 (id:80001) as 181690

Powered by Google App Engine
This is Rietveld 408576698