Skip to content

Commit 33c469f

Browse files
committed
Updated .pylintrc file. Minor standards fixes to some Python files.
1 parent 85094b6 commit 33c469f

File tree

5 files changed

+75
-29
lines changed

5 files changed

+75
-29
lines changed

.pylintrc

+62-22
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,64 @@
1+
[MASTER]
2+
# List of files/directories to blacklist (not paths)
3+
ignore=
4+
5+
16
[MESSAGES CONTROL]
27
# Definitions of codes disabled
3-
# C0330 - Wrong %s indentation
4-
# E0611 - No name %r in module %r
5-
# E1101 - %s %r has no %r member
6-
# F0401 - Unable to import %s
7-
# R0902 - Too many instance attributes
8-
# R0903 - Too few public methods
9-
# R0904 - Too many public methods
10-
# R0911 - Too many return statements
11-
# R0912 - Too many branches
12-
# R0913 - Too many arguments
13-
# R0914 - Too many local variables
14-
# R0915 - Too many statements
15-
# R0921 - Abstract class not referenced
16-
# W0141 - Used builtin function %r
17-
# W0142 - Used * or ** magic
18-
# W0201 - Attribute %r defined outside __init__
19-
# W0212 - Access to a protected member %s of a client class
20-
# W0231 - __init__ method from base class %r is not called
21-
# W0232 - Class has no __init__ method
22-
# W0702 - No exception type(s) specified
23-
24-
disable=C0330, E0611, E1101, F0401, R0902, R0903, R0904, R0911, R0912, R0913, R0914, R0915, R0921, W0141, W0142, W0201, W0212, W0231, W0232, W0702
8+
# For a list of error codes, see:
9+
# http://pylint-messages.wikidot.com/all-codes
10+
# disable=C0103, E0203, R0911, R0915, R0921, W0142, W0201, W0232, W0613
11+
disable=C0330, E0611, E1101, F0401, R0902, R0903, R0904, R0912, R0913, R0914, W0212, W0702
12+
13+
14+
[BASIC]
15+
# List of bad builtin function names
16+
bad-functions=eval,exec,__import__
17+
18+
# Module name regex
19+
module-rgx=[a-z_][a-z0-9_]{2,30}$
20+
21+
# Constant name regex
22+
const-rgx=(([A-Z_][A-Z0-9_]*)|([a-z_][a-z0-9_]*)|(__.*__))$
23+
24+
# Class name regex
25+
class-rgx=[A-Z_][a-zA-Z0-9]+$
26+
27+
# Function name regex
28+
function-rgx=[a-z_][a-z0-9_]{2,30}$
29+
30+
# Method name regex
31+
method-rgx=[a-z_][a-z0-9_]{2,30}$
32+
33+
# Attribute name regex
34+
attr-rgx=[a-z_][a-z0-9_]{2,30}$
35+
36+
# Argument name regex
37+
argument-rgx=[a-z_][a-z0-9_]{2,30}$
38+
39+
# Variable name regex
40+
variable-rgx=[a-z_][a-z0-9_]{2,30}$
41+
42+
# Class attribute name regex
43+
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{1,40}|(__.*__))$
44+
45+
# In-line variable name regex
46+
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
47+
48+
# Variable names that are always ok
49+
good-names=x,y,z,a,b,c,d,e,f,g,h,x1,y1,z1,x2,y2,z2,p1,p2,source-python,fget,create_global_pointers_from_file,create_function_typedefs_from_file,MuzzleFlashStyle,WeaponID,WeaponType,WeaponSlot,WeaponInfo
50+
51+
52+
[REPORTS]
53+
# The message output template
54+
msg-template={msg_id}:{line:3d},{column:2d}: {msg} ({symbol})
55+
56+
57+
[SIMILARITIES]
58+
ignore-imports=yes
59+
ignore-comments=yes
60+
ignore-docstrings=yes
61+
62+
63+
[VARIABLES]
64+
dummy-variables-rgx=game_event|args|kwargs|ptr

addons/source-python/packages/source-python/auth/manager.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
# =============================================================================
66
# >> IMPORTS
77
# =============================================================================
8+
# Python Imports
9+
# Importlib
10+
from importlib import import_module
11+
812
# Source.Python imports
913
# Auth
1014
from auth import auth_logger
@@ -66,8 +70,7 @@ def load_auth(self, provider):
6670
return
6771

6872
# Import the provider's module
69-
module = __import__(
70-
'auth.providers.{0}'.format(provider), fromlist=[''])
73+
module = import_module('auth.providers.{0}'.format(provider))
7174

7275
# Loop through all objects in the module
7376
for module_object in dir(module):

addons/source-python/packages/source-python/entities/entity.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ def spawn(self):
164164
def _obj(cls, ptr):
165165
"""Return an entity instance of the given pointer."""
166166
return cls(index_from_pointer(ptr))
167-
167+
168168
@property
169169
def _size(self):
170170
"""Return the entity's size."""
171171
return self.factory.size
172-
172+
173173
@property
174174
def factory(self):
175175
"""Return the entity's factory."""

addons/source-python/packages/source-python/net_channel.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
# >> CLASSES
3838
# =============================================================================
3939
class NetFlow(IntEnum):
40+
41+
"""Network Channel Enum class."""
42+
4043
IN_OUT = FLOW_IN_OUT
4144
INCOMING = FLOW_INCOMING
42-
OUTGOING = FLOW_OUTGOING
45+
OUTGOING = FLOW_OUTGOING

checker.bat

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ set SPPACKAGEDIR="%CD%"/addons/source-python/packages/source-python/
2525
echo ============================
2626
echo.
2727

28-
python -m pep8 --count --benchmark --ignore=E402 %SPPACKAGEDIR%
28+
python -m pep8 --count --benchmark %SPPACKAGEDIR%
2929

3030
echo.
3131
echo.
@@ -52,7 +52,7 @@ set SPPACKAGEDIR="%CD%"/addons/source-python/packages/source-python/
5252
echo =====================
5353
echo.
5454

55-
python -m pylint --rcfile "%CD%"/.pylintrc %SPPACKAGEDIR% --const-rgx="(([A-Z_][A-Z0-9_]*)|([a-z_][a-z0-9_]*)|(__.*__))$" --msg-template="{msg_id}:{line:3d},{column:2d}: {msg} ({symbol})"
55+
python -m pylint --rcfile "%CD%"/.pylintrc %SPPACKAGEDIR%
5656

5757
GOTO checkagain
5858

0 commit comments

Comments
 (0)