Update "git cl format --python" to default to PEP-8
This matches the recent change Chromium's Python style guide.
This also changes the .style.yapf in depot_tools to be explicit
about the style used in this repo.
Bug: 846432
Change-Id: I4947a90aec1739a9a86ffc9bfc5eacc1182dc186
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1987006
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
diff --git a/git_cl.py b/git_cl.py
index fe0c00f..cf30eff 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -5262,10 +5262,6 @@
if sys.platform.startswith('win'):
yapf_tool += '.bat'
- # If we couldn't find a yapf file we'll default to the chromium style
- # specified in depot_tools.
- chromium_default_yapf_style = os.path.join(depot_tools_path,
- YAPF_CONFIG_FILENAME)
# Used for caching.
yapf_configs = {}
for f in python_diff_files:
@@ -5295,11 +5291,12 @@
yapfignore_patterns)
for f in filtered_py_files:
- yapf_config = _FindYapfConfigFile(f, yapf_configs, top_dir)
- if yapf_config is None:
- yapf_config = chromium_default_yapf_style
+ yapf_style = _FindYapfConfigFile(f, yapf_configs, top_dir)
+ # Default to pep8 if not .style.yapf is found.
+ if not yapf_style:
+ yapf_style = 'pep8'
- cmd = [yapf_tool, '--style', yapf_config, f]
+ cmd = [yapf_tool, '--style', yapf_style, f]
has_formattable_lines = False
if not opts.full: