-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FR: Establish a default python formatter / linter and enforce it via CI #171
Comments
I will note that in the past I have been very skeptical about making this work across multiple repos. The problem is that each repo needs to be using exactly the same version of exactly the same formatter. Otherwise, if there are any auto-formatting differences, two way sync becomes ~impossible because a changeset that can land in one place will fail CI in the other and vice versa. One could try to get around this by just running the relevant formatter on all inbound changes, effectively allowing each repo to enforce its own formatting preferences, but this has significant costs, not just in that it requires changes to all the sync bots, but also that line-based diffs between the repos no longer represent real changes. So in theory one would have to pick a specific revision of a specific formatter for wpt, and provide the tooling to run it. But the deverloper experience of that formatter being different from the vendor repo would be terrible; afaik most auto-formatting setups don't easily support using a totally different tool depending on the directory, whereas they generally do allow excluding directories from auto formatting. |
My initial comment was more about having a common formatter between folks contributing to bidi tests, as we are bound to edit and format the same files regularly. I also think that enforcing something at the repo level would be very challenging. Edit: And since autoformatting was mentioned, I would note, that I'm completely ok with running a manual formatter for wdspec changes on the side, if that avoids pollution in diffs. But I might be in the minority here. |
cc @whimboo |
Note that we have already linting setup for files like |
Let's try to expand it? So far I noticed that formatting discussions take a significant portion of the review. At least, it would be great if there was a shared linter configuration that one could run locally and be certain that most of the formatting quirks align with conventions |
The linter should be safe enough, I think, because it's generally possible to find some code format that satisfies multiple versions of a linter, unlike autoformatters which generally define a single correct representation of the given code. |
Where did you see this? I grep'ed for it in the wpt/ repo but could not find it. |
Try to push wrongly formatted code via a PR and you will see that the unit tests are failing. That is only happening for the webdriver client code but not the webdriver tests. I'm not exactly sure where the definitions actually are. @jgraham will know more here. |
See also #129, which is about prettier (for HTML/CSS/JS/etc). The current PR just adds a bunch of extra lints; I don't think we have any precedent for whether lints require an RFC? |
Indeed, linting is just a drive-by change, and I linked back to this just for completeness. For the core of this PR we first need to agree upon a formatter...should we create a poll to decide which one, maybe? |
Unless we have a way to address the concerns in #171 (comment) we can't adopt a formatter. |
With We could perhaps test multiple versions of |
https://phabricator.services.mozilla.com/D186092 is gecko updating black a few months ago. It reformatted 290 files. I think that's sufficient to prove that we'd need a system that required every user to have the precise same version of the code formatter. |
OK, thanks for the |
We can pin the dependencies; the issue is that all repositories that embed wpt (e.g. Chrome, Firefox, Servo) would need to pin to the same version and updates would need to be coordinated across all of them |
It would be a lot of work, but a path forward could be managing dependencies in WPT and downstream repos in a way that downstreams "simply" use the I think Chromium is pretty far from this being easy, however. |
Address flake8 findings in webdriver/ Rename duplicate test to test_params_pointer_action_move_coordinate_missing Bug: web-platform-tests/rfcs#171 Cmdline: flake8 --append-config=tools/flake8.ini webdriver/tests/bidi :
Rename duplicate test to test_params_pointer_action_move_coordinate_missing Bug: web-platform-tests/rfcs#171 Cmdline: flake8 --append-config=tools/flake8.ini webdriver/tests/bidi :
Carrying over @gsnedders's comment (web-platform-tests/wpt#43096 (comment)): How about linters? How could we enforce e.g. |
Rename duplicate test to test_params_pointer_action_move_coordinate_missing Bug: web-platform-tests/rfcs#171 Cmdline: flake8 --append-config=tools/flake8.ini webdriver/tests/bidi
…ver/, a=testonly Automatic update from web-platform-tests infra: address flake8 findings in webdriver/ Rename duplicate test to test_params_pointer_action_move_coordinate_missing Bug: web-platform-tests/rfcs#171 Cmdline: flake8 --append-config=tools/flake8.ini webdriver/tests/bidi -- wpt-commits: 605a1999160c97f971fce384dac5cddd4ca0b2d1 wpt-pr: 43096
…ver/, a=testonly Automatic update from web-platform-tests infra: address flake8 findings in webdriver/ Rename duplicate test to test_params_pointer_action_move_coordinate_missing Bug: web-platform-tests/rfcs#171 Cmdline: flake8 --append-config=tools/flake8.ini webdriver/tests/bidi -- wpt-commits: 605a1999160c97f971fce384dac5cddd4ca0b2d1 wpt-pr: 43096
…ver/, a=testonly Automatic update from web-platform-tests infra: address flake8 findings in webdriver/ Rename duplicate test to test_params_pointer_action_move_coordinate_missing Bug: web-platform-tests/rfcs#171 Cmdline: flake8 --append-config=tools/flake8.ini webdriver/tests/bidi -- wpt-commits: 605a1999160c97f971fce384dac5cddd4ca0b2d1 wpt-pr: 43096
…ver/, a=testonly Automatic update from web-platform-tests infra: address flake8 findings in webdriver/ Rename duplicate test to test_params_pointer_action_move_coordinate_missing Bug: web-platform-tests/rfcs#171 Cmdline: flake8 --append-config=tools/flake8.ini webdriver/tests/bidi -- wpt-commits: 605a1999160c97f971fce384dac5cddd4ca0b2d1 wpt-pr: 43096
…ver/, a=testonly Automatic update from web-platform-tests infra: address flake8 findings in webdriver/ Rename duplicate test to test_params_pointer_action_move_coordinate_missing Bug: web-platform-tests/rfcs#171 Cmdline: flake8 --append-config=tools/flake8.ini webdriver/tests/bidi -- wpt-commits: 605a1999160c97f971fce384dac5cddd4ca0b2d1 wpt-pr: 43096 UltraBlame original commit: 98ddfdc5d64d44b5c70b46671958a3cd76fa988a
…ver/, a=testonly Automatic update from web-platform-tests infra: address flake8 findings in webdriver/ Rename duplicate test to test_params_pointer_action_move_coordinate_missing Bug: web-platform-tests/rfcs#171 Cmdline: flake8 --append-config=tools/flake8.ini webdriver/tests/bidi -- wpt-commits: 605a1999160c97f971fce384dac5cddd4ca0b2d1 wpt-pr: 43096 UltraBlame original commit: 98ddfdc5d64d44b5c70b46671958a3cd76fa988a
…ver/, a=testonly Automatic update from web-platform-tests infra: address flake8 findings in webdriver/ Rename duplicate test to test_params_pointer_action_move_coordinate_missing Bug: web-platform-tests/rfcs#171 Cmdline: flake8 --append-config=tools/flake8.ini webdriver/tests/bidi -- wpt-commits: 605a1999160c97f971fce384dac5cddd4ca0b2d1 wpt-pr: 43096 UltraBlame original commit: 98ddfdc5d64d44b5c70b46671958a3cd76fa988a
Note: Originally copied / imported from web-platform-tests/wpt#42710. We'll keep the other bug open to track the implementation side of this FR.So long as we do not agree on a default formatter for this repository, back-end-forth diff noise and bikeshedding keeps coming up (e.g.).
It would be the best to everyone, and for improved devex, to agree to use one and only one formatter.
Additionally, to ensure it sticks, we should add some CI job to enforce that no violations are introduced.
The status quo (at least within the realm of WebDriver BiDi) seems to be the following:
yapf v0.31.0
.black
.The following AIs should happen:
yapf
,black
, or something else?Resources:
cc @juliandescottes @past
The text was updated successfully, but these errors were encountered: