global_test_linter.py 685 B

1234567891011121314151617181920
  1. # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  2. # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
  3. # Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
  4. from pylint import checkers
  5. from pylint.lint import PyLinter
  6. from pylint.testutils.reporter_for_tests import GenericTestReporter
  7. def create_test_linter() -> PyLinter:
  8. test_reporter = GenericTestReporter()
  9. linter_ = PyLinter()
  10. linter_.set_reporter(test_reporter)
  11. linter_.config.persistent = 0
  12. checkers.initialize(linter_)
  13. return linter_
  14. # Can't be renamed to a constant (easily), it breaks countless tests
  15. linter = create_test_linter()