Bug 1874684 - Part 17: Fix uninitialised variable warnings from clang-tidy. r=allstarschh
[gecko.git] / tools / lint / test / test_ruff.py
blobfbb483780e546d500f037d1d1e2758471498f86e
1 # -*- coding: utf-8 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from pprint import pprint
8 from textwrap import dedent
10 import mozunit
12 LINTER = "ruff"
13 fixed = 0
16 def test_lint_fix(lint, create_temp_file):
17 contents = dedent(
18 """
19 import distutils
20 print("hello!")
21 """
24 path = create_temp_file(contents, "bad.py")
25 lint([path], fix=True)
26 assert fixed == 1
29 def test_lint_ruff(lint, paths):
30 results = lint(paths())
31 pprint(results, indent=2)
32 assert len(results) == 2
33 assert results[0].level == "error"
34 assert results[0].relpath == "bad.py"
35 assert "`distutils` imported but unused" in results[0].message
38 if __name__ == "__main__":
39 mozunit.main()