How to use the pycodestyle.PROJECT_CONFIG function in pycodestyle

To help you get started, we’ve selected a few pycodestyle 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 Parallels / githooks / hooks.d / pycheck / pycodestyle / testsuite / test_shell.py View on Github external
def test_check_noarg(self):
        # issue #170: do not read stdin by default
        pycodestyle.PROJECT_CONFIG = ()
        stdout, stderr, errcode = self.pep8()
        self.assertEqual(errcode, 2)
        self.assertEqual(stderr.splitlines(),
                         ["Usage: pep8 [options] input ...", "",
                          "pep8: error: input not specified"])
        self.assertFalse(self._config_filenames)
github Parallels / githooks / hooks.d / pycheck / pycodestyle / testsuite / test_shell.py View on Github external
def tearDown(self):
        sys.argv = self._saved_argv
        sys.stdout = self._saved_stdout
        sys.stderr = self._saved_stderr
        pycodestyle.PROJECT_CONFIG = self._saved_pconfig
        pycodestyle.RawConfigParser._read = self._saved_cpread
        pycodestyle.stdin_get_value = self._saved_stdin_get_value
github Parallels / githooks / hooks.d / pycheck / pycodestyle / testsuite / test_shell.py View on Github external
def setUp(self):
        self._saved_argv = sys.argv
        self._saved_stdout = sys.stdout
        self._saved_stderr = sys.stderr
        self._saved_pconfig = pycodestyle.PROJECT_CONFIG
        self._saved_cpread = pycodestyle.RawConfigParser._read
        self._saved_stdin_get_value = pycodestyle.stdin_get_value
        self._config_filenames = []
        self.stdin = ''
        sys.argv = ['pep8']
        sys.stdout = PseudoFile()
        sys.stderr = PseudoFile()

        def fake_config_parser_read(cp, fp, filename):
            self._config_filenames.append(filename)
        pycodestyle.RawConfigParser._read = fake_config_parser_read
        pycodestyle.stdin_get_value = self.stdin_get_value
github PyCQA / pycodestyle / testsuite / test_shell.py View on Github external
def test_check_diff(self):
        pycodestyle.PROJECT_CONFIG = ()
        diff_lines = [
            "--- testsuite/E11.py	2006-06-01 08:49:50 +0500",
            "+++ testsuite/E11.py	2008-04-06 17:36:29 +0500",
            "@@ -2,4 +2,7 @@",
            " if x > 2:",
            "   print x",
            "+#: E111",
            "+if True:",
            "+     print",
            " #: E112",
            " if False:",
            "",
        ]

        self.stdin = '\n'.join(diff_lines)
        stdout, stderr, errcode = self.pycodestyle('--diff')
github PyCQA / pycodestyle / testsuite / test_shell.py View on Github external
def setUp(self):
        self._saved_argv = sys.argv
        self._saved_stdout = sys.stdout
        self._saved_stderr = sys.stderr
        self._saved_pconfig = pycodestyle.PROJECT_CONFIG
        self._saved_cpread = pycodestyle.RawConfigParser._read
        self._saved_stdin_get_value = pycodestyle.stdin_get_value
        self._config_filenames = []
        self.stdin = ''
        sys.argv = ['pycodestyle']
        sys.stdout = PseudoFile()
        sys.stderr = PseudoFile()

        def fake_config_parser_read(cp, fp, filename):
            self._config_filenames.append(filename)
        pycodestyle.RawConfigParser._read = fake_config_parser_read
        pycodestyle.stdin_get_value = self.stdin_get_value
github PyCQA / pycodestyle / testsuite / test_shell.py View on Github external
def tearDown(self):
        sys.argv = self._saved_argv
        sys.stdout = self._saved_stdout
        sys.stderr = self._saved_stderr
        pycodestyle.PROJECT_CONFIG = self._saved_pconfig
        pycodestyle.RawConfigParser._read = self._saved_cpread
        pycodestyle.stdin_get_value = self._saved_stdin_get_value
github PyCQA / flake8 / flake8 / engine.py View on Github external
import sys
import warnings

import pycodestyle as pep8

from flake8 import __version__
from flake8 import callbacks
from flake8.reporter import (multiprocessing, BaseQReport, FileQReport,
                             QueueReport)
from flake8 import util

_flake8_noqa = re.compile(r'\s*# flake8[:=]\s*noqa', re.I).search

EXTRA_EXCLUDE = ['.tox', '.eggs', '*.egg']

pep8.PROJECT_CONFIG = ('.flake8',) + pep8.PROJECT_CONFIG


def _load_entry_point(entry_point, verify_requirements):
    """Based on the version of setuptools load an entry-point correctly.

    setuptools 11.3 deprecated `require=False` in the call to EntryPoint.load.
    To load entry points correctly after that without requiring all
    dependencies be present, the proper way is to call EntryPoint.resolve.

    This function will provide backwards compatibility for older versions of
    setuptools while also ensuring we do the right thing for the future.
    """
    if hasattr(entry_point, 'resolve') and hasattr(entry_point, 'require'):
        if verify_requirements:
            entry_point.require()
        plugin = entry_point.resolve()
github PyCQA / prospector / prospector / tools / pep8 / __init__.py View on Github external
def configure(self, prospector_config, found_files):
        # figure out if we should use a pre-existing config file
        # such as setup.cfg or tox.ini
        external_config = None

        # 'none' means we ignore any external config, so just carry on
        use_config = False

        if prospector_config.use_external_config('pep8'):
            use_config = True

            paths = [os.path.join(found_files.rootpath, name) for name in PROJECT_CONFIG]
            paths.append(USER_CONFIG)
            ext_loc = prospector_config.external_config_location('pep8')
            if ext_loc is not None:
                paths = [ext_loc] + paths

            for conf_path in paths:
                if os.path.exists(conf_path) and os.path.isfile(conf_path):
                    # this file exists - but does it have pep8 config in it?
                    header = re.compile(r'\[pep8\]')
                    with open(conf_path) as conf_file:
                        if any([header.search(line) for line in conf_file.readlines()]):
                            external_config = conf_path
                            break

        # create a list of packages, but don't include packages which are
        # subpackages of others as checks will be duplicated