lint: Require python3 shebangs.
This commit was originally from @fredfishgames, but it needed a big rebase due to use letting it sit too long. Also, we decided not to have shebangs at the top of test files.
This commit is contained in:
parent
28687f18ca
commit
fd069dff82
|
@ -166,7 +166,11 @@ def build_custom_checkers(by_lang):
|
|||
# and comments which should be rewritten to avoid use of "python2", "python3", etc.
|
||||
{'pattern': 'python[23]',
|
||||
'exclude': set(['tools/provision']),
|
||||
'include_only': set(['zulip/', 'tools/', 'zulip_botserver/']),
|
||||
'description': 'Explicit python invocations should not include a version'},
|
||||
{'pattern': '#!/usr/bin/env python$',
|
||||
'include_only': set(['zulip_bots/']),
|
||||
'description': 'Python shebangs must be python3'},
|
||||
{'pattern': '(^|\s)open\s*\(',
|
||||
'description': 'open() should not be used in Zulip\'s bots. Use functions'
|
||||
' provided by the bots framework to access the filesystem.',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from zulip_bots.test_lib import StubBotTestCase
|
||||
|
||||
class TestChessBot(StubBotTestCase):
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from zulip_bots.test_lib import StubBotTestCase
|
||||
|
||||
class TestConverterBot(StubBotTestCase):
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from zulip_bots.test_lib import StubBotTestCase
|
||||
from unittest.mock import patch
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from zulip_bots.test_lib import StubBotTestCase, read_bot_fixture_data
|
||||
|
||||
from contextlib import contextmanager
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from zulip_bots.test_lib import StubBotTestCase
|
||||
|
||||
class TestEncryptBot(StubBotTestCase):
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from unittest.mock import patch
|
||||
from requests.exceptions import HTTPError, ConnectionError
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from zulip_bots.test_lib import (
|
||||
StubBotHandler,
|
||||
StubBotTestCase,
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from zulip_bots.test_lib import StubBotTestCase
|
||||
|
||||
from unittest.mock import patch
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from zulip_bots.test_lib import StubBotTestCase
|
||||
|
||||
class TestHelpBot(StubBotTestCase):
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from zulip_bots.test_lib import StubBotTestCase
|
||||
|
||||
from typing import Any
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
import mock
|
||||
|
||||
from zulip_bots.test_lib import (
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
from zulip_bots.test_lib import StubBotTestCase
|
||||
|
||||
class TestTictactoeBot(StubBotTestCase):
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from zulip_bots.test_lib import StubBotTestCase
|
||||
from zulip_bots.request_test_lib import mock_request_exception
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import mock
|
||||
from mock import MagicMock, patch
|
||||
from zulip_bots.test_lib import StubBotTestCase
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from unittest.mock import patch
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
from __future__ import absolute_import
|
||||
|
||||
import importlib
|
||||
|
|
Loading…
Reference in a new issue