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

Side by Side Diff: Tools/Scripts/webkitpy/formatter/fix_double_quote_strings.py

Issue 546613003: Add a new 'format-webkitpy' command that will reformat code to the style guide. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove hack from test/main.py Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 """
6 A 2to3 fixer that converts all string literals to use double quotes.
7
8 Strings that contain double quotes will not be modified. Prefixed string
9 literals will also not be modified. This affects both single-quoted strings
10 and triple-single-quoted strings.
11
12 """
13
14 from lib2to3.fixer_base import BaseFix
15 from lib2to3.pgen2 import token
16
17
18 class FixDoubleQuoteStrings(BaseFix):
19
20 explicit = True
21 _accept_type = token.STRING
22
23 def match(self, node):
24 res = node.value.startswith("'") and '"' not in node.value[1:-1]
25 return res
26
27 def transform(self, node, results):
28 node.value = node.value.replace("'", '"')
29 node.changed()
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/formatter/__main__.py ('k') | Tools/Scripts/webkitpy/formatter/fix_single_quote_strings.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698