diff --git a/.gitignore b/.gitignore index acde37a4..c23aa070 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.pyc src/pylorax/version.py* +*.swp +.pylint.d/ diff --git a/Makefile b/Makefile index b8c0456e..a02d3cad 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,10 @@ install: all install -m 644 docs/lorax.1 $(DESTDIR)/$(mandir)/man1 install -m 644 docs/livemedia-creator.1 $(DESTDIR)/$(mandir)/man1 +check: + @echo "*** Running pylint ***" + PYTHONPATH=$(PYTHONPATH):./src/ ./tests/pylint/runpylint.py + clean: -rm -rf build src/pylorax/version.py diff --git a/tests/pylint/runpylint.py b/tests/pylint/runpylint.py new file mode 100755 index 00000000..5fc5a994 --- /dev/null +++ b/tests/pylint/runpylint.py @@ -0,0 +1,44 @@ +#!/usr/bin/python +# +# Copyright (C) 2017 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +import sys + +from pocketlint import FalsePositive, PocketLintConfig, PocketLinter + +class LoraxLintConfig(PocketLintConfig): + def __init__(self): + PocketLintConfig.__init__(self) + + self.falsePositives = [ FalsePositive(r"No name 'version' in module 'pylorax'"), + FalsePositive(r"Module 'pylorax' has no 'version' member"), + FalsePositive(r"Instance of 'int' has no .* member"), + ] + + @property + def pylintPlugins(self): + retval = super(LoraxLintConfig, self).pylintPlugins + # Not using threads so we can skip this + retval.remove("pocketlint.checkers.environ") + # No markup used + retval.remove("pocketlint.checkers.markup") + return retval + +if __name__ == "__main__": + conf = LoraxLintConfig() + linter = PocketLinter(conf) + rc = linter.run() + sys.exit(rc)