From 928540fa273743986356846537ba2e2eb3e974ff Mon Sep 17 00:00:00 2001
From: Rafael Guterres Jeffman <rjeffman@redhat.com>
Date: Tue, 31 Aug 2021 19:45:12 -0300
Subject: [PATCH] pylint: Upgrade to version 2.10.2.

This PR sets pylint to version 2.10.2 in all linter actions, and
fixes code in plugins so that this version new checks are either
satisfied or ignored if needed.
---
 .github/workflows/lint.yml                     | 2 +-
 .pre-commit-config.yaml                        | 2 +-
 plugins/module_utils/ansible_freeipa_module.py | 2 +-
 plugins/modules/ipaautomountlocation.py        | 7 +++----
 requirements-dev.txt                           | 1 +
 setup.cfg                                      | 3 +++
 6 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index a8e56b87..80400482 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -73,5 +73,5 @@ jobs:
           python-version: "3.x"
       - name: Run pylint
         run: |
-            pip install pylint==2.8.2
+            pip install pylint==2.10.2
             pylint plugins --disable=import-error
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index c4705358..9ad47baa 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -22,7 +22,7 @@ repos:
   hooks:
   - id: pydocstyle
 - repo: https://github.com/pycqa/pylint
-  rev: v2.9.5
+  rev: v2.10.2
   hooks:
   - id: pylint
     args:
diff --git a/plugins/module_utils/ansible_freeipa_module.py b/plugins/module_utils/ansible_freeipa_module.py
index 4b3884a9..e8d62e28 100644
--- a/plugins/module_utils/ansible_freeipa_module.py
+++ b/plugins/module_utils/ansible_freeipa_module.py
@@ -104,7 +104,7 @@ else:
     try:
         from collections.abc import Mapping  # noqa
     except ImportError:
-        from collections import Mapping  # noqa
+        from collections import Mapping  # pylint: disable=deprecated-class
 
     if six.PY3:
         unicode = str
diff --git a/plugins/modules/ipaautomountlocation.py b/plugins/modules/ipaautomountlocation.py
index c88578b2..44748c0e 100644
--- a/plugins/modules/ipaautomountlocation.py
+++ b/plugins/modules/ipaautomountlocation.py
@@ -78,15 +78,14 @@ class AutomountLocation(FreeIPABaseModule):
     ipa_param_mapping = {}
 
     def get_location(self, location):
-        response = dict()
         try:
             response = self.api_command("automountlocation_show",
                                         location,
                                         {})
         except ipalib_errors.NotFound:
-            pass
-
-        return response.get("result", None)
+            return None
+        else:
+            return response.get("result", None)
 
     def check_ipa_params(self):
         if len(self.ipa_params.name) == 0:
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 4384655f..b1e4d0a7 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -2,3 +2,4 @@
 ipdb
 pre-commit
 flake8-bugbear
+pylint==2.10.2
diff --git a/setup.cfg b/setup.cfg
index a470e2f9..f4462241 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -34,6 +34,9 @@ ignore = D1,D212,D203
 
 [pylint.MASTER]
 disable =
+    unspecified-encoding, # open() does not provide `encoding` in Python2
+    use-maxsplit-arg,
+    redundant-u-string-prefix,
     c-extension-no-member,
     missing-module-docstring,
     missing-class-docstring,
-- 
GitLab