Skip to content
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

Rewrite the ban-type lint in Python #15649

Merged
merged 1 commit into from Feb 26, 2017

Conversation

@zimio
Copy link
Contributor

zimio commented Feb 19, 2017

Rewrite the ban-type lint in Python.

Question: Should the old ban-type lint written in rust be deleted?


  • [x ] ./mach build -d does not report any errors
  • [x ] ./mach test-tidy does not report any errors
  • [x ] These changes fix #15591
  • [ x] There are tests for these changes

This change is Reviewable

@highfive
Copy link

highfive commented Feb 19, 2017

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @pcwalton (or someone else) soon.

@highfive
Copy link

highfive commented Feb 19, 2017

Heads up! This PR modifies the following files:

  • @wafflespeanut: python/tidy/servo_tidy_tests/test_tidy.py, python/tidy/servo_tidy/tidy.py
@nox
Copy link
Member

nox commented Feb 19, 2017

@highfive highfive assigned wafflespeanut and unassigned pcwalton Feb 19, 2017
@nox
Copy link
Member

nox commented Feb 19, 2017

Question: Should the old ban-type lint written in rust be deleted?

Yes.

@@ -13,6 +13,7 @@
from servo_tidy import tidy

base_path = 'servo_tidy_tests/' if os.path.exists('servo_tidy_tests/') else 'python/tidy/servo_tidy_tests/'
COMPILE_FAIL_PATH = '../../../tests/compiletest/plugin/compile-fail/'

This comment has been minimized.

@wafflespeanut

wafflespeanut Feb 19, 2017

Member

We should be adding new tests to this directory since we'll be removing the existing compile-fail tests.

This comment has been minimized.

@zimio

zimio Feb 19, 2017

Author Contributor

Done, btw now I get this warning:

warning: function is never used: match_ty_unwrap

Should I got ahead and delete match_ty_unwrap?

Seems like a function that could be useful in the future.

# There should be any use of banned types:
# Cell<JSVal>, Cell<JS<T>>, DOMRefCell<JS<T>>, DOMRefCell<HEAP<T>>
(r"(\s|:)?Cell<JSVal>", "Banned type Cell<JSVal> detected. Use MutJS<JSVal> instead", no_filter),
(r"(\s|:)?Cell<JS<.+>>", "Banned type Cell<JS<T>> detected. Use MutJS<JS<T>> instead", no_filter),

This comment has been minimized.

@wafflespeanut

wafflespeanut Feb 20, 2017

Member

As you may notice in the travis failure, this pattern also matches UnsafeCell<Foo>, which is not what we want. You can make sure tidy succeeds in the whole repo by running ./mach test-tidy --all.

This comment has been minimized.

@zimio

zimio Feb 22, 2017

Author Contributor

Thanks for the tip, it really helped a lot. This is done

@wafflespeanut
Copy link
Member

wafflespeanut commented Feb 23, 2017

Looks great! Can you squash the commits appropriately? (like, one for tidy changes and the other for the tests? squashing everything is also fine)

@bors-servo
Copy link
Contributor

bors-servo commented Feb 24, 2017

The latest upstream changes (presumably #15715) made this pull request unmergeable. Please resolve the merge conflicts.

Delete old rust ban lint and move tests to python tidy

Fix ban lint regex and fix test
@zimio zimio force-pushed the zimio:issue-15591-rewrite-ban-type-lint branch from 016ed71 to ebcb15d Feb 25, 2017
@wafflespeanut
Copy link
Member

wafflespeanut commented Feb 26, 2017

Thanks!

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Feb 26, 2017

📌 Commit ebcb15d has been approved by Wafflespeanut

@bors-servo
Copy link
Contributor

bors-servo commented Feb 26, 2017

Testing commit ebcb15d with merge 261df34...

bors-servo added a commit that referenced this pull request Feb 26, 2017
…flespeanut

Rewrite the ban-type lint in Python

<!-- Please describe your changes on the following line: -->
Rewrite the ban-type lint in Python.

Question: Should the old ban-type lint written in rust be deleted?

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x ] `./mach build -d` does not report any errors
- [x ] `./mach test-tidy` does not report any errors
- [x ] These changes fix #15591

<!-- Either: -->
- [ x] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15649)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 26, 2017

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev
Approved by: Wafflespeanut
Pushing 261df34 to master...

@bors-servo bors-servo merged commit ebcb15d into servo:master Feb 26, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.