--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CABiQX1ULXE5-UiQ5HSz0-C%3Don4BNouTecsF7cZZPtMdgKxND9w%40mail.gmail.com.
--
Does anyone have concerns about this?
Thanks for working on this!On a recent CL, I noticed the CL author was modifying an existing file and "git cl format" changed all the indentation from 2 spaces to 4, which was not how the surrounding files were formatted (the change in question was in grit/) - nor how other Python files I work with in Chromium are formatted....Also, Google internal Python style guide recommends 2-space indents (go/python-style). Although curiously the external one says 4 spaces (https://github.com/google/styleguide/blob/gh-pages/pyguide.md). :/
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAKFU2SC%3DjqaFQiH9rDJKWwNaoHNpuk5_MKhbG8cikDX4%2BnuDew%40mail.gmail.com.
On Fri, 26 Oct 2018 at 10:21 Alexei Svitkine <asvi...@chromium.org> wrote:Thanks for working on this!On a recent CL, I noticed the CL author was modifying an existing file and "git cl format" changed all the indentation from 2 spaces to 4, which was not how the surrounding files were formatted (the change in question was in grit/) - nor how other Python files I work with in Chromium are formatted....Also, Google internal Python style guide recommends 2-space indents (go/python-style). Although curiously the external one says 4 spaces (https://github.com/google/styleguide/blob/gh-pages/pyguide.md). :/Google internal style predated Python's PEP 8 declaring that the global standard is 4 spaces. We should be using 4; other Google open source projects generally do for consistency with the rest of the python world.
On Fri, 26 Oct 2018 at 10:21 Alexei Svitkine <asvi...@chromium.org> wrote:Thanks for working on this!On a recent CL, I noticed the CL author was modifying an existing file and "git cl format" changed all the indentation from 2 spaces to 4, which was not how the surrounding files were formatted (the change in question was in grit/) - nor how other Python files I work with in Chromium are formatted....Also, Google internal Python style guide recommends 2-space indents (go/python-style). Although curiously the external one says 4 spaces (https://github.com/google/styleguide/blob/gh-pages/pyguide.md). :/Google internal style predated Python's PEP 8 declaring that the global standard is 4 spaces. We should be using 4; other Google open source projects generally do for consistency with the rest of the python world.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAEV-rjecYyhBABB7Vq6%2BPtiUksxd5XckY%3D_7_CjSR8HdB9Q4SA%40mail.gmail.com.
Does anyone have concerns about this?I have some potential concerns - not saying don't do it, I just want to make sure it's done well:- Would the presubmit only enforce that changed lines were misformatted, or any line in the changed file?
- What's the policy if you want to touch a file that currently consistently uses a non-standard formatting? Should you reformat the whole file, or just the lines you touch?
- What's the workaround if a file has to be kept with non-standard formatting?
For who knows what strange files are in the codebase. For instance, policy_templates.json is actually a python file (so, that's weird) - I don't know if it its format matches the python autoformatter (or the JSON autoformatter), but I do know that reformatting it could trigger lots of unnecessary retranslations, since it contains lots of i18n text that is indented and changing the indents will retrigger the translation.
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CABiQX1Vtsw2rbry7hSS4%2BDQzLJgYDYq0ibjZRGghuO_D7agymw%40mail.gmail.com.
Ah ok, that might be it. It was last week.On Fri, Oct 26, 2018 at 11:22 AM, Aiden Benner <abe...@google.com> wrote:I took a look and I was not able to reproduce the incorrect formatting (file gets correctly formatted with 2 spaces using git cl format --python and git cl format --python --full). However git cl format changing the entire file to use 4 spaces would be consistent with the behavior before this change https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1249642.
Perhaps the CL author didn't have their depot tools up to date?On Fri, Oct 26, 2018 at 10:52 AM, Alexei Svitkine <asvi...@chromium.org> wrote:Thanks for clarifying. Here's the CL where it happened - perhaps you can check what happened there?(In the end I advised the CL author to bypass the presubmit that was complaining about the format.)On Fri, Oct 26, 2018 at 10:44 AM, Aiden Benner <abe...@google.com> wrote:The new python formatting defaults to chromium style (which uses 2 spaces) unless a .style.yapf file is specified in the parent directories. Could there possibly be a style file specified already? Note the old git cl format with the --full flag would use the yapf default (pep8) unless a style file was specified.
On Fri, Oct 26, 2018, 10:21 Alexei Svitkine <asvi...@chromium.org wrote:
Thanks for working on this!On a recent CL, I noticed the CL author was modifying an existing file and "git cl format" changed all the indentation from 2 spaces to 4, which was not how the surrounding files were formatted (the change in question was in grit/) - nor how other Python files I work with in Chromium are formatted....Also, Google internal Python style guide recommends 2-space indents (go/python-style). Although curiously the external one says 4 spaces (https://github.com/google/styleguide/blob/gh-pages/pyguide.md). :/
The new git cl format --python now defaults to chromium style instead of pep8 when no config file is in a parent directory (instead of using the yapf default which is pep8).I meant to send this thread to all but this thread bounced back because I wasn't apart of chromium-dev, but with respect to Alexei's case, it looks like the CL author likely wasn't using the latest version of depot tools that contains this change since I was unable to reproduce the incorrect formatting.
Ah ok, that might be it. It was last week.
On Fri, Oct 26, 2018 at 11:22 AM, Aiden Benner <abe...@google.com> wrote:
I took a look and I was not able to reproduce the incorrect formatting (file gets correctly formatted with 2 spaces using git cl format --python and git cl format --python --full). However git cl format changing the entire file to use 4 spaces would be consistent with the behavior before this change https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1249642.
Perhaps the CL author didn't have their depot tools up to date?
On Fri, Oct 26, 2018 at 10:52 AM, Alexei Svitkine <asvitkine@chromium.org> wrote:
Thanks for clarifying. Here's the CL where it happened - perhaps you can check what happened there?(In the end I advised the CL author to bypass the presubmit that was complaining about the format.)
On Fri, Oct 26, 2018 at 10:44 AM, Aiden Benner <abe...@google.com> wrote:
The new python formatting defaults to chromium style (which uses 2 spaces) unless a .style.yapf file is specified in the parent directories. Could there possibly be a style file specified already? Note the old git cl format with the --full flag would use the yapf default (pep8) unless a style file was specified.
On Fri, Oct 26, 2018, 10:21 Alexei Svitkine <asvi...@chromium.org wrote:
Thanks for working on this!On a recent CL, I noticed the CL author was modifying an existing file and "git cl format" changed all the indentation from 2 spaces to 4, which was not how the surrounding files were formatted (the change in question was in grit/) - nor how other Python files I work with in Chromium are formatted....Also, Google internal Python style guide recommends 2-space indents (go/python-style). Although curiously the external one says 4 spaces (https://github.com/google/styleguide/blob/gh-pages/pyguide.md). :/Could the tool's defaults be set up to match surrounding code?
On Fri, Oct 26, 2018 at 10:12 AM, 'Andrew Grieve' via Chromium-dev <chromium-dev@chromium.org> wrote:
"git cl format" recently learned how to auto-format python code (crbug/846432).You can use it today via:git cl format --python # Formats changed lines onlygit cl format --python --full # Formats entire fileI'd personally like to have this enforced by our PRESUBMIT, to cut down on format-related code review comments.Does anyone have concerns about this?As for how to enable this, one idea is:* If a project has a .style.yapf file in their root, then enable auto-formatting without --python flags and include in presubmit check.* Otherwise, don't enable it by default (but it will still work with --python flag)Not sure if there are other project-specific configs where it would make sense to add an "enabled_python_git_cl_format = True" flag?
--
--
Chromium Developers mailing list: chromium-dev@chromium.org
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/524468bf-7abe-4c94-bc43-80c994591e79%40chromium.org.
** Presubmit Warnings **
Found lines longer than 80 characters (first 5 shown).
build/android/gyp/aar.py, line 79, 82 chars \
build/android/gyp/aar.py, line 80, 85 chars \
build/android/gyp/aar.py, line 145, 83 chars \
build/android/gyp/aar.py, line 146, 82 chars \
build/android/gyp/apkbuilder.py, line 204, 86 chars
Pylint (56 files using ['--disable=cyclic-import'] on 36 cores) (2.06s) failed
************* Module finalize_apk
C: 35, 0: Line too long (84/80) (line-too-long)
************* Module assert_static_initializers
C: 33, 0: Line too long (81/80) (line-too-long)
C: 56, 0: Line too long (83/80) (line-too-long)
************* Module extract_unwind_tables_tests
C: 94, 0: Line too long (86/80) (line-too-long)
...
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/4d45311d-396c-41b2-8d2a-1195087e8914%40chromium.org.
Update!We've got mention of using "git cl format --python" on the (newly broken out) python style guide:I've enabled python format checking for //build/android, with the settings I think make sense.One big unknown is whether we should attempt to switch to PEP8's 4 space indent.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CABiQX1WbCXVDTNvrr0AbHk40StwhRnEEJrVyEaTHzRbtWazp%2Bw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CABiQX1VsGrPuSZynpHG8rUN3HExBNRDCM9WmTFZJbrh5F42iiQ%40mail.gmail.com.
On Thu, Dec 13, 2018 at 10:46 PM Andrew Grieve <agr...@chromium.org> wrote:Update!We've got mention of using "git cl format --python" on the (newly broken out) python style guide:I've enabled python format checking for //build/android, with the settings I think make sense.One big unknown is whether we should attempt to switch to PEP8's 4 space indent.Why would we consider this? We decided on PEP8 but with 2 spaces ages ago because "too much existing code", and that's even more true now than many years ago.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAMGbLiHtxp-mL-krSGgcc1QhYaOs2grGy%2Bvz22jZQ2D4w4XO3A%40mail.gmail.com.
On Thu, Dec 13, 2018 at 8:16 PM Nico Weber <tha...@chromium.org> wrote:On Thu, Dec 13, 2018 at 10:46 PM Andrew Grieve <agr...@chromium.org> wrote:Update!We've got mention of using "git cl format --python" on the (newly broken out) python style guide:I've enabled python format checking for //build/android, with the settings I think make sense.One big unknown is whether we should attempt to switch to PEP8's 4 space indent.Why would we consider this? We decided on PEP8 but with 2 spaces ages ago because "too much existing code", and that's even more true now than many years ago.That was decided before we were using auto-formatters much anywhere, I think.
It's also worth revisiting the decision once in a while, I think, just to see if the thinking has changed.
On Thu, Dec 13, 2018 at 8:16 PM Nico Weber <tha...@chromium.org> wrote:On Thu, Dec 13, 2018 at 10:46 PM Andrew Grieve <agr...@chromium.org> wrote:Update!We've got mention of using "git cl format --python" on the (newly broken out) python style guide:I've enabled python format checking for //build/android, with the settings I think make sense.One big unknown is whether we should attempt to switch to PEP8's 4 space indent.Why would we consider this? We decided on PEP8 but with 2 spaces ages ago because "too much existing code", and that's even more true now than many years ago.That was decided before we were using auto-formatters much anywhere, I think.It's also worth revisiting the decision once in a while, I think, just to see if the thinking has changed.
--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/d8939751-c627-4474-a8a2-7da46856a2e1%40chromium.org.
On Tue, Dec 18, 2018 at 10:03 AM 'Jason Clinton' via Chromium-dev <chromi...@chromium.org> wrote:On Saturday, December 15, 2018 at 3:17:08 PM UTC-7, Dirk Pranke wrote:On Thu, Dec 13, 2018 at 8:16 PM Nico Weber <tha...@chromium.org> wrote:On Thu, Dec 13, 2018 at 10:46 PM Andrew Grieve <agr...@chromium.org> wrote:Update!We've got mention of using "git cl format --python" on the (newly broken out) python style guide:I've enabled python format checking for //build/android, with the settings I think make sense.One big unknown is whether we should attempt to switch to PEP8's 4 space indent.Why would we consider this? We decided on PEP8 but with 2 spaces ages ago because "too much existing code", and that's even more true now than many years ago.That was decided before we were using auto-formatters much anywhere, I think.It's also worth revisiting the decision once in a while, I think, just to see if the thinking has changed.Over on the CrOS side, we've already adopted 4 spaces for new projects. There's no mandate for old projects to transition: projects may or may not adopt the YAPF style settings on a per directory basis. For those directories that are willing to migrate, our strategy is to do a mass reformat to 4 spaces and disable the pylintrc warnings for line length and CamelCase method names with no intention of mass-migrating the method names.This thread kind of trailed off without reaching a conclusion. I think we probably have too much code in too many projects to pick a single formatting style that'll make everyone happy and also not require a bulk-rename.I think we should adopt the policy we've used in various places, which is that consistency with the surrounding code is most important, but that failing that, we should use 4-spaces and 80 cols for new projects
On Thu, Mar 21, 2019 at 8:14 PM Dirk Pranke <dpr...@chromium.org> wrote:On Tue, Dec 18, 2018 at 10:03 AM 'Jason Clinton' via Chromium-dev <chromi...@chromium.org> wrote:On Saturday, December 15, 2018 at 3:17:08 PM UTC-7, Dirk Pranke wrote:On Thu, Dec 13, 2018 at 8:16 PM Nico Weber <tha...@chromium.org> wrote:On Thu, Dec 13, 2018 at 10:46 PM Andrew Grieve <agr...@chromium.org> wrote:Update!We've got mention of using "git cl format --python" on the (newly broken out) python style guide:I've enabled python format checking for //build/android, with the settings I think make sense.One big unknown is whether we should attempt to switch to PEP8's 4 space indent.Why would we consider this? We decided on PEP8 but with 2 spaces ages ago because "too much existing code", and that's even more true now than many years ago.That was decided before we were using auto-formatters much anywhere, I think.It's also worth revisiting the decision once in a while, I think, just to see if the thinking has changed.Over on the CrOS side, we've already adopted 4 spaces for new projects. There's no mandate for old projects to transition: projects may or may not adopt the YAPF style settings on a per directory basis. For those directories that are willing to migrate, our strategy is to do a mass reformat to 4 spaces and disable the pylintrc warnings for line length and CamelCase method names with no intention of mass-migrating the method names.This thread kind of trailed off without reaching a conclusion. I think we probably have too much code in too many projects to pick a single formatting style that'll make everyone happy and also not require a bulk-rename.I think we should adopt the policy we've used in various places, which is that consistency with the surrounding code is most important, but that failing that, we should use 4-spaces and 80 cols for new projectsThat's a major change to the current recommendation. If you want to propose that, please start a dedicated thread for that so that people see it.