Skip to contentSkip to conversation

scripts: Add oe-pylint

PATCH In review Richard Purdie 1 participant 2 messages Mar 6, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: Add oe-pylint

Add an oe-pylint wrapper around pylint3 to run static analysis on our python codebase. For now display errors and exclude common warnings which are not applicable to our codebase.

The aim is to start generating this report on the autobuilder and to improve our score over time.

---
 scripts/oe-pylint | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100755 scripts/oe-pylint
scripts/oe-pylint new file +11 -0
new file mode 100755
index 00000000000..74ff4b884de
@@ -0,0 +1,11 @@
+#!/bin/bash
+#
+# Run the pylint3 against our common python module spaces and print a report of potential issues
+#
+this_dir=$(dirname $(readlink -f $0))
+ERRORS="-E"
+IGNORELIST="$ERRORS -d logging-too-many-args -d missing-docstring -d line-too-long -d invalid-name"
+PYTHONPATH=$this_dir/../bitbake/lib/ pylint3 $IGNORELIST bb
+PYTHONPATH=$this_dir/../bitbake/lib/:$this_dir/../meta/lib pylint3 $IGNORELIST -d undefined-variable oe
+PYTHONPATH=$this_dir/../bitbake/lib/:$this_dir/../meta/lib pylint3  $IGNORELIST oeqa
+PYTHONPATH=$this_dir/../bitbake/lib/:$this_dir/../meta/lib:$this_dir/lib pylint3 $IGNORELIST -d undefined-variable argparse_oe buildstats  devtool recipetool scriptpath testcasemgmt build_perf checklayer resulttool  scriptutils wic
\ No newline at end of file
Signature · 1 line
2.20.1
#1 lore raw
Quoted 10 lines · Richard Purdie

Add an oe-pylint wrapper around pylint3 to run static analysis on our python
codebase. For now display errors and exclude common warnings which are not
applicable to our codebase.

The aim is to start generating this report on the autobuilder and to improve our score over time.

The output of this is saved off as part of the autobuilder test result output, e.g.:

https://autobuilder.yocto.io/pub/non-release/20190306-14/testresults/oe-selftest/pylint.log

If anyone has some time and wants to help out cleaning things up to get better results, this would be a great and comparatively low learning curve way to get started with helping with the project!

Right now we save errors only, ultimately we may be able to clean up warnings too.

Cheers,

Richard