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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/formatter/main.py

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import argparse 5 import argparse
6 import lib2to3.refactor 6 import lib2to3.refactor
7 7
8 from webkitpy.common.system.systemhost import SystemHost 8 from webkitpy.common.system.systemhost import SystemHost
9 from webkitpy.thirdparty import autopep8 9 from webkitpy.thirdparty import autopep8
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 arglist = [(host, name, autopep8_options, fixers, options.backup) for name i n options.files] 50 arglist = [(host, name, autopep8_options, fixers, options.backup) for name i n options.files]
51 host = host or SystemHost() 51 host = host or SystemHost()
52 52
53 host.executive.map(_reformat_thunk, arglist, processes=options.jobs) 53 host.executive.map(_reformat_thunk, arglist, processes=options.jobs)
54 54
55 55
56 def _autopep8_options_for_style(style): 56 def _autopep8_options_for_style(style):
57 return { 57 return {
58 None: [], 58 None: [],
59 'blink': autopep8.parse_args(['--aggressive', 59 'blink': autopep8.parse_args([
60 '--max-line-length', '132', 60 '--aggressive',
61 '--indent-size', '4', 61 '--max-line-length', '132',
62 '']), 62 '--ignore=E309',
63 'chromium': autopep8.parse_args(['--aggressive', 63 '--indent-size', '4',
64 '--max-line-length', '80', 64 '',
65 '--indent-size', '2', 65 ]),
66 '']), 66 'chromium': autopep8.parse_args([
67 '--aggressive',
68 '--max-line-length', '80',
69 '--ignore=E309',
70 '--indent-size', '2',
71 '',
72 ]),
67 }.get(style) 73 }.get(style)
68 74
69 75
70 def _fixers_for_quoting(quoting): 76 def _fixers_for_quoting(quoting):
71 return { 77 return {
72 None: [], 78 None: [],
73 'double': ['webkitpy.formatter.fix_double_quote_strings'], 79 'double': ['webkitpy.formatter.fix_double_quote_strings'],
74 'single': ['webkitpy.formatter.fix_single_quote_strings'], 80 'single': ['webkitpy.formatter.fix_single_quote_strings'],
75 }.get(quoting) 81 }.get(quoting)
76 82
(...skipping 17 matching lines...) Expand all
94 100
95 if autopep8_options: 101 if autopep8_options:
96 tmp_str = autopep8.fix_code(tmp_str, autopep8_options) 102 tmp_str = autopep8.fix_code(tmp_str, autopep8_options)
97 103
98 if fixers: 104 if fixers:
99 tool = lib2to3.refactor.RefactoringTool(fixer_names=fixers, 105 tool = lib2to3.refactor.RefactoringTool(fixer_names=fixers,
100 explicit=fixers) 106 explicit=fixers)
101 tmp_str = unicode(tool.refactor_string(tmp_str, name=name)) 107 tmp_str = unicode(tool.refactor_string(tmp_str, name=name))
102 108
103 return tmp_str 109 return tmp_str
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698