зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1579845 - Add a test to the mozlint check: codespell r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D45446 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2add364824
Коммит
7272d60c44
|
@ -52,6 +52,8 @@ codespell:
|
|||
- tools/docs/
|
||||
- tools/lint/
|
||||
- tools/tryselect/
|
||||
excludes:
|
||||
- tools/lint/test/test_codespell.py
|
||||
# List of extensions coming from:
|
||||
# tools/lint/{flake8,eslint}.yml
|
||||
# tools/mach_commands.py (clang-format)
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
This is a file with some typos and informations.
|
||||
But also testing false positive like optin (because this isn't always option)
|
||||
or stuff related to our coding style like:
|
||||
aparent (aParent).
|
||||
but detects mistakes like mozila
|
|
@ -13,4 +13,6 @@ skip-if = os == "win"
|
|||
[test_file_license.py]
|
||||
[test_lintpref.py]
|
||||
[test_shellcheck.py]
|
||||
[test_rst.py]
|
||||
[test_rst.py]
|
||||
[test_codespell.py]
|
||||
skip-if = os == "win" || os == "mac" # codespell installed on Linux
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
from __future__ import absolute_import, print_function
|
||||
|
||||
import mozunit
|
||||
|
||||
LINTER = 'codespell'
|
||||
|
||||
|
||||
def test_lint_codespell(lint, paths):
|
||||
results = lint(paths())
|
||||
assert len(results) == 2
|
||||
|
||||
assert results[0].message == 'informations ==> information'
|
||||
assert results[0].level == "error"
|
||||
assert results[0].lineno == 1
|
||||
assert results[0].relpath == "ignore.rst"
|
||||
|
||||
assert results[1].message == "mozila ==> mozilla"
|
||||
assert results[1].level == "error"
|
||||
assert results[1].lineno == 5
|
||||
assert results[1].relpath == "ignore.rst"
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
mozunit.main()
|
Загрузка…
Ссылка в новой задаче