From 4f25101c179f3ece2d64a893dc07a00c288c4e57 Mon Sep 17 00:00:00 2001 From: Masaki UENO Date: Tue, 30 Nov 2021 18:35:30 +0900 Subject: [PATCH] Update Pylint config file for development Current Tacker repository contains .pylintrc, which is a configuration file of Pylint [1]. [1] https://pylint.org/ However, it is not maintained for 8 years ago, so it contains some out-of-date configurations for current Pylint version. This patch removes those out-of-date configurations, and introduces some useful configurations for IDE integration. Signed-off-by: Masaki UENO Change-Id: I9e09a6befef2ef22e09f1a0b0ed2a75bf173a4f6 --- .pylintrc | 20 ++++++++--- .../contributor/development.environment.rst | 33 +++++++++++++++++++ 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/.pylintrc b/.pylintrc index 87fbcd3b3..ed434860c 100644 --- a/.pylintrc +++ b/.pylintrc @@ -2,15 +2,17 @@ [MASTER] # Add to the black list. It should be a base name, not a # path. You may set this option multiple times. -ignore=test +ignore=tests + +init-hook="import sys; sys.path.append('.')" [Messages Control] -# NOTE(justinsb): We might want to have a 2nd strict pylintrc in future -# C0111: Don't require docstrings on every method +# The below section disables specified items. +# C0116: Don't require docstrings on every method +# C0411: Import order is not considered (but will be checked by hacking in tox) # W0511: TODOs in code comments are fine. -# W0142: *args and **kwargs are fine. # W0622: Redefining id is fine. -disable=C0111,W0511,W0142,W0622 +disable=C0116,C0411,W0511,W0622 [Basic] # Variable names can be 1 to 31 characters long, with lowercase and underscores @@ -40,3 +42,11 @@ max-args=6 # you should avoid to define new builtins when possible. # _ is used by our localization additional-builtins=_ + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME, + XXX, + TODO, + NOTE diff --git a/doc/source/contributor/development.environment.rst b/doc/source/contributor/development.environment.rst index 7dea8e10d..de357e28b 100644 --- a/doc/source/contributor/development.environment.rst +++ b/doc/source/contributor/development.environment.rst @@ -46,3 +46,36 @@ Grab the code:: .. include:: ../../../TESTING.rst + +Linting +------- + +Tacker project supports the configuration of `Pylint`_, a lint tool for +Python code. + +You can get Pylint CLI tool from PyPI: + +.. code-block:: console + + $ pip install pylint + +Then you can check your code with Pylint like: + +.. code-block:: console + + $ pylint path/to/code + +If you want to check the entire Tacker code: + +.. code-block:: console + + $ pylint tacker/ + +``.pylintrc`` in Tacker repository root is a configuration file of Pylint. + +If you want to check Pylint messages, detailed CLI configurations +and configurations in ``.pylintrc``, please refer to +`Pylint official reference`_. + +.. _Pylint: https://pylint.org/ +.. _Pylint official reference: https://pylint.pycqa.org/en/latest/