Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def runtest(self):
pydocstyle.utils.log.setLevel(logging.WARN) # TODO: follow that of pytest
# https://github.com/PyCQA/pydocstyle/blob/4.0.1/src/pydocstyle/cli.py#L42-L45
for filename, checked_codes, ignore_decorators in self.parser.get_files_to_check():
errors = [str(error) for error in pydocstyle.check((str(self.fspath),), select=checked_codes,
ignore_decorators=ignore_decorators)]
if errors:
raise PyDocStyleError('\n'.join(errors))
elif hasattr(self.config, 'cache'):
# update cache
# http://pythonhosted.org/pytest-cache/api.html
cache = self.config.cache.get(self.CACHE_KEY, {})
cache[str(self.fspath)] = self.fspath.mtime()
self.config.cache.set(self.CACHE_KEY, cache)
# Copyright 2017 Palantir Technologies, Inc.
import contextlib
import logging
import os
import re
import sys
import pydocstyle
from pyls import hookimpl, lsp
log = logging.getLogger(__name__)
# PyDocstyle is a little verbose in debug message
pydocstyle_logger = logging.getLogger(pydocstyle.utils.__name__)
pydocstyle_logger.setLevel(logging.INFO)
DEFAULT_MATCH_RE = pydocstyle.config.ConfigurationParser.DEFAULT_MATCH_RE
DEFAULT_MATCH_DIR_RE = pydocstyle.config.ConfigurationParser.DEFAULT_MATCH_DIR_RE
@hookimpl
def pyls_settings():
# Default pydocstyle to disabled
return {"plugins": {"pydocstyle": {"enabled": False}}}
@hookimpl
def pyls_lint(config, document):
settings = config.plugin_settings("pydocstyle")
log.debug("Got pydocstyle settings: %s", settings)
# Copyright 2017 Palantir Technologies, Inc.
import contextlib
import logging
import os
import re
import sys
import pydocstyle
from pyls import hookimpl, lsp
log = logging.getLogger(__name__)
# PyDocstyle is a little verbose in debug message
pydocstyle_logger = logging.getLogger(pydocstyle.utils.__name__)
pydocstyle_logger.setLevel(logging.INFO)
DEFAULT_MATCH_RE = pydocstyle.config.ConfigurationParser.DEFAULT_MATCH_RE
DEFAULT_MATCH_DIR_RE = pydocstyle.config.ConfigurationParser.DEFAULT_MATCH_DIR_RE
@hookimpl
def pyls_settings():
# Default pydocstyle to disabled
return {'plugins': {'pydocstyle': {'enabled': False}}}
@hookimpl
def pyls_lint(config, document):
settings = config.plugin_settings('pydocstyle')
log.debug("Got pydocstyle settings: %s", settings)