From 7e588057fd54ea36cfba3170f1b107461c0bf9ee Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 21:09:02 +0100 Subject: Add new py3 specific pylint warnings to disabled --- .pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index 3fdcbaa8..994ddf62 100644 --- a/.pylintrc +++ b/.pylintrc @@ -13,7 +13,7 @@ max-branches=16 [FORMAT] max-line-length = 99 enable=no-absolute-import,old-division -disable=cyclic-import,duplicate-code,fixme,import-outside-toplevel,locally-disabled,locally-enabled,missing-docstring,no-else-break,no-else-continue,no-else-raise,no-else-return,redefined-variable-type,stop-iteration-return,useless-object-inheritance +disable=cyclic-import,duplicate-code,fixme,import-outside-toplevel,locally-disabled,locally-enabled,missing-docstring,no-else-break,no-else-continue,no-else-raise,no-else-return,raise-missing-from,redefined-variable-type,stop-iteration-return,super-with-arguments,useless-object-inheritance [TYPECHECK] ignored-classes=ranger.core.actions.Actions -- cgit 1.4.1-2-gfad0 From d323678ec06693ed15319f7dc883c9da96722965 Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 21:09:57 +0100 Subject: Unalign code because bad-whitspace was removed --- ranger/config/commands.py | 31 +++++++++++++++---------------- ranger/container/settings.py | 10 ++++------ ranger/gui/color.py | 36 ++++++++++++++++++------------------ 3 files changed, 37 insertions(+), 40 deletions(-) diff --git a/ranger/config/commands.py b/ranger/config/commands.py index b7b02e73..9031e7a2 100755 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1465,22 +1465,21 @@ class scout(Command): Multiple flags can be combined. For example, ":scout -gpt" would create a :filter-like command using globbing. """ - # pylint: disable=bad-whitespace - AUTO_OPEN = 'a' - OPEN_ON_ENTER = 'e' - FILTER = 'f' - SM_GLOB = 'g' - IGNORE_CASE = 'i' - KEEP_OPEN = 'k' - SM_LETTERSKIP = 'l' - MARK = 'm' - UNMARK = 'M' - PERM_FILTER = 'p' - SM_REGEX = 'r' - SMART_CASE = 's' - AS_YOU_TYPE = 't' - INVERT = 'v' - # pylint: enable=bad-whitespace + + AUTO_OPEN = "a" + OPEN_ON_ENTER = "e" + FILTER = "f" + SM_GLOB = "g" + IGNORE_CASE = "i" + KEEP_OPEN = "k" + SM_LETTERSKIP = "l" + MARK = "m" + UNMARK = "M" + PERM_FILTER = "p" + SM_REGEX = "r" + SMART_CASE = "s" + AS_YOU_TYPE = "t" + INVERT = "v" def __init__(self, *args, **kwargs): super(scout, self).__init__(*args, **kwargs) diff --git a/ranger/container/settings.py b/ranger/container/settings.py index 7549325a..677ea3b8 100644 --- a/ranger/container/settings.py +++ b/ranger/container/settings.py @@ -14,13 +14,11 @@ from ranger.gui.colorscheme import _colorscheme_name_to_class # Use these priority constants to trigger events at specific points in time # during processing of the signals "setopt" and "setopt." -# pylint: disable=bad-whitespace -SIGNAL_PRIORITY_RAW = 2.0 # signal.value will be raw -SIGNAL_PRIORITY_SANITIZE = 1.0 # (Internal) post-processing signal.value -SIGNAL_PRIORITY_BETWEEN = 0.6 # sanitized signal.value, old fm.settings.XYZ -SIGNAL_PRIORITY_SYNC = 0.2 # (Internal) updating fm.settings.XYZ +SIGNAL_PRIORITY_RAW = 2.0 # signal.value will be raw +SIGNAL_PRIORITY_SANITIZE = 1.0 # (Internal) post-processing signal.value +SIGNAL_PRIORITY_BETWEEN = 0.6 # sanitized signal.value, old fm.settings.XYZ +SIGNAL_PRIORITY_SYNC = 0.2 # (Internal) updating fm.settings.XYZ SIGNAL_PRIORITY_AFTER_SYNC = 0.1 # after fm.settings.XYZ was updated -# pylint: enable=bad-whitespace ALLOWED_SETTINGS = { diff --git a/ranger/gui/color.py b/ranger/gui/color.py index 8f6439c7..81d8b44b 100644 --- a/ranger/gui/color.py +++ b/ranger/gui/color.py @@ -49,27 +49,27 @@ def get_color(fg, bg): return COLOR_PAIRS[key] -# pylint: disable=invalid-name,bad-whitespace -black = curses.COLOR_BLACK -blue = curses.COLOR_BLUE -cyan = curses.COLOR_CYAN -green = curses.COLOR_GREEN -magenta = curses.COLOR_MAGENTA -red = curses.COLOR_RED -white = curses.COLOR_WHITE -yellow = curses.COLOR_YELLOW -default = -1 - -normal = curses.A_NORMAL -bold = curses.A_BOLD -blink = curses.A_BLINK -reverse = curses.A_REVERSE -underline = curses.A_UNDERLINE -invisible = curses.A_INVIS +# pylint: disable=invalid-name +black = curses.COLOR_BLACK +blue = curses.COLOR_BLUE +cyan = curses.COLOR_CYAN +green = curses.COLOR_GREEN +magenta = curses.COLOR_MAGENTA +red = curses.COLOR_RED +white = curses.COLOR_WHITE +yellow = curses.COLOR_YELLOW +default = -1 + +normal = curses.A_NORMAL +bold = curses.A_BOLD +blink = curses.A_BLINK +reverse = curses.A_REVERSE +underline = curses.A_UNDERLINE +invisible = curses.A_INVIS dim = curses.A_DIM default_colors = (default, default, normal) -# pylint: enable=invalid-name,bad-whitespace +# pylint: enable=invalid-name curses.setupterm() # Adding BRIGHT to a color achieves what `bold` was used for. -- cgit 1.4.1-2-gfad0 From 6572e37c5f9526ad0f2a41c2f654a3cdf31db112 Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 21:10:57 +0100 Subject: Shortcut py2 incompatible pytest tests Three of our pytest tests aren't compatible with python 2 by returning early from these testcases and always making them pass, we avoid false negatives in CI results. --- tests/pylint/test_py2_compat.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/pylint/test_py2_compat.py b/tests/pylint/test_py2_compat.py index a5d2e284..08c8de31 100644 --- a/tests/pylint/test_py2_compat.py +++ b/tests/pylint/test_py2_compat.py @@ -5,6 +5,8 @@ import py2_compat import astroid import pylint.testutils +from sys import version_info +PY2 = version_info[0] < 3 class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase): CHECKER_CLASS = py2_compat.Py2CompatibilityChecker @@ -42,6 +44,9 @@ class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase): self.checker.visit_classdef(from_new) def test_print_without_import(self): + if PY2: + return + print_function_call = astroid.extract_node(""" print("Print function call without importing print_function") """) @@ -73,6 +78,9 @@ class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase): self.checker.visit_call(nested_print_function_call) def test_print_late_import(self): + if PY2: + return + early_print_function_call = astroid.extract_node(""" print("Nested print with import in scope") #@ def f(): @@ -91,6 +99,9 @@ class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase): self.checker.visit_call(early_print_function_call) def test_implicit_format_spec(self): + if PY2: + return + implicit_format_spec = astroid.extract_node(""" "{}".format("implicit") #@ """) -- cgit 1.4.1-2-gfad0 From 94e823c17cf408827551efd8e3ce9ae77f865519 Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 22:41:53 +0100 Subject: Drop py3 specific pylint for ranger/config --- ranger/config/.pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/config/.pylintrc b/ranger/config/.pylintrc index cc79f97c..316bf189 100644 --- a/ranger/config/.pylintrc +++ b/ranger/config/.pylintrc @@ -5,4 +5,4 @@ class-rgx=[a-z][a-z0-9_]{1,30}$ [FORMAT] max-line-length = 99 max-module-lines=3000 -disable=duplicate-code,fixme,import-outside-toplevel,locally-disabled,locally-enabled,missing-docstring,no-else-return +disable=duplicate-code,fixme,import-outside-toplevel,locally-disabled,locally-enabled,missing-docstring,no-else-return,super-with-arguments -- cgit 1.4.1-2-gfad0 From 4984fafed9018f80a2af03ecd8862fd449e2a87c Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 11 Nov 2020 22:46:29 +0100 Subject: Fix test_py2_compat formatting --- tests/pylint/test_py2_compat.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/pylint/test_py2_compat.py b/tests/pylint/test_py2_compat.py index 08c8de31..bd1ace65 100644 --- a/tests/pylint/test_py2_compat.py +++ b/tests/pylint/test_py2_compat.py @@ -8,6 +8,7 @@ import pylint.testutils from sys import version_info PY2 = version_info[0] < 3 + class TestPy2CompatibilityChecker(pylint.testutils.CheckerTestCase): CHECKER_CLASS = py2_compat.Py2CompatibilityChecker -- cgit 1.4.1-2-gfad0 >173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242