Improve documentation about the use of pylint
Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
This commit is contained in:
parent
a19714aa30
commit
7a0a1f38a6
|
@ -43,20 +43,32 @@ please try to not forget.
|
||||||
|
|
||||||
## Code Conventions
|
## Code Conventions
|
||||||
|
|
||||||
The Python code uses 2-space indents (instead of the usual 4-space
|
|
||||||
indents). Do not use tabs. It is currently Python 2.7; please don't
|
|
||||||
make it hard to convert to Python 3 when that eventually happens.
|
|
||||||
|
|
||||||
To make the program easy to install everywhere, the main executable
|
To make the program easy to install everywhere, the main executable
|
||||||
is exactly one self-contained file. That involves some compromises,
|
is exactly one self-contained file. That involves some compromises,
|
||||||
but for now, please keep it that way.
|
but for now, please keep it that way.
|
||||||
|
|
||||||
We aspire to eventually comply with
|
We generally use the code conventions of
|
||||||
[PEP 8](https://www.python.org/dev/peps/pep-0008/) other than the
|
[PEP 8](https://www.python.org/dev/peps/pep-0008/).
|
||||||
indentation size. In practice the code doesn't actually conform to that,
|
The Python code uses 4-space indents (we used to use 2-space indents).
|
||||||
but patches to improve that are generally welcome.
|
Do not use tabs. In some cases the code doesn't yet comply;
|
||||||
|
patches to improve that are often welcome.
|
||||||
|
|
||||||
|
The code is currently Python 2, and is only tested on
|
||||||
|
the Python 2.7 series. Please don't make it hard to convert
|
||||||
|
to Python 3 when that eventually happens.
|
||||||
|
|
||||||
|
WE use "pylint" to check for style and other problems.
|
||||||
|
This is configured by the included "pylintrc" file.
|
||||||
|
We intentionally disable some checks as being "less important",
|
||||||
|
for example, the current code has many lines longer than 80 characters.
|
||||||
|
That said, patches to make lines fit in 80 characters are welcome.
|
||||||
|
|
||||||
|
We require that the pylint results for contributions be at least 9.5/10 as
|
||||||
|
configured with the provided "pylintrc" file, without any errors ("E").
|
||||||
|
Better is better. You can run "make pylint" to run this check.
|
||||||
|
The current version *does* cause some pylint reports
|
||||||
|
(patches to fix those are welcome!).
|
||||||
|
|
||||||
We're starting to use "pylint" to check for style and other problems.
|
|
||||||
An easy way to install pylint is to use pip.
|
An easy way to install pylint is to use pip.
|
||||||
Most python installs have pip, but if yours does not
|
Most python installs have pip, but if yours does not
|
||||||
(e.g., Cygwin), install pip with:
|
(e.g., Cygwin), install pip with:
|
||||||
|
|
3
README
3
README
|
@ -12,7 +12,7 @@ For more information, see:
|
||||||
|
|
||||||
Flawfinder is designed for use on Unix/Linux/POSIX systems
|
Flawfinder is designed for use on Unix/Linux/POSIX systems
|
||||||
(including Cygwin, Linux-based systems, MacOS, and *BSDs) as a
|
(including Cygwin, Linux-based systems, MacOS, and *BSDs) as a
|
||||||
command line tool. It requires Python 2 (version 2.5 or later).
|
command line tool. It requires Python 2 (version 2.7 or later).
|
||||||
|
|
||||||
You can typically install flawfinder from its source code by doing this:
|
You can typically install flawfinder from its source code by doing this:
|
||||||
tar xvzf FILENAME.tar.gz # Uncompress distribution file
|
tar xvzf FILENAME.tar.gz # Uncompress distribution file
|
||||||
|
@ -45,4 +45,3 @@ and other oddities that more sophisticated tools have trouble with.
|
||||||
|
|
||||||
Flawfinder is released under the GNU GPL license version 2 or later (GPL-2.0+).
|
Flawfinder is released under the GNU GPL license version 2 or later (GPL-2.0+).
|
||||||
See the COPYING file for license information.
|
See the COPYING file for license information.
|
||||||
|
|
||||||
|
|
16
flawfinder
16
flawfinder
|
@ -35,22 +35,18 @@
|
||||||
# The Python developers did a *terrible* job when they transitioned
|
# The Python developers did a *terrible* job when they transitioned
|
||||||
# to Python version 3, as I have documented elsewhere. What's more,
|
# to Python version 3, as I have documented elsewhere. What's more,
|
||||||
# many mechanisms that do exist do not come natively with Python 2, or
|
# many mechanisms that do exist do not come natively with Python 2, or
|
||||||
# require version 2.6 or later (yet older versions are still in use).
|
# required version 2.6 or later even though older versions were still in use.
|
||||||
# For example, this requires Python version 2.6:
|
|
||||||
# from __future__ import print_function
|
|
||||||
# As a result, many Python programs (including this one) do not use Python 3.
|
# As a result, many Python programs (including this one) do not use Python 3.
|
||||||
# The solution used here is to gradually transition the Python code
|
# The solution used here is to gradually transition the Python code but
|
||||||
# to Python 2 code that works across 2.2 through 2.7. A preference is
|
# stay at Python 2. A preference is
|
||||||
# given to code constructs that would ALSO work in version 3.X, but
|
# given to code constructs that would ALSO work in version 3.X, but
|
||||||
# only if they would *already* work in Python 2, and only if they don't
|
# only if they would *already* work in Python 2, and only if they don't
|
||||||
# make the code too complicated.
|
# make the code too complicated.
|
||||||
|
|
||||||
# The plan is to eventually switch this code so that it runs unchanged
|
# The plan is to eventually switch this code so that it runs unchanged
|
||||||
# on both 2.X and 3.X, but that is hard to support if the version number
|
# on both 2.X and 3.X. At this point, Python 2.7 has been around for
|
||||||
# is less than 2.6, so we won't do that at this time. Instead, we'll
|
# many years, so we don't worry about supporting versions of Python older
|
||||||
# wait until versions lower than 2.6 are a distant memory, and then
|
# than Python 2.7.
|
||||||
# start in that direction. Hopefully by then the developers of Python
|
|
||||||
# will begin to make it easy to transition to newer versions of Python.
|
|
||||||
|
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
import functools
|
import functools
|
||||||
|
|
6
makefile
6
makefile
|
@ -187,9 +187,11 @@ cwe: cwe.c
|
||||||
show-cwes: cwe
|
show-cwes: cwe
|
||||||
./cwe < flawfinder | sort -u -V
|
./cwe < flawfinder | sort -u -V
|
||||||
|
|
||||||
|
pylint:
|
||||||
|
pylint flawfinder
|
||||||
|
|
||||||
.PHONY: install clean test check profile test-is-correct rpm uninstall distribute my-install show-cwes
|
.PHONY: install clean test check profile test-is-correct rpm \
|
||||||
|
uninstall distribute my-install show-cwes pylint
|
||||||
|
|
||||||
# When I switch to using "DistUtils", I may need to move the MANIFEST.in
|
# When I switch to using "DistUtils", I may need to move the MANIFEST.in
|
||||||
# file into a subdirectory (named flawfinder-versionnumber).
|
# file into a subdirectory (named flawfinder-versionnumber).
|
||||||
|
|
Loading…
Reference in New Issue