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

Issue 731923003: gn format: Make defines, deps, and sources lists always multline (Closed)

Created:
6 years, 1 month ago by scottmg
Modified:
6 years ago
Reviewers:
Dirk Pranke, brettw
CC:
chromium-reviews, tfarina
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

gn format: Make defines, deps, and sources lists always multline Results of formatting all of src are here: https://codereview.chromium.org/704363002/ ps#3 is before this patch, ps#4 is with this patch. Usage is pretty inconsistent, we frequently have all of 1. deps = [ "x" ] 2. deps = [ "x" ] 3. deps = [ "x", ] I categorize 2 as "wrong". I could use "keep input style" to decide which of 1 & 3 to output (2 would change to 3), but on the other hand, I can't really discern any reason in most cases for why either 1 or 3 was chosen, so it seems like the sort of thing a formatter should really take an opinion on. Anyone have strong ones? R=brettw@chromium.org, brettw@chromium.org BUG=348474

Patch Set 1 #

Total comments: 2

Patch Set 2 : change distingished names, not on -=d:/src/depot_tools/git-1.9.0.chromium.6_bin/+=, no default arg #

Patch Set 3 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+245 lines, -61 lines) Patch
M tools/gn/command_format.cc View 1 17 chunks +62 lines, -35 lines 0 comments Download
M tools/gn/command_format_unittest.cc View 1 chunk +1 line, -0 lines 0 comments Download
M tools/gn/format_test_data/003.golden View 1 chunk +3 lines, -1 line 0 comments Download
M tools/gn/format_test_data/004.golden View 1 chunk +3 lines, -1 line 0 comments Download
M tools/gn/format_test_data/007.golden View 1 chunk +3 lines, -1 line 0 comments Download
M tools/gn/format_test_data/008.golden View 1 chunk +3 lines, -1 line 0 comments Download
M tools/gn/format_test_data/009.golden View 1 chunk +6 lines, -2 lines 0 comments Download
M tools/gn/format_test_data/010.golden View 1 chunk +6 lines, -2 lines 0 comments Download
M tools/gn/format_test_data/011.golden View 1 chunk +9 lines, -3 lines 0 comments Download
M tools/gn/format_test_data/012.golden View 1 chunk +9 lines, -3 lines 0 comments Download
M tools/gn/format_test_data/015.golden View 1 chunk +3 lines, -1 line 0 comments Download
M tools/gn/format_test_data/042.gn View 1 1 chunk +36 lines, -11 lines 0 comments Download
A tools/gn/format_test_data/042.golden View 1 1 chunk +101 lines, -0 lines 0 comments Download

Messages

Total messages: 11 (1 generated)
scottmg
6 years, 1 month ago (2014-11-18 19:51:28 UTC) #2
brettw
I think "deps = ..." should always be multiline, but that it should be okay ...
6 years, 1 month ago (2014-11-18 20:51:09 UTC) #3
scottmg
On 2014/11/18 20:51:09, brettw wrote: > I think "deps = ..." should always be multiline, ...
6 years, 1 month ago (2014-11-18 20:53:01 UTC) #4
brettw
I'd say remove defines (those are like flags and are rarely used anyway). And then ...
6 years, 1 month ago (2014-11-18 20:58:00 UTC) #5
brettw
https://codereview.chromium.org/731923003/diff/1/tools/gn/command_format.cc File tools/gn/command_format.cc (right): https://codereview.chromium.org/731923003/diff/1/tools/gn/command_format.cc#newcode138 tools/gn/command_format.cc:138: bool prefer_multiline = false); Google style says you are ...
6 years, 1 month ago (2014-11-18 20:58:05 UTC) #6
Dirk Pranke
Personally, I'd probably make all of the single-value lists be a single line, but I ...
6 years, 1 month ago (2014-11-18 23:19:10 UTC) #7
scottmg
On 2014/11/18 20:58:00, brettw wrote: > I'd say remove defines (those are like flags and ...
6 years, 1 month ago (2014-11-19 21:56:25 UTC) #8
scottmg
https://codereview.chromium.org/731923003/diff/1/tools/gn/command_format.cc File tools/gn/command_format.cc (right): https://codereview.chromium.org/731923003/diff/1/tools/gn/command_format.cc#newcode138 tools/gn/command_format.cc:138: bool prefer_multiline = false); On 2014/11/18 20:58:05, brettw wrote: ...
6 years, 1 month ago (2014-11-19 21:56:33 UTC) #9
scottmg
On 2014/11/19 21:56:33, scottmg wrote: > https://codereview.chromium.org/731923003/diff/1/tools/gn/command_format.cc > File tools/gn/command_format.cc (right): > > https://codereview.chromium.org/731923003/diff/1/tools/gn/command_format.cc#newcode138 > ...
6 years ago (2014-11-24 22:40:47 UTC) #10
tfarina
6 years ago (2014-11-25 01:49:32 UTC) #11
Message was sent while issue was closed.
Option 3 please.

deps = [
  "x",
]

It might be a bit verbose, but when some comes later to add a new entry to the
list it will be a single line change, rather than a 3 line one. (For me it is a
productivity boost, but that might be just me).

+1 for always multiline!

Powered by Google App Engine
This is Rietveld 408576698