mirror of https://github.com/zulip/zulip.git
linter: Add lint rule banning 'import os.path'
This commit is contained in:
parent
f965a156a9
commit
928dd06cc8
|
@ -3,7 +3,7 @@ Use libraries from a virtualenv (by modifying sys.path) in production.
|
||||||
Also add Zulip's root directory to sys.path
|
Also add Zulip's root directory to sys.path
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os.path
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||||
|
|
|
@ -326,6 +326,9 @@ def build_custom_checkers(by_lang):
|
||||||
{'pattern': 'from os.path',
|
{'pattern': 'from os.path',
|
||||||
'description': "Don't use from when importing from the standard library",
|
'description': "Don't use from when importing from the standard library",
|
||||||
},
|
},
|
||||||
|
{'pattern': 'import os.path',
|
||||||
|
'description': "Use import os instead of import os.path",
|
||||||
|
},
|
||||||
]) + whitespace_rules
|
]) + whitespace_rules
|
||||||
bash_rules = [
|
bash_rules = [
|
||||||
{'pattern': '#!.*sh [-xe]',
|
{'pattern': '#!.*sh [-xe]',
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
import os
|
||||||
import optparse
|
import optparse
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
|
|
@ -11,7 +11,7 @@ import logging
|
||||||
import traceback
|
import traceback
|
||||||
from six.moves import urllib
|
from six.moves import urllib
|
||||||
import re
|
import re
|
||||||
import os.path
|
import os
|
||||||
import glob
|
import glob
|
||||||
import html
|
import html
|
||||||
import twitter
|
import twitter
|
||||||
|
|
|
@ -18,7 +18,6 @@ import base64
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import os.path
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import os.path
|
import os
|
||||||
|
|
||||||
from typing import Dict, List, Optional, TypeVar, Any, Text
|
from typing import Dict, List, Optional, TypeVar, Any, Text
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import os.path
|
import os
|
||||||
import sourcemap
|
import sourcemap
|
||||||
from six.moves import map
|
from six.moves import map
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from typing import Dict, Optional, Any, List
|
from typing import Dict, Optional, Any, List
|
||||||
import os.path
|
import os
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.template import Library, loader, engines
|
from django.template import Library, loader, engines
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.views.generic import TemplateView
|
from django.views.generic import TemplateView
|
||||||
import os.path
|
import os
|
||||||
from django.views.static import serve
|
from django.views.static import serve
|
||||||
import zerver.views.registration
|
import zerver.views.registration
|
||||||
import zerver.views.auth
|
import zerver.views.auth
|
||||||
|
|
|
@ -3,7 +3,7 @@ from django.conf.urls import url, include
|
||||||
from django.conf.urls.i18n import i18n_patterns
|
from django.conf.urls.i18n import i18n_patterns
|
||||||
from django.views.generic import TemplateView, RedirectView
|
from django.views.generic import TemplateView, RedirectView
|
||||||
from django.utils.module_loading import import_string
|
from django.utils.module_loading import import_string
|
||||||
import os.path
|
import os
|
||||||
import zerver.forms
|
import zerver.forms
|
||||||
from zproject import dev_urls
|
from zproject import dev_urls
|
||||||
from zproject.legacy_urls import legacy_urls
|
from zproject.legacy_urls import legacy_urls
|
||||||
|
|
Loading…
Reference in New Issue