zulip/tools/linter_lib/pyflakes.py

31 lines
1.0 KiB
Python
Raw Normal View History

2017-06-05 16:43:16 +02:00
from __future__ import print_function
from __future__ import absolute_import
import argparse
2017-07-06 06:52:03 +02:00
from typing import List
2017-06-05 16:43:16 +02:00
from zulint.linters import run_pyflakes
def check_pyflakes(files, options):
# type: (List[str], argparse.Namespace) -> bool
suppress_patterns = [
(b"scripts/lib/pythonrc.py", b"imported but unused"),
(b'', b"'scripts.lib.setup_path_on_import' imported but unused"),
# Our ipython startup pythonrc file intentionally imports *
(b"scripts/lib/pythonrc.py",
b" import *' used; unable to detect undefined names"),
# Special dev_settings.py import
(b'', b"from .prod_settings_template import *"),
(b"settings.py", b"settings import *' used; unable to detect undefined names"),
(b"settings.py", b"may be undefined, or defined from star imports"),
# Sphinx adds `tags` specially to the environment when running conf.py.
(b"docs/conf.py", b"undefined name 'tags'"),
]
return run_pyflakes(files, options, suppress_patterns)