Commit graph

78 commits

Author SHA1 Message Date
Martin Robinson
81433a8684
Convert tidy to a non-egg Python package
It seems that servo-tidy is only used by webrender in my GitHub
searches. WebRender could simply use `rustfmt` and the tidy on pypi
hasn't been updated since 2018. Converting tidy to a normal Python
package removes the maintenance burden of continually fixing the easy
install configuration.

Fixes #29094.
Fixes #29334.
2023-06-15 13:10:06 +02:00
Martin Robinson
ec9cbeefd8 Merge forbidden panic check into test-tidy
This cleans up the GitHub actions yaml a bit and ensures that developers
are running this check locally before submitting changes. In addition,
it allows adding tests for this check. Finally, this change fixes the
tidy tests by upgrading voluptuous for Python 3.10 as well as by
reverting an inadvertent change for NixOS compatibility on one of the
dummy testing files.
2023-03-22 15:37:56 +01:00
Josh Matthews
4fec987221 Fix output of test-tidy with duplicated packages. 2020-05-20 14:19:47 -04:00
Simon Sapin
4227425c1e Remove the lint added in https://github.com/servo/servo/pull/14589
Per https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a8a5a716b3bdf52fa7960a1e4ee89add
it looks like the drop order of temporaries was changed at some point and this pattern is no longer problematic.
2020-04-08 15:59:17 +02:00
lberrymage
cd9195056c Add lint check for &DomRoot<T>
`&DomRoot<T> is strictly less expressive than `&T`, so using it is
pointless.
2019-12-21 12:44:35 -09:00
marmeladema
4fc5154dd1 Make mach test-tidy --self-test compatible with Python3 2019-12-14 12:42:47 +00:00
Siddhartha Mishra
aa7ba1a850 report when blocked package exception is not needed 2019-09-22 14:16:46 +05:30
Simon Sapin
753633d3be Remove regex-based checks in servo-tidy that are covered by rustfmt 2019-06-22 14:59:09 +02:00
Pyfisch
1855c88d61 Fix test-tidy self test
Install rustup on first Travis job.
Only use rustfmt::skip as an outer attribute.
2018-11-07 09:37:55 +01:00
Timur Borkhodoev
c351b526f6 Add test that actually tests the test 2018-02-02 15:34:08 -05:00
Timur Borkhodoev
06e439ef40 Add correct file test for manifest test 2018-02-02 14:48:43 -05:00
Timur Borkhodoev
bcb4bd2f30 Add self-test and modify tidy to accomodate the test 2018-02-01 15:57:11 -05:00
Aneesh Agrawal
d0abd1cdfa Update buildbot_steps lint to handle env variables
https://github.com/servo/saltfs/pull/687 added support
for specifying environment variables in `buildbot_steps.yml`.
Update the servo-tidy buildbot_steps.yml linter to reflect this.

Use the voluptuous Python library (BSD 3-clause license) for validation
in lieu of a much larger hand-written implementation.
Update the tidy self tests to take into account the new error messages.
2018-01-08 00:31:34 -08:00
Maxim Novikov
e6d9fd8a4f Report an errror if a package has duplicates allowed but there are no duplicates
Resolves: #19306
2017-11-21 21:08:14 +01:00
Anthony Ramine
577370746e Rename DOMRefCell<T> to DomRefCell<T>
I don't want to do such a gratuitous rename, but with all the other types
now having "Dom" as part of their name, and especially with "DomOnceCell",
I feel like the other cell type that we already have should also follow
the convention. That argument loses weight though when we realise there
is still DOMString and other things.
2017-09-26 09:49:08 +02:00
Anthony Ramine
d29335040d Rename MutJS<T> to MutDom<T> 2017-09-26 09:49:00 +02:00
Anthony Ramine
7be32fb237 Rename JS<T> to Dom<T> 2017-09-26 09:48:55 +02:00
Anthony Ramine
dafcd821f5 Fix some messages in the tidy script
It's MutJS<T>, not MutJS<JS<T>>.
2017-09-26 02:18:07 +02:00
Michael Droettboom
c9dafda03a Make tidy aware of Rust multiline strings
As a result of tighter and more correct handling of character
literals, this now catches a few kinds of syntax involving lifetimes
that were previously missed, so those have been updated.
2017-09-21 17:17:47 -04:00
Clément DAVID
ab73f3d61d Automatically verify that derive() lists are alphabetically ordered 2017-08-23 21:04:14 +02:00
Pavel Sergeev
c225847a81 tidy: add extra space after keyword check 2017-07-20 00:44:59 +03:00
Alan Jeffrey
1270080538 Count number of braces on a line in . 2017-06-07 14:25:07 -05:00
coalman
57e74542ee Make tidy check that opening and closing braces that begin a line do so with proper alignment. 2017-04-18 14:56:03 -04:00
lucantrop
b1faaa15dc added tidy check for -> () 2017-03-13 17:38:32 +01:00
Jefry Lagrange
ebcb15d6f2 Rewrite the ban-type lint in Python
Delete old rust ban lint and move tests to python tidy

Fix ban lint regex and fix test
2017-02-25 15:56:06 +01:00
vwvww
ccb14abd12 Add 'use statements with extraneous spaces' tidy check
Add 'use statements with extraneous spaces' tidy check

I added simple check routine for 'use statements with extraneous
spaces' and codes that breaks the check routine in rust_tidy.rs.

* Added a code that using 'use statements with extraneous spaces' code
  in rust_tidy.rs
* Added assertion code in test_tidy.py.
* check_rust function in tidy.py now recognizes the simple case in
  the 'use statements with extraneous spaces'.
* Ran tidy check on rust code and modified a
  code(tests/unit/style/parsing/inherited_text.rs) that is not passing
  on this new tidy check.

TODO: this code has to be refactored to support more general cases.

- [X] ./mach test-tidy does not report any errors
- [X] These changes fix #14898 (github issue number if applicable).
2017-02-23 01:29:46 +09:00
UK992
8a1aa354d6 Tidy: Report invalid listed ignored directories and files 2017-01-18 21:51:56 +01:00
Jure Podgoršek
adcedd8314 Rust tidy: disallow assignment = in the beginning of line 2017-01-06 20:56:59 +01:00
UK992
b760578f0f Tidy: Check Cargo.lock for packages with same version and different sources 2016-12-26 16:49:08 +01:00
Josh Matthews
14d8ae2478 Add a tidy check for problematic match cases in script_thread.rs 2016-12-16 11:52:45 -05:00
bors-servo
21ad1c2109 Auto merge of #14051 - birryree:tidy-check-buildbot-steps, r=aneeshusa
Adding linting checks for buildbot_steps.yml

This pull request adds some tidy checks around YAML files, and specifically `buildbot_steps.yml`.

Tidy checks added:

* YAML files are checked for well-formedness/parse-ability
* Whether a YAML file has duplicate keys
* Whether a `buildbot_steps.yml` file contains only mappings to list-of-strings.

---
<!-- 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 #13838 (github issue number if applicable).

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

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

…ing checking for correct mappings and duplicate YAML keys. Added unit tests to test_tidy.py.

<!-- 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/14051)
<!-- Reviewable:end -->
2016-12-08 17:39:44 -08:00
William Lee
aceb60ec1d Add tidy linting checks for buildbot_steps.yml
This commit adds tidy checks for buildbot_steps.yml, as well as unit
tests. These checks include:

* Checking buildbot_steps.yml can be parsed by a YAML loader
* buildbot_steps.yml does not contain duplicate keys
* buildbot_steps.yml keys map to a list of strings
2016-12-08 20:36:13 -05:00
Ravi Shankar
34955e0bf8 Add tests for the new LintRunner 2016-11-11 19:54:34 +05:30
Ravi Shankar
f214765b61 Move file list iterator to a new module 2016-11-10 18:56:51 +05:30
Yuki Izumi
d47aca18c4
Check for JSON key non-duplication and order 2016-11-07 19:02:22 +11:00
bors-servo
291f393723 Auto merge of #13986 - iamrohit7:tidy-feature-attrs, r=Wafflespeanut
Make test-tidy check for alphabetical ordering of #![feature(...)] statements

<!-- Please describe your changes on the following line: -->

<!-- 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 #13954  (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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/13986)

<!-- Reviewable:end -->
2016-11-01 01:13:35 -05:00
Rohit Burra
c4cb3f345b Tests alphabetical ordering of #![feature(...)] 2016-11-01 11:35:39 +05:30
Daan Sprenkels
179e11ad8d test-tidy: Check for space between function name and (
Disallow an extraneous space in a function call between
the function name and the opening parenthesis in Rust
code, while ignoring macro declarations.

This commit fixes #13980.
2016-10-31 18:11:35 +01:00
bors-servo
3a5fd8b49a Auto merge of #13447 - gterzian:check_webidls_folder_files, r=Wafflespeanut
Have tidy ensure that the there are no extra files in the webidls folder #13427

<!-- Please describe your changes on the following line: -->
 Have tidy ensure that the there are no extra files in the webidls folder #13427

---
<!-- 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 #13427 (github issue number if applicable).

<!-- 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/13447)
<!-- Reviewable:end -->
2016-10-02 12:00:36 -05:00
Gregory
1f99381720 tidy: checking directories for unexpected file extensions
update config, check_dir func to use config

pass only_changed_files and exclude_dirs as args

simplify config

better conditional

remove unused default, amend error message

undo doc change
2016-10-02 14:40:28 +08:00
Matt Schmoyer
4846be1fdb using word license in test name for consistency 2016-10-01 12:25:57 -04:00
Hugo Thiessard
0ac212afb1 Issue #13350 Report tidy error for space after ( 2016-09-23 14:01:58 +02:00
UK992
875981ece5 Fix ordering use statements with braces 2016-09-09 04:42:30 +02:00
UK992
d5b76c9f6d Tidy: Handle empty files 2016-08-29 18:33:03 +02:00
UK992
0f07517049 Check for license only in Cargo.toml 2016-08-25 06:50:23 +02:00
Ravi Shankar
33d7b3967e Some cleanups in tidy 2016-08-23 00:53:09 +05:30
UK992
74dba5cbdd Check for errors in tidy config file 2016-08-20 22:51:46 +02:00
UK992
9a3b61abe1 Check for blank line after shebang and grab actual comment block instead of hard-coded one 2016-08-12 13:34:38 +02:00
edunham
48ace17b54 Improve tidy's license validation logic
fixes https://github.com/servo/servo/issues/10716

I took the lazy way out and hardcoded the size of block we examine for
licenses.

fixes https://github.com/servo/servo/issues/10719

Includes tests for new functionality.
2016-08-12 13:32:09 +02:00
Aneesh Agrawal
f07d8f188a Add lint for [ instead of [[ in shells scripts 2016-08-05 09:42:04 -04:00