本文整理汇总了Python中servo_tidy.tidy.collect_errors_for_files函数的典型用法代码示例。如果您正苦于以下问题:Python collect_errors_for_files函数的具体用法?Python collect_errors_for_files怎么用?Python collect_errors_for_files使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了collect_errors_for_files函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_rust
def test_rust(self):
errors = tidy.collect_errors_for_files(iterFile('rust_tidy.rs'), [], [tidy.check_rust], print_text=False)
self.assertEqual('extra space after use', errors.next()[2])
self.assertEqual('extra space after {', errors.next()[2])
self.assertEqual('extra space before }', errors.next()[2])
self.assertEqual('use statement spans multiple lines', errors.next()[2])
self.assertEqual('missing space before }', errors.next()[2])
self.assertTrue('use statement is not in alphabetical order' in errors.next()[2])
self.assertEqual('use statement contains braces for single import', errors.next()[2])
self.assertTrue('use statement is not in alphabetical order' in errors.next()[2])
self.assertEqual('encountered whitespace following a use statement', errors.next()[2])
self.assertTrue('mod declaration is not in alphabetical order' in errors.next()[2])
self.assertEqual('mod declaration spans multiple lines', errors.next()[2])
self.assertTrue('extern crate declaration is not in alphabetical order' in errors.next()[2])
self.assertTrue('derivable traits list is not in alphabetical order' in errors.next()[2])
self.assertEqual('found an empty line following a {', errors.next()[2])
self.assertEqual('missing space before ->', errors.next()[2])
self.assertEqual('missing space after ->', errors.next()[2])
self.assertEqual('missing space after :', errors.next()[2])
self.assertEqual('missing space before {', errors.next()[2])
self.assertEqual('missing space before =', errors.next()[2])
self.assertEqual('missing space after =', errors.next()[2])
self.assertEqual('missing space before -', errors.next()[2])
self.assertEqual('missing space before *', errors.next()[2])
self.assertEqual('missing space after =>', errors.next()[2])
self.assertEqual('missing space after :', errors.next()[2])
self.assertEqual('missing space after :', errors.next()[2])
self.assertEqual('extra space before :', errors.next()[2])
self.assertEqual('extra space before :', errors.next()[2])
self.assertEqual('use &[T] instead of &Vec<T>', errors.next()[2])
self.assertEqual('use &str instead of &String', errors.next()[2])
self.assertEqual('use &T instead of &Root<T>', errors.next()[2])
self.assertEqual('encountered function signature with -> ()', errors.next()[2])
self.assertEqual('operators should go at the end of the first line', errors.next()[2])
self.assertEqual('else braces should be on the same line', errors.next()[2])
self.assertEqual('extra space after (', errors.next()[2])
self.assertEqual('extra space after (', errors.next()[2])
self.assertEqual('extra space after (', errors.next()[2])
self.assertEqual('extra space after test_fun', errors.next()[2])
self.assertEqual('no = in the beginning of line', errors.next()[2])
self.assertEqual('space before { is not a multiple of 4', errors.next()[2])
self.assertEqual('space before } is not a multiple of 4', errors.next()[2])
self.assertEqual('extra space after if', errors.next()[2])
self.assertNoMoreErrors(errors)
feature_errors = tidy.collect_errors_for_files(iterFile('lib.rs'), [], [tidy.check_rust], print_text=False)
self.assertTrue('feature attribute is not in alphabetical order' in feature_errors.next()[2])
self.assertTrue('feature attribute is not in alphabetical order' in feature_errors.next()[2])
self.assertTrue('feature attribute is not in alphabetical order' in feature_errors.next()[2])
self.assertTrue('feature attribute is not in alphabetical order' in feature_errors.next()[2])
self.assertNoMoreErrors(feature_errors)
ban_errors = tidy.collect_errors_for_files(iterFile('ban.rs'), [], [tidy.check_rust], print_text=False)
self.assertEqual('Banned type Cell<JSVal> detected. Use MutJS<JSVal> instead', ban_errors.next()[2])
self.assertNoMoreErrors(ban_errors)
ban_errors = tidy.collect_errors_for_files(iterFile('ban-domrefcell.rs'), [], [tidy.check_rust], print_text=False)
self.assertEqual('Banned type DOMRefCell<JS<T>> detected. Use MutJS<JS<T>> instead', ban_errors.next()[2])
self.assertNoMoreErrors(ban_errors)
开发者ID:gpoesia,项目名称:servo,代码行数:60,代码来源:test_tidy.py
示例2: test_rust
def test_rust(self):
errors = tidy.collect_errors_for_files(iterFile('rust_tidy.rs'), [], [tidy.check_rust], print_text=False)
self.assertEqual('use statement spans multiple lines', errors.next()[2])
self.assertEqual('missing space before }', errors.next()[2])
self.assertTrue('use statement is not in alphabetical order' in errors.next()[2])
self.assertEqual('use statement contains braces for single import', errors.next()[2])
self.assertEqual('encountered whitespace following a use statement', errors.next()[2])
self.assertTrue('mod declaration is not in alphabetical order' in errors.next()[2])
self.assertEqual('mod declaration spans multiple lines', errors.next()[2])
self.assertTrue('extern crate declaration is not in alphabetical order' in errors.next()[2])
self.assertEqual('found an empty line following a {', errors.next()[2])
self.assertEqual('missing space before ->', errors.next()[2])
self.assertEqual('missing space after ->', errors.next()[2])
self.assertEqual('missing space after :', errors.next()[2])
self.assertEqual('missing space before {', errors.next()[2])
self.assertEqual('missing space before =', errors.next()[2])
self.assertEqual('missing space after =', errors.next()[2])
self.assertEqual('missing space before -', errors.next()[2])
self.assertEqual('missing space before *', errors.next()[2])
self.assertEqual('missing space after =>', errors.next()[2])
self.assertEqual('missing space after :', errors.next()[2])
self.assertEqual('missing space after :', errors.next()[2])
self.assertEqual('extra space before :', errors.next()[2])
self.assertEqual('extra space before :', errors.next()[2])
self.assertEqual('use &[T] instead of &Vec<T>', errors.next()[2])
self.assertEqual('use &str instead of &String', errors.next()[2])
self.assertEqual('use &T instead of &Root<T>', errors.next()[2])
self.assertEqual('operators should go at the end of the first line', errors.next()[2])
self.assertEqual('else braces should be on the same line', errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Glorf,项目名称:servo,代码行数:30,代码来源:test_tidy.py
示例3: test_modeline
def test_modeline(self):
errors = tidy.collect_errors_for_files(iterFile('modeline.txt'), [], [tidy.check_modeline])
self.assertEqual('vi modeline present', errors.next()[2])
self.assertEqual('vi modeline present', errors.next()[2])
self.assertEqual('vi modeline present', errors.next()[2])
self.assertEqual('emacs file variables present', errors.next()[2])
self.assertEqual('emacs file variables present', errors.next()[2])
开发者ID:cjkenn,项目名称:servo,代码行数:7,代码来源:test_tidy.py
示例4: test_rust
def test_rust(self):
errors = tidy.collect_errors_for_files(iterFile("rust_tidy.rs"), [], [tidy.check_rust], print_text=False)
self.assertEqual("use statement spans multiple lines", errors.next()[2])
self.assertEqual("missing space before }", errors.next()[2])
self.assertTrue("use statement is not in alphabetical order" in errors.next()[2])
self.assertEqual("use statement contains braces for single import", errors.next()[2])
self.assertEqual("encountered whitespace following a use statement", errors.next()[2])
self.assertTrue("mod declaration is not in alphabetical order" in errors.next()[2])
self.assertEqual("mod declaration spans multiple lines", errors.next()[2])
self.assertTrue("extern crate declaration is not in alphabetical order" in errors.next()[2])
self.assertEqual("found an empty line following a {", errors.next()[2])
self.assertEqual("missing space before ->", errors.next()[2])
self.assertEqual("missing space after ->", errors.next()[2])
self.assertEqual("missing space after :", errors.next()[2])
self.assertEqual("missing space before {", errors.next()[2])
self.assertEqual("missing space before =", errors.next()[2])
self.assertEqual("missing space after =", errors.next()[2])
self.assertEqual("missing space before -", errors.next()[2])
self.assertEqual("missing space before *", errors.next()[2])
self.assertEqual("missing space after =>", errors.next()[2])
self.assertEqual("missing space after :", errors.next()[2])
self.assertEqual("missing space after :", errors.next()[2])
self.assertEqual("extra space before :", errors.next()[2])
self.assertEqual("extra space before :", errors.next()[2])
self.assertEqual("use &[T] instead of &Vec<T>", errors.next()[2])
self.assertEqual("use &str instead of &String", errors.next()[2])
self.assertEqual("use &T instead of &Root<T>", errors.next()[2])
self.assertEqual("operators should go at the end of the first line", errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:DarinM223,项目名称:servo,代码行数:29,代码来源:test_tidy.py
示例5: test_spaces_correctnes
def test_spaces_correctnes(self):
errors = tidy.collect_errors_for_files(iterFile('wrong_space.rs'), [], [tidy.check_by_line], print_text=False)
self.assertEqual('trailing whitespace', errors.next()[2])
self.assertEqual('no newline at EOF', errors.next()[2])
self.assertEqual('tab on line', errors.next()[2])
self.assertEqual('CR on line', errors.next()[2])
self.assertEqual('no newline at EOF', errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Ms2ger,项目名称:servo,代码行数:8,代码来源:test_tidy.py
示例6: test_modeline
def test_modeline(self):
errors = tidy.collect_errors_for_files(iterFile("modeline.txt"), [], [tidy.check_modeline], print_text=False)
self.assertEqual("vi modeline present", errors.next()[2])
self.assertEqual("vi modeline present", errors.next()[2])
self.assertEqual("vi modeline present", errors.next()[2])
self.assertEqual("emacs file variables present", errors.next()[2])
self.assertEqual("emacs file variables present", errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:asajeffrey,项目名称:servo,代码行数:8,代码来源:test_tidy.py
示例7: test_shell
def test_shell(self):
errors = tidy.collect_errors_for_files(iterFile('shell_tidy.sh'), [], [tidy.check_shell], print_text=False)
self.assertEqual('script does not have shebang "#!/usr/bin/env bash"', errors.next()[2])
self.assertEqual('script is missing options "set -o errexit", "set -o pipefail"', errors.next()[2])
self.assertEqual('script should not use backticks for command substitution', errors.next()[2])
self.assertEqual('variable substitutions should use the full \"${VAR}\" form', errors.next()[2])
self.assertEqual('script should use `[[` instead of `[` for conditional testing', errors.next()[2])
self.assertEqual('script should use `[[` instead of `[` for conditional testing', errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Ms2ger,项目名称:servo,代码行数:9,代码来源:test_tidy.py
示例8: test_lock
def test_lock(self):
errors = tidy.collect_errors_for_files(iterFile('duplicated_package.lock'), [tidy.check_lock], [], print_text=False)
msg = """duplicate versions for package "test"
t\033[93mfound dependency on version 0.4.9\033[0m
t\033[91mbut highest version is 0.5.1\033[0m
t\033[93mtry upgrading with\033[0m \033[96m./mach cargo-update -p test:0.4.9\033[0m
tThe following packages depend on version 0.4.9:
t\ttest2"""
self.assertEqual(msg, errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Glorf,项目名称:servo,代码行数:10,代码来源:test_tidy.py
示例9: test_lock
def test_lock(self):
errors = tidy.collect_errors_for_files(iterFile('duplicated_package.lock'), [tidy.check_lock], [], print_text=False)
msg = """duplicate versions for package `test`
\x1b[93mThe following packages depend on version 0.4.9 from 'crates.io':\x1b[0m
\ttest2
\x1b[93mThe following packages depend on version 0.5.1 from 'crates.io':\x1b[0m"""
self.assertEqual(msg, errors.next()[2])
msg2 = """duplicate versions for package `test3`
\x1b[93mThe following packages depend on version 0.5.1 from 'crates.io':\x1b[0m
\ttest4
\x1b[93mThe following packages depend on version 0.5.1 from 'https://github.com/user/test3':\x1b[0m
\ttest5"""
self.assertEqual(msg2, errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Ms2ger,项目名称:servo,代码行数:14,代码来源:test_tidy.py
示例10: test_lock_ignore_without_duplicates
def test_lock_ignore_without_duplicates(self):
tidy.config["ignore"]["packages"] = ["test", "test2", "test3", "test5"]
errors = tidy.collect_errors_for_files(iterFile('duplicated_package.lock'), [tidy.check_lock], [], print_text=False)
msg = (
"duplicates for `test2` are allowed, but only single version found"
"\n\t\x1b[93mThe following packages depend on version 0.1.0 from 'https://github.com/user/test2':\x1b[0m"
)
self.assertEqual(msg, errors.next()[2])
msg2 = (
"duplicates for `test5` are allowed, but only single version found"
"\n\t\x1b[93mThe following packages depend on version 0.1.0 from 'https://github.com/':\x1b[0m"
)
self.assertEqual(msg2, errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:EdgarChen,项目名称:servo,代码行数:17,代码来源:test_tidy.py
示例11: test_rust
def test_rust(self):
errors = tidy.collect_errors_for_files(iterFile('rust_tidy.rs'), [], [tidy.check_rust])
self.assertEqual('use statement spans multiple lines', errors.next()[2])
self.assertEqual('missing space before }', errors.next()[2])
self.assertTrue('use statement is not in alphabetical order' in errors.next()[2])
self.assertEqual('encountered whitespace following a use statement', errors.next()[2])
self.assertTrue('mod declaration is not in alphabetical order' in errors.next()[2])
self.assertEqual('mod declaration spans multiple lines', errors.next()[2])
self.assertTrue('extern crate declaration is not in alphabetical order' in errors.next()[2])
self.assertEqual('missing space before ->', errors.next()[2])
self.assertEqual('missing space after ->', errors.next()[2])
self.assertEqual('missing space after :', errors.next()[2])
self.assertEqual('missing space before {', errors.next()[2])
self.assertEqual('missing space before =', errors.next()[2])
self.assertEqual('missing space after =', errors.next()[2])
self.assertEqual('missing space before -', errors.next()[2])
self.assertEqual('missing space before *', errors.next()[2])
self.assertEqual('missing space after =>', errors.next()[2])
self.assertEqual('extra space before :', errors.next()[2])
self.assertEqual('extra space before :', errors.next()[2])
self.assertEqual('use &[T] instead of &Vec<T>', errors.next()[2])
self.assertEqual('use &str instead of &String', errors.next()[2])
开发者ID:askeing,项目名称:servo_tidy,代码行数:22,代码来源:test_tidy.py
示例12: test_spec_link
def test_spec_link(self):
tidy.SPEC_BASE_PATH = base_path
errors = tidy.collect_errors_for_files(iterFile('speclink.rs'), [], [tidy.check_spec], print_text=False)
self.assertEqual('method declared in webidl is missing a comment with a specification link', errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Ms2ger,项目名称:servo,代码行数:5,代码来源:test_tidy.py
示例13: test_non_string_list_mapping_buildbot_steps
def test_non_string_list_mapping_buildbot_steps(self):
errors = tidy.collect_errors_for_files(iterFile('non_string_list_buildbot_steps.yml'), [tidy.check_yaml], [], print_text=False)
self.assertEqual("List mapped to 'mapping_key' contains non-string element", errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Ms2ger,项目名称:servo,代码行数:4,代码来源:test_tidy.py
示例14: test_non_list_mapped_buildbot_steps
def test_non_list_mapped_buildbot_steps(self):
errors = tidy.collect_errors_for_files(iterFile('non_list_mapping_buildbot_steps.yml'), [tidy.check_yaml], [], print_text=False)
self.assertEqual("Key 'non-list-key' maps to type 'str', but list expected", errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Ms2ger,项目名称:servo,代码行数:4,代码来源:test_tidy.py
示例15: test_yaml_with_duplicate_key
def test_yaml_with_duplicate_key(self):
errors = tidy.collect_errors_for_files(iterFile('duplicate_keys_buildbot_steps.yml'), [tidy.check_yaml], [], print_text=False)
self.assertEqual('Duplicated Key (duplicate_yaml_key)', errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Ms2ger,项目名称:servo,代码行数:4,代码来源:test_tidy.py
示例16: test_json_with_unordered_keys
def test_json_with_unordered_keys(self):
tidy.config["check-ordered-json-keys"].append('python/tidy/servo_tidy_tests/unordered_key.json')
errors = tidy.collect_errors_for_files(iterFile('unordered_key.json'), [tidy.check_json], [], print_text=False)
self.assertEqual('Unordered key (found b before a)', errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Ms2ger,项目名称:servo,代码行数:5,代码来源:test_tidy.py
示例17: test_json_with_duplicate_key
def test_json_with_duplicate_key(self):
errors = tidy.collect_errors_for_files(iterFile('duplicate_key.json'), [tidy.check_json], [], print_text=False)
self.assertEqual('Duplicated Key (the_duplicated_key)', errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Ms2ger,项目名称:servo,代码行数:4,代码来源:test_tidy.py
示例18: test_spec_link
def test_spec_link(self):
tidy.spec_base_path = base_path
errors = tidy.collect_errors_for_files(iterFile('speclink.rs'), [], [tidy.check_spec])
self.assertEqual('method declared in webidl is missing a comment with a specification link', errors.next()[2])
开发者ID:Dandandan,项目名称:servo,代码行数:4,代码来源:test_tidy.py
示例19: test_license
def test_license(self):
errors = tidy.collect_errors_for_files(iterFile('incorrect_license.rs'), [], [tidy.check_license], print_text=False)
self.assertEqual('incorrect license', errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Ms2ger,项目名称:servo,代码行数:4,代码来源:test_tidy.py
示例20: test_long_line
def test_long_line(self):
errors = tidy.collect_errors_for_files(iterFile('long_line.rs'), [], [tidy.check_by_line], print_text=False)
self.assertEqual('Line is longer than 120 characters', errors.next()[2])
self.assertNoMoreErrors(errors)
开发者ID:Ms2ger,项目名称:servo,代码行数:4,代码来源:test_tidy.py
注:本文中的servo_tidy.tidy.collect_errors_for_files函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论