Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save themarwhal/d5aa3f1a4783709b7657c2c4651dfc17 to your computer and use it in GitHub Desktop.
Save themarwhal/d5aa3f1a4783709b7657c2c4651dfc17 to your computer and use it in GitHub Desktop.
Flake8 outputs for lte/gateway/python
4 B001 Do not use bare `except:`, it also catches unexpected events like memory errors, interrupts, system exit, and so on. Prefer `except Exception:`. If you're sure what you're doing, be explicit and write `except BaseException:`.
1 B006 Do not use mutable data structures for argument defaults. They are created during function definition time. All calls to the function reuse this one instance of that data structure, persisting changes between them.
15 B007 Loop control variable 'i' not used within the loop body. If this is intended, start the name with an underscore.
4 B011 Do not call assert False since python -O removes these calls. Instead callers should raise AssertionError().
1 B014 Redundant exception types in `except (NotADirectoryError, ImportError, ModuleNotFoundError) as e:`. Write `except (NotADirectoryError, ImportError) as e:`, which catches exactly the same exceptions.
2 C402 Unnecessary generator - rewrite as a dict comprehension.
2 C416 Unnecessary list comprehension - rewrite using list().
1837 C812 missing trailing comma
104 C813 missing trailing comma in Python 3
20 C815 missing trailing comma in Python 3.5+
1 C818 trailing comma on bare tuple prohibited
44 C819 trailing comma prohibited
3 D100 Missing docstring in public module
579 D101 Missing docstring in public class
1750 D102 Missing docstring in public method
334 D103 Missing docstring in public function
31 D104 Missing docstring in public package
27 D105 Missing docstring in magic method
8 D106 Missing docstring in public nested class
334 D107 Missing docstring in __init__
665 D200 One-line docstring should fit on one line with quotes
108 D202 No blank lines allowed after function docstring
241 D204 1 blank line required after class docstring
1208 D205 1 blank line required between summary line and description
2 D207 Docstring is under-indented
70 D208 Docstring is over-indented
104 D209 Multi-line docstring closing quotes should be on a separate line
654 D210 No whitespaces allowed surrounding docstring text
42 D300 Use """triple double quotes"""
9 D301 Use r""" if any backslashes in a docstring
2252 D400 First line should end with a period
580 D401 First line should be in imperative mood; try rephrasing
10 D402 First line should not be the function's "signature"
114 D403 First word of the first line should be properly capitalized
10 D414 Section has no content
8 DAR002 Empty description: e (9, 9)
196 DAR003 Incorrect indentation: ~<
2064 DAR101 Missing parameter(s) in Docstring: - param_name
43 DAR102 Excess parameter(s) in Docstring: + str
34 DAR103 Parameter type mismatch: ~value: expected str but was string
7 DAR105 Parameter type malformed.: #(3, 3): type malformed
882 DAR201 Missing "Returns" in Docstring: - return
7 DAR202 Excess "Returns" in Docstring: + return
4 DAR203 Return type mismatch: ~Return: expected IPDesc but was ipaddress.ip_address
10 DAR301 Missing "Yields" in Docstring: - yield
258 DAR401 Missing exception(s) in Raises section: -r KeyError
52 DAR402 Excess exception(s) in Raises section: +r OverlappedIPBlocksError
16 E111 indentation is not a multiple of
1 E116 unexpected indentation (comment)
4 E117 over-indented
2 E121 continuation line under-indented for hanging indent
20 E122 continuation line missing indentation or outdented
4 E123 closing bracket does not match indentation of opening bracket's line
7 E124 closing bracket does not match visual indentation
6 E125 continuation line with same indent as next logical line
67 E126 continuation line over-indented for hanging indent
240 E127 continuation line over-indented for visual indent
243 E128 continuation line under-indented for visual indent
1 E129 visually indented line with same indent as next logical line
24 E131 continuation line unaligned for hanging indent
7 E201 whitespace after '('
3 E202 whitespace before ']'
6 E203 whitespace before ','
13 E211 whitespace before '('
5 E221 multiple spaces before operator
4 E222 multiple spaces after operator
40 E225 missing whitespace around operator
79 E226 missing whitespace around arithmetic operator
1 E227 missing whitespace around bitwise or shift operator
134 E231 missing whitespace after ':'
2 E241 multiple spaces after ':'
61 E251 unexpected spaces around keyword / parameter equals
48 E252 missing whitespace around parameter equals
36 E261 at least two spaces before inline comment
4 E262 inline comment should start with '# '
57 E265 block comment should start with '# '
7 E266 too many leading '#' for block comment
6 E271 multiple spaces after keyword
2 E272 multiple spaces before keyword
3 E301 expected 1 blank line, found 0
110 E302 expected 2 blank lines, found 0
39 E303 too many blank lines (2)
21 E305 expected 2 blank lines after class or function definition, found 1
38 E402 module level import not at top of file
2460 E501 line too long (81 > 79 characters)
32 E502 the backslash is redundant between brackets
4 E711 comparison to None should be 'if cond is not None:'
20 E712 comparison to False should be 'if cond is False:' or 'if not cond:'
2 E713 test for membership should be 'not in'
4 E722 do not use bare 'except'
87 E800 Found commented out code
126 F401 'magma.mobilityd.ip_descriptor.IPType' imported but unused
1 F403 'from scapy.all import *' used; unable to detect undefined names
1 F405 'TCP' may be undefined, or defined from star imports: scapy.all
1 F507 '...' % ... has 1 placeholder(s) but 2 substitution(s)
1 F523 '...'.format(...) has unused arguments at position(s): 0
4 F601 dictionary key '5G_feature_set' repeated with different values
1 F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple)
2 F811 redefinition of unused 'MagmaController' from line 19
12 F841 local variable 'nat_enabled' is assigned to but never used
598 I001 isort found an import in the wrong position
38 I003 isort expected 1 blank line in imports, found 0
44 I004 isort found an unexpected blank line in imports
848 I005 isort found an unexpected missing import
925 N400: Found backslash that is used for line breaking
9 N801 class name 'anySimpleType' should use CapWords convention
216 N802 function name 'GetParameter' should be lowercase
15 N803 argument name 'subApnPolicies' should be lowercase
32 N805 first argument of a method should be named 'self'
231 N806 variable 'MockTransport' in function should be lowercase
36 N813 camelcase 'EnodebdLogger' imported as lowercase 'logger'
2 N815 variable 'ipv6_solicitation_SERVICE_NAME' in class scope should not be mixedCase
1 N817 camelcase 'xml.etree.ElementTree' imported as acronym 'ET'
157 P101 format string does contain unindexed parameters
14 P103 other string does contain unindexed parameters
1 P301 format call provides unused index (0)
8715 Q000 Remove bad quotes
14 Q001 Remove bad quotes from multiline string
38 Q002 Remove bad quotes from docstring
6 Q003 Change outer quotes to avoid escaping inner quotes
141 RST201 Block quote ends without a blank line; unexpected unindent.
4 RST202 Bullet list ends without a blank line; unexpected unindent.
107 RST203 Definition list ends without a blank line; unexpected unindent.
2 RST204 Enumerated list ends without a blank line; unexpected unindent.
1 RST210 Inline strong start-string without end-string.
4 RST211 Blank line required after table.
11 RST213 Inline emphasis start-string without end-string.
2 RST215 Inline interpreted text or phrase reference start-string without end-string.
2 RST299 Line block ends without a blank line.
289 RST301 Unexpected indentation.
4 RST302 Malformed table.
6 RST306 Unknown target name: "baibs".
194 S101 Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
13 S104 Possible binding to all interfaces.
2 S105 Possible hardcoded password: 'Perf mgmt password'
2 S108 Probable insecure usage of temp file/directory.
1 S301 Pickle and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue.
2 S303 Use of insecure MD2, MD4, MD5, or SHA1 hash function.
4 S304 Use of insecure cipher Crypto.Cipher.ARC4.new. Replace with a known secure cipher such as AES.
15 S311 Standard pseudo-random generators are not suitable for security/cryptographic purposes.
4 S314 Using xml.etree.ElementTree.fromstring to parse untrusted XML data is known to be vulnerable to XML attacks. Replace xml.etree.ElementTree.fromstring with its defusedxml equivalent function or make sure defusedxml.defuse_stdlib() is called
1 S403 Consider possible security implications associated with pickle module.
44 S404 Consider possible security implications associated with subprocess module.
4 S405 Using ElementTree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace ElementTree with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
2 S410 Using etree to parse untrusted XML data is known to be vulnerable to XML attacks. Replace etree with the equivalent defusedxml package.
10 S413 The pyCrypto library and its module AES are no longer actively maintained and have been deprecated. Consider using pyca/cryptography library.
18 S602 subprocess call with shell=True identified, security issue.
158 S603 subprocess call - check for execution of untrusted input.
3 S605 Starting a process with a shell, possible injection detected, security issue.
61 S607 Starting a process with a partial executable path
11 W291 trailing whitespace
13 W293 blank line contains whitespace
13 W391 blank line at end of file
139 W503 line break before binary operator
60 W504 line break after binary operator
4 W605 invalid escape sequence '\.'
7 WPS100 Found wrong module name
4 WPS102 Found incorrect module name pattern
370 WPS110 Found wrong variable name: param
848 WPS111 Found too short name: b < 2
4 WPS112 Found private name pattern: __get_tr069_response_from_sm
56 WPS114 Found underscored number name pattern: match_tcp_80
31 WPS117 Found name reserved for first argument: cls
129 WPS118 Found too long name: ENCRYPTION_AND_OR_INTEGRITY_PROTECTION_ALGORITHMS_NOT_SUPPORTED > 45
13 WPS120 Found regular name with trailing underscore: out1_
8 WPS121 Found usage of a variable marked as unused: _gps_lat_cached
8 WPS122 Found all unused variables definition: _gps_lat_cached, _gps_lon_cached
6 WPS123 Found wrong unused variable name: __
29 WPS125 Found builtin shadowing: format
87 WPS201 Found module with too many imports: 14 > 12
44 WPS202 Found too many module members: 15 > 7
301 WPS204 Found overused expression: LTE_BAND_INFO[band]; used 5 > 4
572 WPS210 Found too many local variables: 6 > 5
163 WPS211 Found too many arguments: 8 > 5
15 WPS212 Found too many return statements: 7 > 5
336 WPS213 Found too many expressions: 14 > 9
179 WPS214 Found too many methods: 17 > 7
10 WPS218 Found too many `assert` statements: 7 > 5
46 WPS219 Found too deep access level: 7 > 4
182 WPS220 Found too deep nesting: 24 > 20
125 WPS221 Found line with high Jones Complexity: 17 > 14
5 WPS223 Found too many `elif` branches: 5 > 3
2 WPS225 Found too many `except` cases: 7 > 3
620 WPS226 Found string constant over-use: wait_inform > 3
161 WPS229 Found too long ``try`` body length: 3 > 1
23 WPS230 Found too many public instance attributes: 7 > 6
138 WPS231 Found function with too much cognitive complexity: 27 > 12
8 WPS232 Found module cognitive complexity that is too high: 21.0 > 8
31 WPS235 Found too many imported names from a module: 20 > 8
4 WPS236 Found too many variables used to unpack a tuple: 5 > 4
10 WPS238 Found too many raises in a function: 4 > 3
137 WPS300 Found local folder import
27 WPS301 Found dotted raw import: magma.mobilityd.ip_descriptor
2 WPS302 Found unicode string prefix: u'hello'
9 WPS304 Found partial float: 100.
144 WPS306 Found class without a base class: ParameterName
2 WPS312 Found comparison of a variable to itself
60 WPS313 Found parenthesis immediately after a keyword
37 WPS316 Found context manager with too many assignments
3965 WPS317 Found incorrect multi-line parameters
4 WPS320 Found multi-line function type annotation
52 WPS322 Found incorrect multi-line string
1586 WPS323 Found `%` string formatting
89 WPS324 Found inconsistent `return` statement
599 WPS326 Found implicit string concatenation
3 WPS327 Found useless `continue` at the end of the loop
44 WPS328 Found useless node: with
117 WPS331 Found variables that are only used for `return`: single_enodeb_config
27 WPS335 Found incorrect `for` loop iter type
795 WPS336 Found explicit string concatenation
156 WPS337 Found multiline conditions
150 WPS338 Found incorrect order of methods in a class
41 WPS339 Found number with meaningless zeros: 0x01
24 WPS341 Found wrong hex number case: 0xfffffffffffffffe
6 WPS342 Found implicit raw string: 'create IPFIX targets=\"{}\\:{}\" obs_domain_id={} obs_point_id={} '
19 WPS345 Found meaningless number operation
4 WPS347 Found vague import that may cause confusion: to_instructions
454 WPS348 Found a line that starts with a dot
14 WPS349 Found redundant subscript slice
13 WPS350 Found usable augmented assign pattern
19 WPS352 Found multiline loop
16 WPS355 Found an unnecessary blank line before a bracket
4 WPS360 Found an unnecessary use of a raw string: "(?P<remote_ip>.*)"
34 WPS361 Found an inconsistently structured comprehension
2 WPS362 Found assignment to a subscript slice
25 WPS400 Found wrong magic comment: type: logging.Logger
6 WPS404 Found complex default value
44 WPS407 Found mutable module constant
1 WPS412 Found `__init__.py` module with logic
8 WPS414 Found incorrect unpacking target
2 WPS417 Found non-unique item in hash: """5G_feature_set"""
333 WPS420 Found wrong keyword: pass
1823 WPS421 Found wrong function call: hasattr
72 WPS422 Found future import: absolute_import
1304 WPS425 Found boolean non-keyword argument: True
2 WPS426 Found `lambda` in loop's body
1 WPS427 Found unreachable code
116 WPS428 Found statement that has no effect
1 WPS429 Found multiple assign targets
116 WPS430 Found nested function: get_metric_value
12 WPS431 Found nested class: Timeout
1099 WPS432 Found magic number: 1.4
26 WPS433 Found nested import
1 WPS434 Found reassigning variable to itself: pattern
6 WPS435 Found list multiply
4 WPS436 Found protected module import: _thread
971 WPS437 Found protected attribute usage: _asdict
178 WPS440 Found block variables overlap: rule
86 WPS441 Found control variable used after block: sub_data_el
10 WPS442 Found outer scope names shadowing: status
10 WPS444 Found incorrect keyword condition
1 WPS448 Found incorrect exception order
11 WPS450 Found protected object import: _get_enb_config
15 WPS453 Found executable mismatch: shebang is present but the file is not executable
31 WPS454 Found wrong `raise` exception type: Exception
8 WPS457 Found an infinite while loop
51 WPS458 Found imports collision: magma.enodebd.tr069.models
2 WPS459 Found comparison with float or complex number
10 WPS460 Found single element destructuring
94 WPS462 Wrong multiline string usage
47 WPS463 Found a getter without a return value
5 WPS464 Found empty comment
2 WPS465 Found likely bitwise and boolean operation mixup
23 WPS501 Found `finally` in `try` block without `except`
4 WPS502 Found simplifiable `if` condition
60 WPS503 Found useless returning `else` statement
43 WPS504 Found negated condition
6 WPS505 Found nested `try` block
110 WPS507 Found useless `len()` compare
22 WPS508 Found incorrect `not` with compare usage
29 WPS510 Found `in` used with a non-set container
14 WPS514 Found implicit `in` condition
62 WPS516 Found `type()` used to compare types
22 WPS518 Found implicit `enumerate()` call
6 WPS519 Found implicit `sum()` call
1 WPS520 Found compare with falsy constant
1 WPS521 Found wrong `is` compare
2 WPS525 Found wrong `in` compare with single item container
22 WPS528 Found implicit `.items()` usage
81 WPS529 Found implicit `.get()` dict usage
10 WPS531 Found simplifiable returning `if` condition in a function
2 WPS600 Found subclassing a builtin: str
2 WPS601 Found shadowed class attribute: _trfgen_tests
158 WPS602 Found using `@staticmethod`
89 WPS604 Found incorrect node inside `class` body
7 WPS605 Found method without arguments: init
7 WPS606 Found incorrect base class
2 WPS607 Found incorrect `__slots__` syntax
115 WPS608 Found incorrect `super()` call: remove arguments
42 WPS609 Found direct magic attribute usage: __module__
4 WPS613 Found incorrect `super()` call context: incorrect name access
15 WPS615 Found unpythonic getter or setter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment