From ab64467f335530fb20407a5c213b1fc96cdf523b Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Tue, 31 Jan 2023 00:05:15 +0100 Subject: [PATCH] Run pylint during package build again Commit ae74f71a1e9d4be043162b19d23f2d44c964c771 removed the pylint unit test saying that unit tests are not needed to just run flake8 or pylint. Since pylint is useful, add it back, but this time call it directly and not embed it into a unit test. Signed-off-by: Benjamin Drung --- ubuntutools/test/pylint.conf => .pylintrc | 23 +++++++++++++---------- debian/control | 1 + debian/copyright | 3 ++- run-linters | 3 +++ 4 files changed, 19 insertions(+), 11 deletions(-) rename ubuntutools/test/pylint.conf => .pylintrc (75%) diff --git a/ubuntutools/test/pylint.conf b/.pylintrc similarity index 75% rename from ubuntutools/test/pylint.conf rename to .pylintrc index e1d2732..3125d9b 100644 --- a/ubuntutools/test/pylint.conf +++ b/.pylintrc @@ -1,5 +1,10 @@ [MASTER] +# 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-allow-list=apt_pkg + # Pickle collected data for later comparisons. persistent=no @@ -22,7 +27,7 @@ confidence=HIGH # --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" -disable=locally-disabled +disable=fixme,locally-disabled,missing-docstring [REPORTS] @@ -31,14 +36,6 @@ disable=locally-disabled reports=no -[TYPECHECK] - -# List of classes names for which member attributes should not be checked -# (useful for classes with attributes dynamically set). -# lpapicache classes, urlparse -ignored-classes=Launchpad,BaseWrapper,PersonTeam,Distribution,Consumer,Credentials,ParseResult,apt_pkg,apt_pkg.Dependency,apt_pkg.BaseDependency - - [FORMAT] # Maximum number of characters on a single line. @@ -52,4 +49,10 @@ indent-string=' ' [BASIC] # Allow variables called e, f, lp -good-names=i,j,k,ex,Run,_,e,f,lp +good-names=i,j,k,ex,Run,_,e,f,lp,me,to + + +[IMPORTS] + +# Force import order to recognize a module as part of a third party library. +known-third-party=debian diff --git a/debian/control b/debian/control index ecf96c3..ab015b1 100644 --- a/debian/control +++ b/debian/control @@ -17,6 +17,7 @@ Build-Depends: flake8, isort , lsb-release, + pylint , python3-all, python3-apt, python3-debian, diff --git a/debian/copyright b/debian/copyright index d13345a..b06595e 100644 --- a/debian/copyright +++ b/debian/copyright @@ -176,7 +176,8 @@ Files: doc/pull-debian-debdiff.1 ubuntutools/update_maintainer.py ubuntutools/version.py update-maintainer -Copyright: 2009-2011, Benjamin Drung + .pylintrc +Copyright: 2009-2023, Benjamin Drung 2010, Evan Broder 2008, Siegfried-Angel Gevatter Pujals 2010-2011, Stefano Rivera diff --git a/run-linters b/run-linters index 47fd1af..2da36df 100755 --- a/run-linters +++ b/run-linters @@ -14,3 +14,6 @@ isort --check-only --diff . echo "Running flake8..." flake8 --max-line-length=99 --ignore=E203,W503 . $PYTHON_SCRIPTS + +echo "Running pylint..." +pylint $(find * -name '*.py') $PYTHON_SCRIPTS