Skip to content

Draft: Resolve "enable pylint and pycodestyle on all python files in kea repo"

Closes #3287.

  • 14de3daf DO NOT MERGE temporarily switch to the candidate CI image

  • 8fc99617 DO NOT MERGE temporarily disable shellcheck

  • d3f16396 add bandit, pycodestyle and pylint CI jobs

  • d235962a fix bandit warnings

  • 696464c9 fix pycodestyle warnings

    • E111 indentation is not a multiple of 4
    • E117 over-indented
    • E125 continuation line with same indent as next logical line
    • E127 continuation line over-indented for visual indent
    • E128 continuation line under-indented for visual indent
    • E129 visually indented line with same indent as next logical line
    • E131 continuation line unaligned for hanging indent
    • E201 whitespace after '['
    • E201 whitespace after '{'
    • E202 whitespace before ')'
    • E202 whitespace before ']'
    • E202 whitespace before '}'
    • E203 whitespace before '
    • E203 whitespace before ','
    • E222 multiple spaces after operator
    • E225 missing whitespace around operator
    • E228 missing whitespace around modulo operator
    • E231 missing whitespace after ','
    • E251 unexpected spaces around keyword / parameter equals
    • E261 at least two spaces before inline comment
    • E262 inline comment should start with '# '
    • E265 block comment should start with '# '
    • E301 expected 1 blank line, found 0
    • E302 expected 2 blank lines, found 1
    • E303 too many blank lines (2)
    • E305 expected 2 blank lines after class or function definition, found 1
    • E306 expected 1 blank line before a nested definition, found 0
    • E401 multiple imports on one line
    • E402 module level import not at top of file
    • E501 line too long
    • E502 the backslash is redundant between brackets
    • E703 statement ends with a semicolon
    • E713 test for membership should be 'not in'
    • E722 do not use bare 'except'
    • E741 ambiguous variable name 'l'
    • W605 invalid escape sequence '/'
  • 76166e11 fix pylint warnings

    • C0115: Missing class docstring (missing-class-docstring)
    • C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)
    • C0201: Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
    • C0206: Consider iterating with .items() (consider-using-dict-items)
    • C0411: standard import "..." should be placed before "..." (wrong-import-order)
    • C0415: Import outside toplevel (...) (import-outside-toplevel)
    • C1802: Do not use len(SEQUENCE) without comparison to determine if a sequence is empty (use-implicit-booleaness-not-len)
    • E0001: Parsing failed: 'invalid syntax (, line 2313)' (syntax-error)
    • E0401: Unable to import '...' (import-error)
    • E0602: Undefined variable 'l' (undefined-variable)
    • R0205: Class 'VagrantEnv' inherits from object, can be safely removed from bases in python3 (useless-object-inheritance)
    • E1101: Instance of 'NSECBASE' has no 'dump_fixedpart' member (no-member)
    • E1123: Unexpected keyword argument 'capture' in method call (unexpected-keyword-arg)
    • R0902: Too many instance attributes (too-many-instance-attributes)
    • R0913: Too many arguments (too-many-arguments)
    • R0916: Too many boolean expressions in if statement (6/5) (too-many-boolean-expressions)
    • R1717: Consider using a dictionary comprehension (consider-using-dict-comprehension)
    • R1722: Consider using 'sys.exit' instead (consider-using-sys-exit)
    • R1732: Consider using 'with' for resource-allocating operations (consider-using-with)
    • R1735: Consider using '{}' instead of a call to 'dict'. (use-dict-literal)
    • W0102: Dangerous default value sys.argv[1:] (builtins.list) as argument (dangerous-default-value)
    • W0102: Dangerous default value {} as argument (dangerous-default-value)
    • W0106: Expression "[f.write('%02x' % x) for x in bin_address]" is assigned to nothing (expression-not-assigned)
    • W0107: Unnecessary pass statement (unnecessary-pass)
    • W0201: Attribute 'config' defined outside init (attribute-defined-outside-init)
    • W0404: Reimport '...' (imported line ...) (reimported)
    • W0611: Unused import ... (unused-import)
    • W0612: Unused variable '...' (unused-variable)
    • W0613: Unused argument '...' (unused-argument)
    • W0621: Redefining name '...' from outer scope (line 1471) (redefined-outer-name)
    • W0622: Redefining built-in '...' (redefined-builtin)
    • W0707: Consider explicitly re-raising using 'raise ... from ...' (raise-missing-from)
    • W0718: Catching too general exception Exception (broad-exception-caught)
    • W1202: Use lazy % formatting in logging functions (logging-format-interpolation)
    • W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation)
    • W1308: Duplicate string formatting argument 'connection_type', consider passing as named argument (duplicate-string-formatting-argument)
    • W1401: Anomalous backslash in string: '/'. String constant might be missing an r prefix. (anomalous-backslash-in-string)
    • W1406: The u prefix for strings is no longer necessary in Python >=3.0 (redundant-u-string-prefix)
    • W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
    • W4901: Deprecated module 'optparse' (deprecated-module)
    • W4904: Using deprecated class SafeConfigParser of module configparser (deprecated-class)
Edited by Andrei Pavel

Merge request reports