Skip to content

Commit

Permalink
Issue #12421: tidy should also check .html files
Browse files Browse the repository at this point in the history
  • Loading branch information
simartin committed Aug 9, 2016
1 parent 5e83b3f commit 1e60c91
Show file tree
Hide file tree
Showing 85 changed files with 712 additions and 707 deletions.
13 changes: 9 additions & 4 deletions python/tidy/servo_tidy/tidy.py
Expand Up @@ -27,7 +27,7 @@
# File patterns to include in the non-WPT tidy check.
FILE_PATTERNS_TO_CHECK = ["*.rs", "*.rc", "*.cpp", "*.c",
"*.h", "Cargo.lock", "*.py", "*.sh",
"*.toml", "*.webidl", "*.json"]
"*.toml", "*.webidl", "*.json", "*.html"]

# File patterns that are ignored for all tidy and lint checks.
FILE_PATTERNS_TO_IGNORE = ["*.#*", "*.pyc"]
Expand All @@ -44,6 +44,11 @@
os.path.join(".", "tests", "wpt", "metadata-css", "MANIFEST.json"),
os.path.join(".", "components", "script", "dom", "webidls", "ForceTouchEvent.webidl"),
os.path.join(".", "support", "android", "openssl.sh"),
# Ignore those files since the issues reported are on purpose
os.path.join(".", "tests", "html", "bad-line-ends.html"),
os.path.join(".", "tests", "unit", "net", "parsable_mime", "text"),
os.path.join(".", "tests", "wpt", "mozilla", "tests", "css", "fonts"),
os.path.join(".", "tests", "wpt", "mozilla", "tests", "css", "pre_with_tab.html"),
# FIXME(pcwalton, #11679): This is a workaround for a tidy error on the quoted string
# `"__TEXT,_info_plist"` inside an attribute.
os.path.join(".", "components", "servo", "platform", "macos", "mod.rs"),
Expand Down Expand Up @@ -148,7 +153,7 @@ def filter_files(start_dir, only_changed_files, progress):


def check_license(file_name, lines):
if any(file_name.endswith(ext) for ext in (".toml", ".lock", ".json")):
if any(file_name.endswith(ext) for ext in (".toml", ".lock", ".json", ".html")):
raise StopIteration
while lines and (lines[0].startswith(EMACS_HEADER) or lines[0].startswith(VIM_HEADER)):
lines = lines[1:]
Expand All @@ -168,7 +173,7 @@ def check_modeline(file_name, lines):


def check_length(file_name, idx, line):
if file_name.endswith(".lock") or file_name.endswith(".json"):
if file_name.endswith(".lock") or file_name.endswith(".json") or file_name.endswith(".html"):
raise StopIteration
# Prefer shorter lines when shell scripting.
if file_name.endswith(".sh"):
Expand Down Expand Up @@ -672,7 +677,7 @@ def collect_errors_for_files(files_to_check, checking_functions, line_checking_f


def get_wpt_files(only_changed_files, progress):
wpt_dir = os.path.join(".", "tests", "wpt", "web-platform-tests" + os.sep)
wpt_dir = os.path.join(".", "tests", "wpt" + os.sep)
file_iter = get_file_list(os.path.join(wpt_dir), only_changed_files)
(has_element, file_iter) = is_iter_empty(file_iter)
if not has_element:
Expand Down
124 changes: 62 additions & 62 deletions tests/html/acid1.html
@@ -1,11 +1,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
<title>
display/box/float/clear test
</title>
<style type="text/css">
/* last modified: 1 Dec 98 */
<title>
display/box/float/clear test
</title>
<style type="text/css">
/* last modified: 1 Dec 98 */

html {
font: 10px/1 Verdana, sans-serif;
Expand All @@ -27,9 +27,9 @@
padding: .5em;
}

dt {
dt {
background-color: rgb(204,0,0);
margin: 0;
margin: 0;
padding: 1em;
width: 10.638%; /* refers to parent element's width of 47em. = 5em or 50px */
height: 28em;
Expand Down Expand Up @@ -82,12 +82,12 @@
color: white;
}

form {
form {
margin: 0;
display: inline;
}

p {
p {
margin: 0;
}

Expand Down Expand Up @@ -125,59 +125,59 @@
font-size: 1em;
}
</style>
</head>
<body>
<dl>
<dt>
toggle
</dt>
<dd>
<ul>
<li>
the way
</li>
<li id="bar">
<p>
the world ends
</p>
<form action="./" method="get">
<p>
bang
<input name="foo" value="off" type="radio">
</p>
<p>
whimper
<input name="foo2" value="on" type="radio">
</p>
</form>
</li>
<li>
i grow old
</li>
<li id="baz">
pluot?
</li>
</ul>
<blockquote>
<address>
bar maids,
</address>
</blockquote>
<h1>
sing to me, erbarme dich
</h1>
</dd>
</dl>
<p style="color: black; font-size: 1em; line-height: 1.3em; clear: both">
This is a nonsensical document, but syntactically valid HTML 4.0. All
100%-conformant CSS1 agents should be able to render the document
</head>
<body>
<dl>
<dt>
toggle
</dt>
<dd>
<ul>
<li>
the way
</li>
<li id="bar">
<p>
the world ends
</p>
<form action="./" method="get">
<p>
bang
<input name="foo" value="off" type="radio">
</p>
<p>
whimper
<input name="foo2" value="on" type="radio">
</p>
</form>
</li>
<li>
i grow old
</li>
<li id="baz">
pluot?
</li>
</ul>
<blockquote>
<address>
bar maids,
</address>
</blockquote>
<h1>
sing to me, erbarme dich
</h1>
</dd>
</dl>
<p style="color: black; font-size: 1em; line-height: 1.3em; clear: both">
This is a nonsensical document, but syntactically valid HTML 4.0. All
100%-conformant CSS1 agents should be able to render the document
elements above this paragraph indistinguishably (to the pixel) from this
<a href="http://www.w3.org/Style/CSS/Test/CSS1/current/sec5526c.gif">reference rendering,</a>
(except font rasterization and form widgets). All discrepancies
should be traceable to CSS1 implementation shortcomings. Once you have
finished evaluating this test, you can return to the <a href="http://www.w3.org/Style/CSS/Test/CSS1/current/sec5526c.htm">parent page</a>.
</p>

<a href="http://www.w3.org/Style/CSS/Test/CSS1/current/sec5526c.gif">reference rendering,</a>
(except font rasterization and form widgets). All discrepancies
should be traceable to CSS1 implementation shortcomings. Once you have
finished evaluating this test, you can return to the <a href="http://www.w3.org/Style/CSS/Test/CSS1/current/sec5526c.htm">parent page</a>.
</p>


</body></html>
2 changes: 1 addition & 1 deletion tests/html/acid2.html
Expand Up @@ -142,4 +142,4 @@ <h2 id="top">Hello World!</h2>
<div class="image-height-test"><table><tr><td><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAIAAAFSDNYfAAAAaklEQVR42u3XQQrAIAwAQeP%2F%2F6wf8CJBJTK9lnQ7FpHGaOurt1I34nfH9pMMZAZ8BwMGEvvh%2BBsJCAgICLwIOA8EBAQEBAQEBAQEBK79H5RfIQAAAAAAAAAAAAAAAAAAAAAAAAAAAID%2FABMSqAfj%2FsLmvAAAAABJRU5ErkJggg%3D%3D" alt=""></td></tr></table></div>
</div>
</body>
</html>
</html>
20 changes: 10 additions & 10 deletions tests/html/active_selector.html
Expand Up @@ -4,15 +4,15 @@
:active {border:1px solid #A61D61; background-color:#DC2F85; color:#333232;}
</style>
<body>
<fieldset>
<a href="https://servo.org/">
Link
</a>
<button>Click Me!</button>
<button disabled>You can't activate me</button>
<a>Anchor with no href</a>
<link href="www.mozilla.com">Link</link>
<link>Link with no href</link>
</fieldset>
<fieldset>
<a href="https://servo.org/">
Link
</a>
<button>Click Me!</button>
<button disabled>You can't activate me</button>
<a>Anchor with no href</a>
<link href="www.mozilla.com">Link</link>
<link>Link with no href</link>
</fieldset>
</body>
</html>
34 changes: 17 additions & 17 deletions tests/html/background.html
@@ -1,20 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<style>
.test { background: url(rust-0.png) gray; }
</style>
<body>
<div class="test" style="width:200px; height:200px; color:red;">
background: url(rust-0.png) gray; width:200px; height:200px;
</div>
<div class="test" style="background-image: url(rust-45.png); width:200px; height:200px; color:red;">
background-image: url(rust-45.png); width:200px; height:200px;
</div>
<div style="background: url(rust-90.png) yellow; width:200px; height:200px; border: 5px solid #000; color:blue;">
background: url(rust-90.png) yellow; width:200px; height:200px; border: 5px solid #000;
</div>
</body>
<head>
<title></title>
</head>
<style>
.test { background: url(rust-0.png) gray; }
</style>
<body>
<div class="test" style="width:200px; height:200px; color:red;">
background: url(rust-0.png) gray; width:200px; height:200px;
</div>
<div class="test" style="background-image: url(rust-45.png); width:200px; height:200px; color:red;">
background-image: url(rust-45.png); width:200px; height:200px;
</div>
<div style="background: url(rust-90.png) yellow; width:200px; height:200px; border: 5px solid #000; color:blue;">
background: url(rust-90.png) yellow; width:200px; height:200px; border: 5px solid #000;
</div>
</body>
</html>
2 changes: 1 addition & 1 deletion tests/html/border_collapse_test.html
Expand Up @@ -28,7 +28,7 @@
<td> 3
</tr>
<tr id="row2">
<td> 4
<td> 4
<td class="cell5"> 5
<td class="cell6"> 6
</tr>
Expand Down
6 changes: 3 additions & 3 deletions tests/html/form_html5_validations.html
Expand Up @@ -16,14 +16,14 @@
<option value="1">B</option>
<option value="2">C</option>
</select><br>
Required Radio: <input type="radio" name="group1" value="1" required>1
Required Radio: <input type="radio" name="group1" value="1" required>1
<input type="radio" name="group1" value="2">2
<input type="radio" name="group1" value="3">3<br>
Required Checkbox: <input type="checkbox" name="group2" value="1" required>1
Required Checkbox: <input type="checkbox" name="group2" value="1" required>1
<input type="checkbox" name="group2" value="2">2
<input type="checkbox" name="group2" value="3">3<br>
Required File: <input type="file" required><br>
<input type="submit">
</form>
</body>
</html>
</html>
2 changes: 1 addition & 1 deletion tests/html/inline_bg_color_simple.html
Expand Up @@ -4,7 +4,7 @@
[block background color test]
<p style="background-color:yellow">paragraph yellow</p>

[inline background color test]
[inline background color test]
<span style="font-size:30px;background-color:blue;"><img src="test.jpeg"/> span bluetexttexttext<span style="font-size:50px;background-color:yellow;">span yellow<span style="font-size:15px;background-color:red">nested-span red</span>test finishes</span></span>

</body>
Expand Down
2 changes: 1 addition & 1 deletion tests/html/input_whitespace_regression.html
Expand Up @@ -4,4 +4,4 @@
<form>
<input value="foo bar">
<input value="foo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bar">
</form>
</form>

0 comments on commit 1e60c91

Please sign in to comment.