mirror of
https://github.com/servo/servo.git
synced 2025-07-22 14:53:49 +01:00
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.
This commit is contained in:
parent
fa266abd29
commit
81433a8684
54 changed files with 68 additions and 266 deletions
11
python/tidy/tests/Cargo.toml
Normal file
11
python/tidy/tests/Cargo.toml
Normal file
|
@ -0,0 +1,11 @@
|
|||
[package]
|
||||
name = "test"
|
||||
version = "0.0.1"
|
||||
authors = ["The Servo Project Developers"]
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
test-package = { version = "*" }
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
8
python/tidy/tests/__init__.py
Normal file
8
python/tidy/tests/__init__.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
|
||||
# file at the top-level directory of this distribution.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
5
python/tidy/tests/apache2_license.rs
Normal file
5
python/tidy/tests/apache2_license.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
19
python/tidy/tests/ban-domrefcell.rs
Normal file
19
python/tidy/tests/ban-domrefcell.rs
Normal file
|
@ -0,0 +1,19 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![feature(plugin)]
|
||||
#![plugin(script_plugins)]
|
||||
|
||||
extern crate script;
|
||||
|
||||
use script::test::Dom;
|
||||
use script::test::DomRefCell;
|
||||
use script::test::Node;
|
||||
|
||||
struct Foo {
|
||||
bar: DomRefCell<Dom<Node>>
|
||||
//~^ ERROR Banned type DomRefCell<Dom<T>> detected. Use MutDom<T> instead
|
||||
}
|
||||
|
||||
fn main() {}
|
21
python/tidy/tests/ban.rs
Normal file
21
python/tidy/tests/ban.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![feature(plugin)]
|
||||
#![plugin(script_plugins)]
|
||||
|
||||
extern crate js;
|
||||
|
||||
use js::jsval::JSVal;
|
||||
use std::cell::Cell;
|
||||
use std::cell::UnsafeCell;
|
||||
|
||||
struct Foo {
|
||||
bar: Cell<JSVal>,
|
||||
//~^ ERROR Banned type Cell<JSVal> detected. Use MutDom<JSVal> instead
|
||||
foo: UnsafeCell<JSVal>
|
||||
//~^ NOT AN ERROR
|
||||
}
|
||||
|
||||
fn main() {}
|
26
python/tidy/tests/blocked_package.lock
Normal file
26
python/tidy/tests/blocked_package.lock
Normal file
|
@ -0,0 +1,26 @@
|
|||
[root]
|
||||
name = "servo"
|
||||
version = "0.0.1"
|
||||
|
||||
[[package]]
|
||||
name = "test_blocked"
|
||||
version = "0.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test_exception"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test_unneeded_exception"
|
||||
version = "0.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
]
|
0
python/tidy/tests/dir_check/only_webidl/test.webidl
Normal file
0
python/tidy/tests/dir_check/only_webidl/test.webidl
Normal file
0
python/tidy/tests/dir_check/webidl_plus/test.rs
Normal file
0
python/tidy/tests/dir_check/webidl_plus/test.rs
Normal file
0
python/tidy/tests/dir_check/webidl_plus/test.test
Normal file
0
python/tidy/tests/dir_check/webidl_plus/test.test
Normal file
0
python/tidy/tests/dir_check/webidl_plus/test.webidl
Normal file
0
python/tidy/tests/dir_check/webidl_plus/test.webidl
Normal file
0
python/tidy/tests/dir_check/webidl_plus/test2.rs
Normal file
0
python/tidy/tests/dir_check/webidl_plus/test2.rs
Normal file
7
python/tidy/tests/duplicate_key.json
Normal file
7
python/tidy/tests/duplicate_key.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"key": "value",
|
||||
"other_key": {
|
||||
"the_duplicated_key": 1,
|
||||
"the_duplicated_key": 2
|
||||
}
|
||||
}
|
7
python/tidy/tests/duplicate_keys_buildbot_steps.yml
Normal file
7
python/tidy/tests/duplicate_keys_buildbot_steps.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
duplicate_yaml_key:
|
||||
- value1
|
||||
other_key:
|
||||
- value2
|
||||
duplicate_yaml_key:
|
||||
- value3
|
50
python/tidy/tests/duplicated_package.lock
Normal file
50
python/tidy/tests/duplicated_package.lock
Normal file
|
@ -0,0 +1,50 @@
|
|||
[root]
|
||||
name = "servo"
|
||||
version = "0.0.1"
|
||||
|
||||
[[package]]
|
||||
name = "test"
|
||||
version = "0.4.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "test"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "test2"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/user/test2#c54edsf"
|
||||
dependencies = [
|
||||
"test 0.4.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test3"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"test 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test3"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/user/test3#c54edsf"
|
||||
|
||||
[[package]]
|
||||
name = "test4"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/user/test4#c54edsf"
|
||||
dependencies = [
|
||||
"test3 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "test5"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/"
|
||||
dependencies = [
|
||||
"test3 0.5.1 (git+https://github.com/user/test3)",
|
||||
]
|
0
python/tidy/tests/empty_file.rs
Normal file
0
python/tidy/tests/empty_file.rs
Normal file
1
python/tidy/tests/incorrect_license.rs
Normal file
1
python/tidy/tests/incorrect_license.rs
Normal file
|
@ -0,0 +1 @@
|
|||
/* Incorrect license here */
|
14
python/tidy/tests/lib.rs
Normal file
14
python/tidy/tests/lib.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![feature(def)]
|
||||
#![feature(abc)]
|
||||
|
||||
#![feature(abc, def, ghi)]
|
||||
#![feature(aaa)]
|
||||
|
||||
#![feature(def, ghi, abc)]
|
||||
|
||||
#![feature(ghi)]
|
||||
#![feature(abd, hef)]
|
5
python/tidy/tests/lints/invalid_error_tuple.py
Normal file
5
python/tidy/tests/lints/invalid_error_tuple.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from servo_tidy.tidy import LintRunner
|
||||
|
||||
class Lint(LintRunner):
|
||||
def run(self):
|
||||
yield None
|
5
python/tidy/tests/lints/no_lint.py
Normal file
5
python/tidy/tests/lints/no_lint.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from servo_tidy.tidy import LintRunner
|
||||
|
||||
class Linter(LintRunner):
|
||||
def run(self):
|
||||
pass
|
5
python/tidy/tests/lints/no_run.py
Normal file
5
python/tidy/tests/lints/no_run.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from servo_tidy.tidy import LintRunner
|
||||
|
||||
class Lint(LintRunner):
|
||||
def some_method(self):
|
||||
pass
|
2
python/tidy/tests/lints/not_inherited.py
Normal file
2
python/tidy/tests/lints/not_inherited.py
Normal file
|
@ -0,0 +1,2 @@
|
|||
class Lint(object):
|
||||
pass
|
0
python/tidy/tests/lints/not_script
Normal file
0
python/tidy/tests/lints/not_script
Normal file
6
python/tidy/tests/lints/proper_file.py
Normal file
6
python/tidy/tests/lints/proper_file.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from servo_tidy.tidy import LintRunner
|
||||
|
||||
class Lint(LintRunner):
|
||||
def run(self):
|
||||
for _ in [None]:
|
||||
yield ('path', 0, 'foobar')
|
6
python/tidy/tests/long_line.rs
Normal file
6
python/tidy/tests/long_line.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
println!("really really loooooooooooooooooooooooooooooooooooooooooooong lineeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
|
||||
let url = "http://www.should.skip/really-looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong-url-strings";
|
4
python/tidy/tests/malformed_json.json
Normal file
4
python/tidy/tests/malformed_json.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"key": "value",
|
||||
"other_key": "value_with_bad_quote'
|
||||
}
|
5
python/tidy/tests/manifest-include.ini
Normal file
5
python/tidy/tests/manifest-include.ini
Normal file
|
@ -0,0 +1,5 @@
|
|||
skip: true
|
||||
[html]
|
||||
skip: false
|
||||
[never_going_to_exist]
|
||||
skip: false
|
5
python/tidy/tests/modeline.txt
Normal file
5
python/tidy/tests/modeline.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
# vim: set noexpandtab:
|
||||
// vi: et:
|
||||
/* ex: et:
|
||||
anything -*-Lisp-*-
|
||||
-*- mode: Lisp -*-
|
28
python/tidy/tests/multiline_string.rs
Normal file
28
python/tidy/tests/multiline_string.rs
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
// This puts a "multi-line string
|
||||
// inside of a comment" and then subsequently has a hyphenated-phrase
|
||||
|
||||
|
||||
const FOO: &'static str = "Do not confuse 'apostrophes',
|
||||
They can be 'lifetimes' or 'characters'";
|
||||
|
||||
|
||||
fn main() {
|
||||
assert!(foo("test
|
||||
foo-bar"));
|
||||
|
||||
assert!(foo("test
|
||||
test2 \"
|
||||
foo-bar"));
|
||||
|
||||
assert!(foo("test
|
||||
test2 \
|
||||
foo-bar"));
|
||||
|
||||
println!("This is a multiline string with a URL, which kinda, \
|
||||
sorta looks like a comment https://github.com/servo/servo/");
|
||||
}
|
2
python/tidy/tests/non_list_mapping_buildbot_steps.yml
Normal file
2
python/tidy/tests/non_list_mapping_buildbot_steps.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
---
|
||||
non-list-key: "string string"
|
7
python/tidy/tests/non_string_list_buildbot_steps.yml
Normal file
7
python/tidy/tests/non_string_list_buildbot_steps.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
# This is a buildbot_steps.yml file that should break linting becasue it is not a
|
||||
# mapping to a list of strings
|
||||
mapping_key:
|
||||
- - list_of_list
|
||||
- sublist_item1
|
||||
- sublist_item2
|
85
python/tidy/tests/rust_tidy.rs
Normal file
85
python/tidy/tests/rust_tidy.rs
Normal file
|
@ -0,0 +1,85 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use app_units::Au;
|
||||
use raqote::{GradientStop, Source, SolidSource};
|
||||
use raqote::{Source, SolidSource},
|
||||
ColorPattern, CompositionOp};
|
||||
use euclid::Size2D;
|
||||
use raqote::Gradient;
|
||||
use raqote::{Gradient};
|
||||
|
||||
|
||||
mod paint_context;
|
||||
pub mod display_list;
|
||||
mod test::{
|
||||
};
|
||||
|
||||
extern crate webrender_api;
|
||||
extern crate style_traits;
|
||||
|
||||
#[foo = "bar,baz"]
|
||||
#[derive(Copy,Debug, ComputeSquaredDistance)]
|
||||
impl test {
|
||||
|
||||
fn test_fun(y:f32)->f32{
|
||||
let x=5;
|
||||
x = x-1;
|
||||
x = x*x;
|
||||
let z = match y {
|
||||
1 =>2,
|
||||
2 => 1,
|
||||
};
|
||||
let z = &Vec<T>;
|
||||
struct Member {
|
||||
member_name:"Foo"
|
||||
member_id:5
|
||||
}
|
||||
}
|
||||
|
||||
fn test_fun2(y : &String, z : &Vec<f32>, r: &Root<isize>, s: &DomRoot<isize>) -> () {
|
||||
let x = true;
|
||||
x
|
||||
&& x;
|
||||
if x {
|
||||
;
|
||||
}
|
||||
else {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
type Text_Fun3 = fn( i32) -> i32;
|
||||
|
||||
fn test_fun3<Text_Fun3>( y: Text_Fun3) {
|
||||
let (x, y) = (1, 2) // Should not trigger
|
||||
test_fun( x);
|
||||
test_fun (y);
|
||||
}
|
||||
|
||||
// Should not be triggered
|
||||
macro_rules! test_macro ( ( $( $fun:ident = $flag:ident ; )* ) => ());
|
||||
|
||||
let var
|
||||
= "val";
|
||||
|
||||
fn test_fun4()
|
||||
{
|
||||
}
|
||||
let var = if true {
|
||||
"true"
|
||||
} else { // Should not trigger
|
||||
"false"
|
||||
} // Should not trigger
|
||||
|
||||
if true { // Double space after keyword
|
||||
42
|
||||
} else {
|
||||
let xif = 42 in { xif } // Should not trigger
|
||||
}
|
||||
|
||||
let option = Some(3);
|
||||
println!("{}", option.unwrap());
|
||||
panic!("What a way to end.");
|
||||
}
|
19
python/tidy/tests/servo-tidy.toml
Normal file
19
python/tidy/tests/servo-tidy.toml
Normal file
|
@ -0,0 +1,19 @@
|
|||
key-outside = ""
|
||||
|
||||
[configs]
|
||||
skip-check-length = false
|
||||
skip-check-licenses = false
|
||||
wrong-key = false
|
||||
|
||||
[blocked-packages]
|
||||
|
||||
[wrong]
|
||||
wrong-key = true
|
||||
|
||||
[ignore]
|
||||
files = [
|
||||
"./fake/file.html",
|
||||
]
|
||||
directories = [
|
||||
"./fake/dir",
|
||||
]
|
4
python/tidy/tests/shebang_license.py
Normal file
4
python/tidy/tests/shebang_license.py
Normal file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
14
python/tidy/tests/shell_tidy.sh
Normal file
14
python/tidy/tests/shell_tidy.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Tests tidy for shell scripts.
|
||||
|
||||
set -o nounset
|
||||
|
||||
# Talking about some `concept in backticks` # shouldn't trigger
|
||||
echo "hello world"
|
||||
some_var=`echo "command substitution"`
|
||||
another_var="$some_var"
|
||||
if [ -z "${some_var}" ]; then
|
||||
echo "should have used [["
|
||||
fi
|
||||
[ -z "${another_var}" ]
|
10
python/tidy/tests/spec.webidl
Normal file
10
python/tidy/tests/spec.webidl
Normal file
|
@ -0,0 +1,10 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
|
||||
interface Test {
|
||||
[SameObject ]
|
||||
readonly attribute Node root;
|
||||
};
|
32
python/tidy/tests/speclink.rs
Normal file
32
python/tidy/tests/speclink.rs
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
impl SpecLinkMethods for SpecLink {
|
||||
amacro!("Macros inside impls should trigger spec checks.")
|
||||
|
||||
// Method declarations should trigger spec checks.
|
||||
fn Test(&self) -> f32 {
|
||||
amacro!("Macros inside function declarations should not trigger spec checks.");
|
||||
if unsafe { false } {
|
||||
}
|
||||
amacro!("Even if there's weird brace counts.");
|
||||
0
|
||||
}
|
||||
|
||||
// A spec link.
|
||||
// https://example.com/
|
||||
fn Foo() {}
|
||||
|
||||
/// A spec link.
|
||||
/// <https://example.com/>
|
||||
fn Foo() {}
|
||||
|
||||
/// A spec link.
|
||||
/// <https://example.com/>
|
||||
/// Doc comments are OK
|
||||
// Regular comments are OK
|
||||
#[allow(attributes_too)]
|
||||
fn Foo() {}
|
||||
}
|
||||
|
0
python/tidy/tests/test_ignored/whee/foo/bar.rs
Normal file
0
python/tidy/tests/test_ignored/whee/foo/bar.rs
Normal file
0
python/tidy/tests/test_ignored/whee/test.rs
Normal file
0
python/tidy/tests/test_ignored/whee/test.rs
Normal file
7
python/tidy/tests/unordered_key.json
Normal file
7
python/tidy/tests/unordered_key.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"key": "value",
|
||||
"other_key": {
|
||||
"b": 1,
|
||||
"a": 2
|
||||
}
|
||||
}
|
6
python/tidy/tests/whatwg_link.rs
Normal file
6
python/tidy/tests/whatwg_link.rs
Normal file
|
@ -0,0 +1,6 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#dom-context-2d-putimagedata
|
||||
// https://html.spec.whatwg.org/#typographic-conventions
|
7
python/tidy/tests/wrong_space.rs
Normal file
7
python/tidy/tests/wrong_space.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
pub struct TestStruct(
|
||||
pub testMember1: usize,
|
||||
pub testMember2: bool,
);
|
Loading…
Add table
Add a link
Reference in a new issue