Commit graph

51 commits

Author SHA1 Message Date
erneyja
17663315dd make test-tidy check that = have space after them 2015-09-01 07:18:19 -04:00
Ravi Shankar
6ef5c8eec2 tidy will now show its expectation of uses 2015-08-28 13:14:45 +05:30
wilmoz
63851f2650 Forbid multiline imports 2015-08-25 12:27:42 -05:00
Corey Farwell
662b64ffe4 Make tidy search for files recursively again
In #7348 `os.walk` was replaced with `os.listdir`. The latter is not
recursive, which results in only the root directory files getting linted

The changes to `ignored_files` are needed because calling `os.walk(".")`
results in `./` getting prefixed before each path
2015-08-24 20:34:01 -04:00
João Oliveira
69ddedc568 update tidy.py remove collect_file_names:
call python os functions inline
2015-08-25 00:05:37 +01:00
bors-servo
b1f0357fce Auto merge of #7118 - g-k:tidy-check-unused-html-files, r=jdm
Add tidy check for unused reftest html files

Refs: https://github.com/servo/servo/issues/7078

Sample output:

```
$ time ./mach test-tidy
tests/ref/background_image_a.html not used or commented out in basic.list
tests/ref/background_image_ref.html not used or commented out in basic.list
tests/ref/canvas_linear_gradient_a.html not used or commented out in basic.list
tests/ref/canvas_linear_gradient_ref.html not used or commented out in basic.list
tests/ref/canvas_radial_gradient_a.html not used or commented out in basic.list
tests/ref/canvas_radial_gradient_ref.html not used or commented out in basic.list
tests/ref/inline_border_a.html not used or commented out in basic.list
tests/ref/inline_border_b.html not used or commented out in basic.list
tests/ref/inline_text_align_a.html not used or commented out in basic.list
tests/ref/inline_text_align_b.html not used or commented out in basic.list
tests/ref/link_style_dynamic_addition.html not used or commented out in basic.list
tests/ref/link_style_dynamic_addition_ref.html not used or commented out in basic.list
tests/ref/overflow_position_abs_inside_normal_a.html not used or commented out in basic.list
tests/ref/overflow_position_abs_inside_normal_b.html not used or commented out in basic.list
tests/ref/overflow_position_abs_simple_a.html not used or commented out in basic.list
tests/ref/overflow_position_abs_simple_b.html not used or commented out in basic.list
tests/ref/position_fixed_a.html not used or commented out in basic.list
tests/ref/position_fixed_b.html not used or commented out in basic.list
tests/ref/position_fixed_simple_a.html not used or commented out in basic.list
tests/ref/position_fixed_simple_b.html not used or commented out in basic.list
tests/ref/position_fixed_static_y_a.html not used or commented out in basic.list
tests/ref/position_fixed_static_y_b.html not used or commented out in basic.list
tests/ref/style_is_in_doc.html not used or commented out in basic.list
tests/ref/style_is_in_doc_ref.html not used or commented out in basic.list
tests/ref/table_specified_width_a.html not used or commented out in basic.list
tests/ref/table_specified_width_ref.html not used or commented out in basic.list
tests/ref/text_decoration_propagation_a.html not used or commented out in basic.list
tests/ref/text_decoration_propagation_b.html not used or commented out in basic.list
tests/ref/text_shadow_multiple_shadows_a.html not used or commented out in basic.list
tests/ref/text_shadow_multiple_shadows_ref.html not used or commented out in basic.list
tests/ref/viewport_percentage_vmin_vmax_b.html not used or commented out in basic.list
tests/ref/viewport_percentage_vw_vh_b.html not used or commented out in basic.list
tests/ref/white_space_intrinsic_sizes_a.html not used or commented out in basic.list
tests/ref/white_space_intrinsic_sizes_ref.html not used or commented out in basic.list
tests/ref/fonts/takao-p-gothic/COPYING.html not used or commented out in basic.list
tests/ref/iframe/multiple_external_child.html not used or commented out in basic.list
...
```

I thought it might be helpful to say which files aren't used in `basic.list`.

`./mach test-tidy` is a second or two slower on my laptop.
Not sure if this counts as a warning or an error that should return 1.
Not sure whether unused file output should go before or after the line specific errors.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7118)
<!-- Reviewable:end -->
2015-08-24 16:03:05 -06:00
OneKorg
07cde59535 Mention max length in tidy check_length. Fixes #7309 2015-08-21 11:26:13 -07:00
Johann Tuffe
009f6f63ad check for uses to be sorted 2015-08-20 20:47:25 +08:00
Greg Guthe
8b4b9ed99b Add tidy check for unused reftest html files
Refs: https://github.com/servo/servo/issues/7078
2015-08-19 14:16:35 -04:00
Josh Matthews
f6b3bebf84 Deal with /* /* when checking syntax. 2015-08-16 10:31:49 -04:00
Josh Matthews
a147cbe0c1 Tighten up checks for spaces around colons to deal with trait inheritance syntax. 2015-08-16 10:31:36 -04:00
Josh Matthews
7f935f010b Deal with multiline comments and reduce false positives for common syntax overlaps. Improve error messages. 2015-08-16 10:25:51 -04:00
Josh Matthews
4e593280ff Deal with multiline strings and tighten up syntax nit error messages. 2015-08-16 10:25:51 -04:00
wilmoz
e57a3888a5 Check for simple Rust style nits in tidy.py 2015-08-16 10:25:50 -04:00
Ms2ger
47d6d958f5 Revert "Auto merge of #7103 - frewsxcv:python-venv, r=metajack" for breaking web-platform-tests.
This reverts commit c315404db8, reversing
changes made to b00583bd4e.
2015-08-09 11:20:40 +02:00
Corey Farwell
33f78314d9 Use one Python virtual environment for all mach commands
Prior to this commit:

* Our Python dependency story was a bit of a mess. We had complete
 Python packages (wheels and directories) living in-tree, despite
 not having any changes from upstream. This is particularly bad because
 `setup.py` never gets run on these packages which could (sometimes
 silently) unintended breakage.
* Python virtual environments (virtualenv) were only utilized for
 testing web-platform tests

After this commit:

* A single virtualenv (`python/_virtualenv`) is activated upon *every*
 call to mach
* A requirements file (`python/requirements.txt`) is added to describe
 the dependencies needed by Python modules in `python/`. The child
 commit immediately following this will remove all the dependencies
 no longer needed in-tree (for the sake of keeping this commit
 readable).

Relevant to https://github.com/servo/servo/issues/861

Fixes https://github.com/servo/servo/issues/6999
2015-08-08 18:48:02 -04:00
Corey Farwell
b91320cb05 Remove unused variable 2015-08-08 18:47:31 -04:00
Corey Farwell
da44f31cb1 Remove invalid file path in ignored_files for tidying 2015-08-07 10:24:19 -04:00
Corey Farwell
5eeb53413e Prevent flake8 from crashing tidy
If someone were to write:

    def hello() :
        print "hello world"

flake8 would warn:

    stdin:54:45: E203 whitespace before ':'

Normally there are only three colons in a flake8 error message, but this
one has four, which causes issue with this line:

    _, line_num, _, message = error.split(":")

...causing this error:

    ValueError: too many values to unpack

This commit updates the `str.split` call to utilize the `maxsplit`
parameter to prevent this error from occurring.
2015-08-05 10:23:16 -04:00
Bogdan Cuza
8bc66f97f8 Implement the FileList interface. Fixes #6708 2015-08-01 19:31:20 +02:00
Bogdan Cuza
f039827dcd Fix #6664 and add color to tidy output 2015-07-28 13:28:33 +02:00
Corey Farwell
9e5f31ce00 Cleanup lint special cases, refactor flake8 linting
Currently, there are a few linting functions that only run on certain
filetypes (determined by the file extension). Prior to this commit, the
special cases were handled in a parent function with a conditional. This
commit changes the system so each linting function gets passed a
filename so the function can determine whether it should run or not
based on the file extension.

I also refactored flake8 linting slightly. From what I've read so far of
the code, flake8 itself will only print the results directly to stdout
(though the linter would report the quantity of errors detected).
Prior to this commit, we would let flake8 print directly to stdout and
just determine if there were >0 errors reported. This commit (sort of
hackily) temporarily captures stdout when we call flake8 so we can do
what we want with the output, allowing us to `yield` the line number
and message like we do with the other linting functions.

In my opinion, both of these changes isolate specific behaviors/checks
into their respective linting functions instead of having them handled
at a more global level.

In addition to the changes above:

* The whitespace linter now runs on WebIDL and TOML files
* The license header linter now runs on WebIDL files
2015-07-26 22:12:20 +07:00
Corey Farwell
d71d2da81f Remove unused Python import 2015-07-26 22:07:22 +07:00
Michael Howell
ce4709d6a7 Remove the last few TRs. 2015-07-22 10:52:04 -07:00
Michael Howell
970f018dc8 Better references. 2015-07-22 10:49:26 -07:00
Michael Howell
91c61ae751 Tidy finds WebIDLs with no spec.
Closes #6689
2015-07-21 15:36:33 -07:00
Bogdan Cuza
75e14e80cd Fix #6623 and update toml.py 2015-07-20 19:47:35 +03:00
Corey Farwell
0ec2375cab Remove tidy blacklist for 'script/dom/bindings/*'
Recently, I found myself reading through the Python codegen scripts that
live in 'components/script/dom/bindings/*' and noticed that there were
many tidy violations: unnecessary semicolons, weird spacing, unused
variables, lack of license headers, etc. Considering these files are now
living in our tree and mostly maintained directly by contributors of
Servo (as opposed to being from upstream), I feel these files should not
be excluded from our normal tidy process. This commit removes the
blacklist on these files and fixes all tidy violations.

I added these subdirectories to the blacklist because they appear to be
maintained upstream somewhere else:

* "components/script/dom/bindings/codegen/parser/*",
* "components/script/dom/bindings/codegen/ply/*",

Also, I added a '# noqa' comment which tells us to ignore the
flake8 errors for that line. I chose to ignore this (instead of fixing
it) to make the work for this commit simpler for me.
2015-07-09 19:42:31 +09:00
Jack Moffitt
a0237085c6 Use Cargo's target directory sharing.
This speeds up `./mach build --dev` followed by `./mach build-cef` by a
large amount, and also speeds up other build combos found in our CI.
2015-06-15 11:48:47 -06:00
Corey Farwell
848c57653c Add flake8 to the tidy process for Python files
Fixes #6236

Also included in this commit are the changes need to make flake8 pass
for the existing python file
2015-06-04 11:17:34 -04:00
Corey Farwell
6c8c039409 Run tidy everything in the tree, remove directory whitelist
After #6268 merged, I found out that everything in the tree currently
passes the tidy checker.
2015-06-03 12:03:13 -04:00
Corey Farwell
e3b71c65bf Fix tidy issues with Python files in python/ 2015-06-02 19:51:41 -04:00
Corey Farwell
c639a0cf49 Tidy files in the python/ directory 2015-06-02 19:30:44 -04:00
Corey Farwell
8e3f4bba85 Reduce max line length from 150 to 120 characters
Part of https://github.com/servo/servo/issues/6041
2015-05-24 00:01:49 -04:00
Ms2ger
d84c3e7a30 Fix some overlong lines. 2015-05-14 13:26:13 +02:00
Duncan
007295de4a Suggest how to fix unstable WHATWG links in tidy.py
Fixes #5929
2015-05-05 19:37:27 +12:00
Dhananjay Nakrani
030580e720 Rename check_whitespace_url_len() -> check_by_line(). 2015-04-21 10:20:13 -07:00
Dhananjay Nakrani
7453959426 Refactor tidy.py to reduce code duplication. 2015-04-21 10:20:12 -07:00
Dhananjay Nakrani
a0295b7489 Make tidy.py check for links to spec pages. [Issue#5730] 2015-04-21 10:20:11 -07:00
Simon Sapin
2a6f2cde50 Check license headers in ./tests 2015-04-08 01:07:56 +02:00
bors-servo
9f3493b5bb auto merge of #5039 : psdh/servo/tidy, r=jdm
Fixes #5034
2015-03-31 12:42:56 -06:00
Prabhjyot Singh Sodhi
2fdc1cbaa8 Making tidy.py check ports/glutin and ports/gonk 2015-03-31 16:37:30 +05:30
Gilles Leblanc
54dfb659ec Organize reftest list alphabetically and make the tidy script check it
Reftest list check is checked using Python's default string comparison.
Also added a notice in the tidy script when there are no errors.

Fixes #5092
2015-03-07 17:51:17 +01:00
Manish Goregaokar
d715241085 Test gonk in tidy 2015-02-23 21:19:35 +05:30
Ms2ger
394f816343 Disallow lines that span more than 160 columns.
The Rust style guide suggests 100, but we have too many violations in the
tree already. This check can be tightened over time.
2015-01-19 13:48:32 +01:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
Manish Goregaokar
f6b6687e53 Make tidy ingore new target dir 2014-12-04 22:21:42 -08:00
Duncan Keall
74cc288cdb Use os.path.join instead of manually inserting slashes. 2014-09-10 11:03:21 +12:00
Duncan Keall
8e25e958ab Cleaned up python/licenseck.py
- Moved logic into tidy.py
- Removed explicit BSD license exceptions, they are already ignored by
  being inside the codegen directory.
2014-09-10 10:01:46 +12:00
Duncan Keall
6c48066565 Refactor python/tidy.py to not use globals. Fixes #3242 2014-09-10 10:01:46 +12:00