From 4648fbfaddd2ea0b8ab38fa0c4b50a38da49aa7b Mon Sep 17 00:00:00 2001 From: Lukas Puehringer Date: Thu, 11 Mar 2021 17:53:08 +0100 Subject: [PATCH] Update tuf/api/pylintrc for new code The updated pylintrc is based on the Google Python Style Guide pylint configuration at https://google.github.io/styleguide/pylintrc with the following differences: - We don't list defaults which are applied anyway. - We don't configure checks that seem unrelated to the code style guide. - We don't disable any checks that are not in conflict with the current code or code style guide. This has the advantage of a minimal configuration file which should be easy to maintain and extend as required, e.g. if conflicting code is added, or linting time becomes too long, due to unnecessary checks. Signed-off-by: Lukas Puehringer --- tuf/api/pylintrc | 50 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/tuf/api/pylintrc b/tuf/api/pylintrc index badef761..e2e2d9cf 100644 --- a/tuf/api/pylintrc +++ b/tuf/api/pylintrc @@ -1,12 +1,50 @@ -[MESSAGE_CONTROL] -disable=fixme +# Minimal pylint configuration file for Secure Systems Lab Python Style Guide: +# https://github.com/secure-systems-lab/code-style-guidelines +# +# Based on Google Python Style Guide pylintrc and pylint defaults: +# https://google.github.io/styleguide/pylintrc +# http://pylint.pycqa.org/en/latest/technical_reference/features.html + +[MESSAGES CONTROL] +# Disable the message, report, category or checker with the given id(s). +# NOTE: To keep this config as short as possible we only disable checks that +# are currently in conflict with our code. If new code displeases the linter +# (for good reasons) consider updating this config file, or disable checks with +# 'pylint: disable=XYZ' comments. +disable=fixme, + too-few-public-methods, + too-many-arguments, [BASIC] -good-names=e +good-names=i,j,k,v,e,f,fn,fp,_type +# Regexes for allowed names are copied from the Google pylintrc +# NOTE: Pylint captures regex name groups such as 'snake_case' or 'camel_case'. +# If there are multiple groups it enfoces the prevalent naming style inside +# each modules. Names in the exempt capturing group are ignored. +function-rgx=^(?:(?PsetUp|tearDown|setUpModule|tearDownModule)|(?P_?[A-Z][a-zA-Z0-9]*)|(?P_?[a-z][a-z0-9_]*))$ +method-rgx=(?x)^(?:(?P_[a-z0-9_]+__|runTest|setUp|tearDown|setUpTestCase|tearDownTestCase|setupSelf|tearDownClass|setUpClass|(test|assert)_*[A-Z0-9][a-zA-Z0-9_]*|next)|(?P_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P_{0,2}[a-z][a-z0-9_]*))$ +argument-rgx=^[a-z][a-z0-9_]*$ +attr-rgx=^_{0,2}[a-z][a-z0-9_]*$ +class-attribute-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$ +class-rgx=^_?[A-Z][a-zA-Z0-9]*$ +const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$ +inlinevar-rgx=^[a-z][a-z0-9_]*$ +module-rgx=^(_?[a-z][a-z0-9_]*|__init__)$ +no-docstring-rgx=(__.*__|main|test.*|.*test|.*Test)$ +variable-rgx=^[a-z][a-z0-9_]*$ +docstring-min-length=10 [FORMAT] +ignore-long-lines=(?x)( + ^\s*(\#\ )??$| + ^\s*(from\s+\S+\s+)?import\s+.+$) indent-string=" " -max-line-length=79 +indent-after-paren=4 +max-line-length=80 +single-line-if-stmt=yes -[DESIGN] -min-public-methods=0 +[LOGGING] +logging-format-style: new + +[MISCELLANEOUS] +notes=TODO