Re: [devel] [PATCH 1/1] pyosaf: Create a pylint makefile target for pyosaf V2 [#2636]
Hi Nguyen, ok, I'll change to output format text, it seems to work for all pylint versions. /Thanks HansN On 10/24/2017 10:44 AM, Nguyen Luu wrote: Hi Hans, I have one comment inline marked with [Nguyen]. Thanks, Nguyen On 10/23/2017 7:40 PM, Hans Nordeback wrote: --- Makefile.am | 9 +- python/pylintrc | 381 2 files changed, 389 insertions(+), 1 deletion(-) create mode 100644 python/pylintrc diff --git a/Makefile.am b/Makefile.am index a7548d274..f9ba87b35 100644 --- a/Makefile.am +++ b/Makefile.am @@ -429,7 +429,14 @@ checkpatch: perl "$$builddir/bin/checkpatch.pl" --no-tree --file --ignore SPLIT_STRING --summary-file $$(cat "$$builddir/checkpatch_files.txt") 1>&2; \ true -.PHONY: cppcheck.xml cppcheck cpplint shellcheck checkpatch +pylint: + @srcdir=$$(cd $(top_srcdir); pwd; cd - > /dev/null); \ + cd "$$srcdir/python"; find . -name '*.py' | xargs pylint --rcfile=pylintrc --output-format=html > pylint.html; \ [Nguyen] The HTML reporter (--output-format=html) has been removed since pylint 1.7 in favor of the JSON reporter. So the above --output-format option would produce error when run with pylint version >= 1.7. Could you check and reconsider the output format? + true + @echo "The pylint result can be found in the file python/pylint.html" + @echo "Use the follwing command to view it: firefox python/pylint.html" + +.PHONY: cppcheck.xml cppcheck cpplint shellcheck checkpatch pylint clean-local: -rm -f $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz diff --git a/python/pylintrc b/python/pylintrc new file mode 100644 index 0..c4d2e222d --- /dev/null +++ b/python/pylintrc @@ -0,0 +1,381 @@ +[MASTER] + +# Specify a configuration file. +#rcfile= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Profiled execution. +# option profile is obsolete and it is slated for removal in Pylint 1.6. +# profile=no + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS + +# Pickle collected data for later comparisons. +persistent=yes + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + +# Use multiple processes to speed up Pylint. +jobs=1 + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code +extension-pkg-whitelist= + +# Allow optimization of some AST trees. This will activate a peephole AST +# optimizer, which will apply various small optimizations. For instance, it can +# be used to obtain the result of joining multiple strings with the addition +# operator. Joining a lot of strings can lead to a maximum recursion error in +# Pylint and this flag can prevent that. It has one side effect, the resulting +# AST will be different than the one from reality. +optimize-ast=no + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED +confidence= + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time. See also the "--disable" option for examples. +#enable= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once).You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use"--disable=all --enable=classes +# --disable=W" +# +# Added "W0105": pointless-string-statement +# Added "W0511": Used when a warning note as FIXME or XXX is detected. +# Added "W0511": Used when a warning note as FIXME or XXX is detected. +#disable=W0511,W0105,E1608,W1627,E1601,E1603,E1602,E1605,E1604,E1607,E1606,W1621,W1620,W1623,W1622,W1625,W1624,W1609,#W1608,W1607,W1606,W1605,W1604,W1603,W1602,W1601,W1639,W1640,I0021,W1638,I0020,W1618,W1619,W1630,W1626,W1637,W1634,W1#635,W1610,W1611,W1612,W1613,W1614,W1615,W1616,W1617,W1632,W1633,W0704,W1628,W1629,W1636 + + +[REPORTS] + +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html. You can also give a reporter class, eg +# mypackage.mym
Re: [devel] [PATCH 1/1] pyosaf: Create a pylint makefile target for pyosaf V2 [#2636]
Hi Hans, I have one comment inline marked with [Nguyen]. Thanks, Nguyen On 10/23/2017 7:40 PM, Hans Nordeback wrote: --- Makefile.am | 9 +- python/pylintrc | 381 2 files changed, 389 insertions(+), 1 deletion(-) create mode 100644 python/pylintrc diff --git a/Makefile.am b/Makefile.am index a7548d274..f9ba87b35 100644 --- a/Makefile.am +++ b/Makefile.am @@ -429,7 +429,14 @@ checkpatch: perl "$$builddir/bin/checkpatch.pl" --no-tree --file --ignore SPLIT_STRING --summary-file $$(cat "$$builddir/checkpatch_files.txt") 1>&2; \ true -.PHONY: cppcheck.xml cppcheck cpplint shellcheck checkpatch +pylint: + @srcdir=$$(cd $(top_srcdir); pwd; cd - > /dev/null); \ + cd "$$srcdir/python"; find . -name '*.py' | xargs pylint --rcfile=pylintrc --output-format=html > pylint.html; \ [Nguyen] The HTML reporter (--output-format=html) has been removed since pylint 1.7 in favor of the JSON reporter. So the above --output-format option would produce error when run with pylint version >= 1.7. Could you check and reconsider the output format? + true + @echo "The pylint result can be found in the file python/pylint.html" + @echo "Use the follwing command to view it: firefox python/pylint.html" + +.PHONY: cppcheck.xml cppcheck cpplint shellcheck checkpatch pylint clean-local: -rm -f $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz diff --git a/python/pylintrc b/python/pylintrc new file mode 100644 index 0..c4d2e222d --- /dev/null +++ b/python/pylintrc @@ -0,0 +1,381 @@ +[MASTER] + +# Specify a configuration file. +#rcfile= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Profiled execution. +# option profile is obsolete and it is slated for removal in Pylint 1.6. +# profile=no + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS + +# Pickle collected data for later comparisons. +persistent=yes + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + +# Use multiple processes to speed up Pylint. +jobs=1 + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code +extension-pkg-whitelist= + +# Allow optimization of some AST trees. This will activate a peephole AST +# optimizer, which will apply various small optimizations. For instance, it can +# be used to obtain the result of joining multiple strings with the addition +# operator. Joining a lot of strings can lead to a maximum recursion error in +# Pylint and this flag can prevent that. It has one side effect, the resulting +# AST will be different than the one from reality. +optimize-ast=no + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED +confidence= + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time. See also the "--disable" option for examples. +#enable= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once).You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use"--disable=all --enable=classes +# --disable=W" +# +# Added "W0105": pointless-string-statement +# Added "W0511": Used when a warning note as FIXME or XXX is detected. +# Added "W0511": Used when a warning note as FIXME or XXX is detected. +#disable=W0511,W0105,E1608,W1627,E1601,E1603,E1602,E1605,E1604,E1607,E1606,W1621,W1620,W1623,W1622,W1625,W1624,W1609,#W1608,W1607,W1606,W1605,W1604,W1603,W1602,W1601,W1639,W1640,I0021,W1638,I0020,W1618,W1619,W1630,W1626,W1637,W1634,W1#635,W1610,W1611,W1612,W1613,W1614,W1615,W1616,W1617,W1632,W1633,W0704,W1628,W1629,W1636 + + +[REPORTS] + +# Set the output format. Available formats are text, parseable, colorized, msvs +# (visual studio) and html. You can also give a reporter class, eg +# mypackage.mymodule.MyReporterClass. +# output-format=text + +# Put messages in a separate file for each module / package specified on the +# command line instead of p