lorax/tests/pylint/runpylint.py
Alexander Todorov 22de8ed603 Ignore Cockpit CI files when linting
- these files are executed under Python 3 while the linter
  is Python 2 for RHEL 7 so we just ingore them
- also reverts the changes introduced to make these files Py2
  compatible, making them the same as on master branch

Related: rhbz#1698366
2019-09-13 11:27:12 +03:00

53 lines
2.0 KiB
Python
Executable File

#!/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"Module 'pylorax.api' has no 'version' member"),
FalsePositive(r"Instance of 'int' has no .* member"),
FalsePositive(r"Catching too general exception Exception"),
FalsePositive(r"^E0712.*: Catching an exception which doesn't inherit from (Base|)Exception: GError$"),
FalsePositive(r"Module 'composer' has no 'version' member"),
]
@property
def ignoreNames(self):
return { 'test' }
@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)