Pylint is not able to handle IPA errors objects, because attributes are added into objects dynamically, and pylint 1.5 reports them as no-member errors.

https://fedorahosted.org/freeipa/ticket/5615

Patch attached.
From 2e70066d10e8d15c3989a8c1c7583cf83c471f38 Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Wed, 24 Feb 2016 18:48:29 +0100
Subject: [PATCH] Pylint: add missing attributes of errors to definitions

Attributes are added to IPA error objects dynamicaly and pylint is not
able to handle it itself. Add missing attributes to definitions in
pylint plugin.

https://fedorahosted.org/freeipa/ticket/5615
---
 pylint_plugins.py | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/pylint_plugins.py b/pylint_plugins.py
index f64c426fdc6344d718322b092f106fa00a98b470..c3042f4a4597bef748a786ca0664760f67ebeb6b 100644
--- a/pylint_plugins.py
+++ b/pylint_plugins.py
@@ -96,6 +96,39 @@ ipa_class_members = {
         'startup_traceback',
         'verbose'
     ] + LOGGING_ATTRS,
+    'ipalib.errors.ACIError': [
+        'info',
+    ],
+    'ipalib.errors.ConversionError': [
+        'error',
+    ],
+    'ipalib.errors.DatabaseError': [
+        'desc',
+    ],
+    'ipalib.errors.NetworkError': [
+        'error',
+    ],
+    'ipalib.errors.NotFound': [
+        'reason',
+    ],
+    'ipalib.errors.PublicError': [
+        'msg',
+        'strerror',
+    ],
+    'ipalib.errors.SingleMatchExpected': [
+        'found',
+    ],
+    'ipalib.errors.SkipPluginModule': [
+        'reason',
+    ],
+    'ipalib.errors.ValidationError': [
+        'error',
+    ],
+    'ipalib.messages.PublicMessage': [
+        'msg',
+        'strerror',
+        'type',
+    ],
     'ipalib.parameters.Param': [
         'cli_name',
         'cli_short_name',
@@ -162,6 +195,9 @@ ipa_class_members = {
     'ipalib.session.AuthManager': LOGGING_ATTRS,
     'ipalib.session.SessionAuthManager': LOGGING_ATTRS,
     'ipalib.session.SessionManager': LOGGING_ATTRS,
+    'ipalib.util.ForwarderValidationError': [
+        'msg',
+    ],
     'ipaserver.install.ldapupdate.LDAPUpdate': LOGGING_ATTRS,
     'ipaserver.rpcserver.KerberosSession': [
         fake_api,
-- 
2.5.0

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to