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:
Sylvestre Ledru 2019-12-03 14:00:49 +00:00
Родитель 2add364824
Коммит 7272d60c44
4 изменённых файлов: 34 добавлений и 1 удалений

Просмотреть файл

@ -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()