Skip to content

Commit

Permalink
pylint: Manually create pylint cache directory
Browse files Browse the repository at this point in the history
david-yz-liu committed Sep 23, 2021
1 parent e96d5b3 commit 40d0dfa
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Bug fixes

- Fix HTML report to display file even when no errors are found.
- Fix pylint cache directory creation (backport of change from pylint 2.11)

## [2.1.0] - 2021-09-16

10 changes: 10 additions & 0 deletions python_ta/__init__.py
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@
import webbrowser
from typing import Generator

import pylint.config
import pylint.lint
import pylint.utils
from astroid import MANAGER, modutils
@@ -72,6 +73,15 @@ def _check(module_name="", level="all", local_config="", output=None):
`local_config` is a dict of config options or string (config file name).
`output` is an absolute or relative path to capture pyta data output. Default std out.
"""
# Manually create pylint cache directory if it doesn't exist.
# This is a backport of https://github.com/PyCQA/pylint/pull/4988,
# and should be removed once we update to pylint 2.11.
if not os.path.exists(pylint.config.PYLINT_HOME):
try:
os.makedirs(pylint.config.PYLINT_HOME)
except OSError:
pass

linter = reset_linter(config=local_config)
current_reporter = linter.reporter
current_reporter.set_output(output)

0 comments on commit 40d0dfa

Please sign in to comment.