Add pylint support to Makefile
This requires pylint and python-pocketlint from EPEL7 to work. runpylint.py copied from upstream lorax.
This commit is contained in:
parent
7f56ad4ce1
commit
2dc38b7a77
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
src/pylorax/version.py*
|
src/pylorax/version.py*
|
||||||
|
*.swp
|
||||||
|
.pylint.d/
|
||||||
|
4
Makefile
4
Makefile
@ -21,6 +21,10 @@ install: all
|
|||||||
install -m 644 docs/lorax.1 $(DESTDIR)/$(mandir)/man1
|
install -m 644 docs/lorax.1 $(DESTDIR)/$(mandir)/man1
|
||||||
install -m 644 docs/livemedia-creator.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:
|
clean:
|
||||||
-rm -rf build src/pylorax/version.py
|
-rm -rf build src/pylorax/version.py
|
||||||
|
|
||||||
|
44
tests/pylint/runpylint.py
Executable file
44
tests/pylint/runpylint.py
Executable file
@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
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)
|
Loading…
Reference in New Issue
Block a user