Files
zulip/tools/linter_lib/pyflakes.py
sahil839 b13bfa09c5 message: Make zero invalid value for message_content_delete_limit_seconds.
We make zero invalid value for message_content_delete_limit_seconds and
for handling the case of "Allow to delete message any time", the API-level
value of message_content_delete_limit_seconds is "anytime" and "None"
as the DB-level value. We also use these values for message retention
setting, so it helps maintain consistency.
2021-09-30 14:45:39 -07:00

35 lines
1.4 KiB
Python

import argparse
from typing import List
from zulint.linters import run_pyflakes
def check_pyflakes(files: List[str], options: argparse.Namespace) -> bool:
suppress_patterns = [
("scripts/lib/pythonrc.py", "imported but unused"),
# LDAP imports are necessary for docker-zulip.
("zproject/prod_settings_template.py", "imported but unused"),
# Our ipython startup pythonrc file intentionally imports *
("scripts/lib/pythonrc.py", " import *' used; unable to detect undefined names"),
(
"zerver/views/realm.py",
"local variable 'message_retention_days' is assigned to but never used",
),
(
"zerver/views/realm.py",
"local variable 'message_content_delete_limit_seconds' is assigned to but never used",
),
("settings.py", "settings import *' used; unable to detect undefined names"),
(
"settings.py",
"'from .prod_settings_template import *' used; unable to detect undefined names",
),
("settings.py", "settings.*' imported but unused"),
("settings.py", "'.prod_settings_template.*' imported but unused"),
# Sphinx adds `tags` specially to the environment when running conf.py.
("docs/conf.py", "undefined name 'tags'"),
]
if options.full:
suppress_patterns = []
return run_pyflakes(files, options, suppress_patterns)