| 1 |
# Copyright (c) 2019 Ultimaker B.V. |
| 2 |
# This file contains the Pylint rules used in the stardust projects. |
| 3 |
|
| 4 |
# To configure PyLint as an external tool in PyCharm, create a new External Tool with the settings: |
| 5 |
# |
| 6 |
# Name: PyLint |
| 7 |
# Program: Check with 'which pylint'. For example: ~/.local/bin/pylint |
| 8 |
# Arguments: $FileDirName$ --rcfile=.pylintrc --msg-template='{abspath}:{line}:{column}:({symbol}):{msg_id}:{msg}' |
| 9 |
# Working directory: $ContentRoot$ |
| 10 |
# Output filters: $FILE_PATH$:$LINE$:$COLUMN$:.* |
| 11 |
# |
| 12 |
# You can add a keyboard shortcut in the keymap settings. To run Pylint to a project, select the module |
| 13 |
# you want to check (e.g. cura folder) before running the external tool. |
| 14 |
# |
| 15 |
# If you find a better way to configure the external tool please edit this file. |
| 16 |
|
| 17 |
[MASTER] |
| 18 |
# List of plugins (as comma separated values of python modules names) to load, |
| 19 |
# usually to register additional checkers. |
| 20 |
load-plugins=pylint_quotes |
| 21 |
|
| 22 |
# We expect double string quotes |
| 23 |
string-quote=double-avoid-escape |
| 24 |
|
| 25 |
# When enabled, pylint would attempt to guess common misconfiguration and emit |
| 26 |
# user-friendly hints instead of false-positive error messages. |
| 27 |
suggestion-mode=yes |
| 28 |
|
| 29 |
# Add files or directories to the blacklist. They should be base names, not paths. |
| 30 |
ignore=tests |
| 31 |
|
| 32 |
[REFACTORING] |
| 33 |
# Maximum number of nested blocks for function / method body |
| 34 |
max-nested-blocks=5 |
| 35 |
|
| 36 |
[MESSAGES CONTROL] |
| 37 |
# C0326: No space allowed around keyword argument assignment |
| 38 |
# C0411: Ignore import order because the rules are different than in PyCharm, so automatic imports break lots of builds |
| 39 |
# C0412: Ignore import order because the rules are different than in PyCharm, so automatic imports break lots of builds |
| 40 |
# C0413: Ignore import order because the rules are different than in PyCharm, so automatic imports break lots of builds |
| 41 |
# R0201: Method could be a function (no-self-use) |
| 42 |
# R0401: Cyclic imports (cyclic-import) are used for typing |
| 43 |
# R0801: Unfortunately the error is triggered for a lot of similar models (duplicate-code) |
| 44 |
# R1710: Either all return statements in a function should return an expression, or none of them should. |
| 45 |
# W0221: Parameters differ from overridden method (tornado http methods have a flexible number of parameters) |
| 46 |
# W0511: Ignore warnings generated for TODOs in the code |
| 47 |
# C0111: We don't use docstring |
| 48 |
# C0303: Trailing whitespace isn't something we care about |
| 49 |
# C4001: You can put " in a string if you escape it first... |
| 50 |
disable=C0326,C0411,C0412,C0413,R0201,R0401,R0801,R1710,W0221,W0511, C0111, C0303,C4001 |
| 51 |
|
| 52 |
[FORMAT] |
| 53 |
# Maximum number of characters on a single line. |
| 54 |
max-line-length=120 |
| 55 |
|
| 56 |
# Maximum number of lines in a module. |
| 57 |
max-module-lines=500 |
| 58 |
|
| 59 |
good-names=os |
| 60 |
|
| 61 |
[BASIC] |
| 62 |
# allow modules and functions to use PascalCase |
| 63 |
module-rgx=[a-zA-Z0-9_]+$ |
| 64 |
function-rgx= |
| 65 |
## Allowed methods: |
| 66 |
# getSomething |
| 67 |
# _getSomething |
| 68 |
# __getSomething |
| 69 |
# __new__ |
| 70 |
## Disallowed: |
| 71 |
# _GET |
| 72 |
# GetSomething |
| 73 |
method-rgx=(_{,2}[a-z][A-Za-z0-9]*_{,2})$ |
| 74 |
|
| 75 |
[DESIGN] |
| 76 |
# Maximum number of arguments for function / method. |
| 77 |
max-args=7 |
| 78 |
|
| 79 |
# Maximum number of attributes for a class (see R0902). |
| 80 |
max-attributes=8 |
| 81 |
|
| 82 |
# Maximum number of boolean expressions in an if statement. |
| 83 |
max-bool-expr=5 |
| 84 |
|
| 85 |
# Maximum number of branch for function / method body. |
| 86 |
max-branches=12 |
| 87 |
|
| 88 |
# Maximum number of locals for function / method body. |
| 89 |
max-locals=15 |
| 90 |
|
| 91 |
# Maximum number of parents for a class (see R0901). |
| 92 |
max-parents=7 |
| 93 |
|
| 94 |
# Maximum number of public methods for a class (see R0904). |
| 95 |
max-public-methods=20 |
| 96 |
|
| 97 |
# Maximum number of return / yield for function / method body. |
| 98 |
max-returns=6 |
| 99 |
|
| 100 |
# Maximum number of statements in function / method body. |
| 101 |
max-statements=50 |
| 102 |
|
| 103 |
# Minimum number of public methods for a class (R0903). |
| 104 |
# We set this to 0 because our models and fields do not have methods. |
| 105 |
min-public-methods=0 |
| 106 |
|
| 107 |
ignored-argument-names=arg|args|kwargs|_ |
| 108 |
|
| 109 |
[CLASSES] |
| 110 |
defining-attr-methods=__init__,__new__,setUp,initialize |
| 111 |
|
| 112 |
[TYPECHECK] |
| 113 |
ignored-classes=NotImplemented |
| 114 |
|
| 115 |
[VARIABLES] |
| 116 |
dummy-variables-rgx=_+[a-z0-9_]{2,30} |