Difference between revisions of "Pylint"

From wikieduonline
Jump to navigation Jump to search
 
(15 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[wikipedia:Pylint]]
+
[[wikipedia:Pylint]] (2001)
 
* https://pylint.org/
 
* https://pylint.org/
  
pip install pylint
+
<code>[[$HOME/.pylintrc]]</code>
  
  [[pylint --help]]
+
== 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
 +
 
 +
 
 +
* <code>[[pip install]] pylint</code>
 +
* <code>[[pylint --help]]</code>
  
 
== Related ==
 
== Related ==
 
* [[lint]]
 
* [[lint]]
 +
* <code>[[PYTHONPATH]]</code>
 +
* [[Flake8]]
 +
* [[autopep8]]
 +
* [[Astroid]]
  
 
== See also ==
 
== See also ==
 +
* {{pylint}}
 
* {{Python}}
 
* {{Python}}
 +
* {{lint}}
  
 
[[Category:Python]]
 
[[Category:Python]]

Latest revision as of 16:36, 25 November 2022

wikipedia:Pylint (2001)

$HOME/.pylintrc

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


Related[edit]

See also[edit]

Advertising: