2017-10-04 19:11:10 +00:00
|
|
|
#!/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"),
|
2018-08-21 17:15:57 +00:00
|
|
|
FalsePositive(r"Module 'pylorax.api' has no 'version' member"),
|
2017-10-04 19:11:10 +00:00
|
|
|
FalsePositive(r"Instance of 'int' has no .* member"),
|
2017-10-12 14:45:50 +00:00
|
|
|
FalsePositive(r"Catching too general exception Exception"),
|
2017-12-21 17:44:59 +00:00
|
|
|
FalsePositive(r"^E0712.*: Catching an exception which doesn't inherit from (Base|)Exception: GError$"),
|
2018-03-10 00:42:42 +00:00
|
|
|
FalsePositive(r"Module 'composer' has no 'version' member"),
|
2017-10-04 19:11:10 +00:00
|
|
|
]
|
|
|
|
|
2019-08-05 12:04:06 +00:00
|
|
|
@property
|
|
|
|
def ignoreNames(self):
|
|
|
|
return { 'test' }
|
|
|
|
|
2017-10-04 19:11:10 +00:00
|
|
|
@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)
|