Difference between revisions of "Pylint"
Jump to navigation
Jump to search
(7 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
* https://pylint.org/ | * https://pylint.org/ | ||
− | + | <code>[[$HOME/.pylintrc]]</code> | |
+ | == Examples == | ||
+ | pylint your_python_code.py | ||
+ | pylint your_python_code.py | ||
+ | ************* Module your_python_code | ||
+ | your_python_code.py:58:1: W0511: TODO: move to common util (fixme) | ||
+ | your_python_code.py:130:0: C0303: Trailing whitespace (trailing-whitespace) | ||
+ | your_python_code.py:133:0: C0305: Trailing newlines (trailing-newlines) | ||
+ | your_python_code.py:1:0: [[C0114: Missing module docstring (missing-module-docstring)]] | ||
+ | your_python_code.py:7:0: E0401: Unable to import 'click' (import-error) | ||
+ | your_python_code.py:8:0: E0401: Unable to import 'pytz' (import-error) | ||
+ | your_python_code.py:60:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) | ||
+ | your_python_code.py:77:0: C0116: Missing function or method docstring (missing-function-docstring) | ||
+ | your_python_code.py:89:4: W1201: Use lazy % formatting in logging functions (logging-not-lazy) | ||
+ | your_python_code.py:97:12: R1723: Unnecessary "else" after "break" (no-else-break) | ||
+ | your_python_code.py:98:16: W1201: Use lazy % formatting in logging functions (logging-not-lazy) | ||
+ | your_python_code.py:109:8: W1201: Use lazy % formatting in logging functions (logging-not-lazy) | ||
+ | your_python_code.py:118:12: W1201: Use lazy % formatting in logging functions (logging-not-lazy) | ||
+ | your_python_code.py:125:4: [[C0103]]: Variable name "e" doesn't conform to snake_case naming style (invalid-name) | ||
+ | your_python_code.py:126:8: R1705: Unnecessary "elif" after "return" (no-else-return) | ||
+ | your_python_code.py:121:0: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return- statements) | ||
+ | your_python_code.py:132:4: E1120: No value for argument 'environment' in function call (no-value-for-parameter) | ||
+ | your_python_code.py:132:4: E1120: No value for argument 'service' in function call (no-value-for-parameter) | ||
+ | your_python_code.py:132:4: E1120: No value for argument 'restore_date' in function call (no-value-for-parameter) | ||
+ | your_python_code.py:10:0: C0411: standard import "from logging.handlers import TimedRotatingFileHandler" should be placed before "import boto3" (wrong-import-order) | ||
+ | your_python_code.py:11:0: C0411: standard import "from os import environ" should be placed before "import boto3" (wrong-import-order) | ||
+ | your_python_code.py:12:0: C0411: standard import "from pathlib import Path" should be placed before "import boto3" (wrong-import-order) | ||
+ | |||
+ | ----------------------------------- | ||
+ | Your code has been rated at 4.08/10 | ||
Line 11: | Line 40: | ||
== Related == | == Related == | ||
* [[lint]] | * [[lint]] | ||
− | * [[PYTHONPATH]] | + | * <code>[[PYTHONPATH]]</code> |
* [[Flake8]] | * [[Flake8]] | ||
+ | * [[autopep8]] | ||
+ | * [[Astroid]] | ||
== See also == | == See also == |
Latest revision as of 16:36, 25 November 2022
wikipedia:Pylint (2001)
Examples[edit]
pylint your_python_code.py pylint your_python_code.py ************* Module your_python_code your_python_code.py:58:1: W0511: TODO: move to common util (fixme) your_python_code.py:130:0: C0303: Trailing whitespace (trailing-whitespace) your_python_code.py:133:0: C0305: Trailing newlines (trailing-newlines) your_python_code.py:1:0: C0114: Missing module docstring (missing-module-docstring) your_python_code.py:7:0: E0401: Unable to import 'click' (import-error) your_python_code.py:8:0: E0401: Unable to import 'pytz' (import-error) your_python_code.py:60:9: W1514: Using open without explicitly specifying an encoding (unspecified-encoding) your_python_code.py:77:0: C0116: Missing function or method docstring (missing-function-docstring) your_python_code.py:89:4: W1201: Use lazy % formatting in logging functions (logging-not-lazy) your_python_code.py:97:12: R1723: Unnecessary "else" after "break" (no-else-break) your_python_code.py:98:16: W1201: Use lazy % formatting in logging functions (logging-not-lazy) your_python_code.py:109:8: W1201: Use lazy % formatting in logging functions (logging-not-lazy) your_python_code.py:118:12: W1201: Use lazy % formatting in logging functions (logging-not-lazy) your_python_code.py:125:4: C0103: Variable name "e" doesn't conform to snake_case naming style (invalid-name) your_python_code.py:126:8: R1705: Unnecessary "elif" after "return" (no-else-return) your_python_code.py:121:0: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return- statements) your_python_code.py:132:4: E1120: No value for argument 'environment' in function call (no-value-for-parameter) your_python_code.py:132:4: E1120: No value for argument 'service' in function call (no-value-for-parameter) your_python_code.py:132:4: E1120: No value for argument 'restore_date' in function call (no-value-for-parameter) your_python_code.py:10:0: C0411: standard import "from logging.handlers import TimedRotatingFileHandler" should be placed before "import boto3" (wrong-import-order) your_python_code.py:11:0: C0411: standard import "from os import environ" should be placed before "import boto3" (wrong-import-order) your_python_code.py:12:0: C0411: standard import "from pathlib import Path" should be placed before "import boto3" (wrong-import-order) ----------------------------------- Your code has been rated at 4.08/10
pip install pylint
pylint --help
Related[edit]
See also[edit]
pylint
,E0401
,$HOME/.pylintrc
,C0103
,C0114
,pylint --help
- Python, PIP, GIL, Flask, Django, Marshmallow,
def
, logging, Pandas, Numpy, AWS Chalice,import
,from
,tuple
,list
, Python exceptions,virtualenv
,.append
,pytz
,TZ
,print
,python3 -c
,os
, PEP, Python Institute, Methods: Dunder methods, Flake8, Python collections, Function decorators in Python, Click python library, Python module, Flower,kwargs
, Black (Python), Python list structure, Mypy,variables
, Casting,try:
, pydoc, argparse, Anaconda,pyenv, setup.py, python3 --version, python3 --help
, Data Classes, raise - Lint,
pylint
,eslint, tflint
,cfn-lint
,autopep8
,lint-staged
,autopep8 --help
, GitLab CI lint, Code climate, Black,hadolint
, KubeLinter,hlint, ansible-lint
Advertising: