mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-02 19:56:52 +00:00
Add option 'doctests' to run Pyflakes checks on doctests too; issue #138
This commit is contained in:
parent
876309ad97
commit
5770b171d5
2 changed files with 8 additions and 1 deletions
|
|
@ -4,6 +4,7 @@ CHANGES
|
|||
2.1.1 - unreleased
|
||||
------------------
|
||||
|
||||
- New option ``doctests`` to run Pyflakes checks on doctests too
|
||||
- Fix Git and Mercurial hooks, issues #88 and #133
|
||||
- Fix crashes with Python 3.4 by upgrading dependencies
|
||||
- Fix traceback when running tests with Python 2.6
|
||||
|
|
|
|||
|
|
@ -38,16 +38,22 @@ class FlakesChecker(pyflakes.checker.Checker):
|
|||
name = 'pyflakes'
|
||||
version = pyflakes.__version__
|
||||
|
||||
def __init__(self, tree, filename):
|
||||
super(FlakesChecker, self).__init__(tree, filename, withDoctest=self.withDoctest)
|
||||
|
||||
@classmethod
|
||||
def add_options(cls, parser):
|
||||
parser.add_option('--builtins',
|
||||
help="define more built-ins, comma separated")
|
||||
parser.config_options.append('builtins')
|
||||
parser.add_option('--doctests', default=False, action='store_true',
|
||||
help="check syntax of the doctests")
|
||||
parser.config_options.extend(['builtins', 'doctests'])
|
||||
|
||||
@classmethod
|
||||
def parse_options(cls, options):
|
||||
if options.builtins:
|
||||
cls.builtIns = cls.builtIns.union(options.builtins.split(','))
|
||||
cls.withDoctest = options.doctests
|
||||
|
||||
def run(self):
|
||||
for m in self.messages:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue