Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:check_python_code [2014/07/29 08:37] – pylint format changed and some simple information sagarchalisehowtos:check_python_code [2018/08/07 15:51] (current) – add new way of using pylint craynic
Line 4: Line 4:
  
  
-===== Using pep8 and pylint =====+===== Using pycodestyle and pylint =====
  
-The following steps enable you to check your code with Pylint, Pyflakes and Pep8.+The following steps enable you to check your code with Pylint, Pyflakes and Pycodestyle (formerly known as pep8).
  
  
Line 18: Line 18:
 #!/bin/sh #!/bin/sh
  
-echo "======  pep8  ======" +echo "======  pycodestyle  ======" 
-pep8 $1+pycodestyle $1
 echo "======  pyflakes  ======" echo "======  pyflakes  ======"
 pyflakes $1 pyflakes $1
 echo "======  pylint  ======" echo "======  pylint  ======"
 pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" --reports=n $1 pylint --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" --reports=n $1
 +pylint -f parseable -r n $1
 </file> </file>
  
Line 35: Line 36:
 </code> </code>
  
- + 
 ==== Setup Geany ==== ==== Setup Geany ====
  
Line 52: Line 54:
  
  
 +==== Using pylint on Windows ====
 +
 +Gösta Ljungdahl mentioned, the following little batch script is useful to use pylint on Windows with Geany:
 +
 +<code dos pylint.bat>
 +@echo off
 +set configfile=c:\cygwin64\home\gostal\.pylintrc
 +echo "======  pylint  ======"
 +c:\Anaconda\envs\python3\Scripts\pylint.exe --rcfile=%configfile% --msg-template="{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}" %1
 +</code>
 +
 +Of course, you need to tweak the paths to the config file and pylint.exe.
 +The rest should be similar to the explainations above.
  
  
Line 86: Line 101:
  
  
-{{tag>howto python pep8 pyflakes python flake8}}+{{tag>howto python pep8 pycodestyle pyflakes python flake8}}
  
Print/export