Python pycodestyle.register_check() Examples

The following are 7 code examples of pycodestyle.register_check(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pycodestyle , or try the search function .
Example #1
Source File: test_hacking.py    From os-win with Apache License 2.0 6 votes vote down vote up
def _run_check(self, code, checker, filename=None):
        # We are patching pycodestyle (pep8) so that only the check under test
        # is actually installed.
        mock_checks = {'physical_line': {}, 'logical_line': {}, 'tree': {}}
        with mock.patch('pycodestyle._checks', mock_checks):
            pycodestyle.register_check(checker)

            lines = textwrap.dedent(code).strip().splitlines(True)

            checker = pycodestyle.Checker(filename=filename, lines=lines)
            # NOTE(sdague): the standard reporter has printing to stdout
            # as a normal part of check_all, which bleeds through to the
            # test output stream in an unhelpful way. This blocks that
            # printing.
            with mock.patch('pycodestyle.StandardReport.get_file_results'):
                checker.check_all()
            checker.report._deferred_print.sort()
            return checker.report._deferred_print 
Example #2
Source File: test_hacking.py    From zun with Apache License 2.0 5 votes vote down vote up
def _run_check(self, code, checker, filename=None):
        pycodestyle.register_check(checker)

        lines = textwrap.dedent(code).strip().splitlines(True)

        checker = pycodestyle.Checker(filename=filename, lines=lines)
        checker.check_all()
        checker.report._deferred_print.sort()
        return checker.report._deferred_print 
Example #3
Source File: test_hacking.py    From magnum with Apache License 2.0 5 votes vote down vote up
def _run_check(self, code, checker, filename=None):
        pycodestyle.register_check(checker)

        lines = textwrap.dedent(code).strip().splitlines(True)

        checker = pycodestyle.Checker(filename=filename, lines=lines)
        checker.check_all()
        checker.report._deferred_print.sort()
        return checker.report._deferred_print 
Example #4
Source File: test_hacking.py    From manila with Apache License 2.0 5 votes vote down vote up
def _run_check(self, code, checker, filename=None):
        pycodestyle.register_check(checker)

        lines = textwrap.dedent(code).strip().splitlines(True)

        checker = pycodestyle.Checker(filename=filename, lines=lines)
        checker.check_all()
        checker.report._deferred_print.sort()
        return checker.report._deferred_print 
Example #5
Source File: test_hacking.py    From masakari with Apache License 2.0 5 votes vote down vote up
def _run_check(self, code, checker, filename=None):
        pycodestyle.register_check(checker)

        lines = textwrap.dedent(code).lstrip().splitlines(True)

        checker = pycodestyle.Checker(filename=filename, lines=lines)
        checker.check_all()
        checker.report._deferred_print.sort()
        return checker.report._deferred_print 
Example #6
Source File: test_hacking.py    From senlin with Apache License 2.0 5 votes vote down vote up
def _run_check(self, code, checker, filename=None):
        pycodestyle.register_check(checker)

        lines = textwrap.dedent(code).strip().splitlines(True)

        checker = pycodestyle.Checker(filename=filename, lines=lines)
        checker.check_all()
        checker.report._deferred_print.sort()
        return checker.report._deferred_print 
Example #7
Source File: test_hacking.py    From cyborg with Apache License 2.0 5 votes vote down vote up
def _run_check(self, code, checker, filename=None):
        pycodestyle.register_check(checker)

        lines = textwrap.dedent(code).strip().splitlines(True)

        checker = pycodestyle.Checker(filename=filename, lines=lines)
        checker.check_all()
        checker.report._deferred_print.sort()
        return checker.report._deferred_print