How to use the pydocstyle.config.ConfigurationParser.DEFAULT_MATCH_DIR_RE function in pydocstyle

To help you get started, we’ve selected a few pydocstyle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github palantir / python-language-server / pyls / plugins / pydocstyle_lint.py View on Github external
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)

    # Explicitly passing a path to pydocstyle means it doesn't respect the --match flag, so do it ourselves
    filename_match_re = re.compile(settings.get('match', DEFAULT_MATCH_RE) + '$')
    if not filename_match_re.match(os.path.basename(document.path)):
github pymedphys / pymedphys / app / packages / pyodide-language-server / pyls / plugins / pydocstyle_lint.py View on Github external
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)

    # Explicitly passing a path to pydocstyle means it doesn't respect the --match flag, so do it ourselves
    filename_match_re = re.compile(settings.get("match", DEFAULT_MATCH_RE) + "$")
    if not filename_match_re.match(os.path.basename(document.path)):