Skip to content

Commit

Permalink
Report pylint useless suppressions (#243)
Browse files Browse the repository at this point in the history
This ensures that we are not suppressing things that aren't being
raised to begin with (i.e. because we fixed the underlying cause).
  • Loading branch information
dagwieers committed Dec 31, 2019
1 parent 2bd9c0e commit 76133b1
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -34,7 +34,7 @@ tox:

pylint:
@echo -e "$(white)=$(blue) Starting sanity pylint test$(reset)"
$(PYTHON) -m pylint lib/ test/
$(PYTHON) -m pylint -e useless-suppression lib/ test/

language:
@echo -e "$(white)=$(blue) Starting language test$(reset)"
Expand Down
4 changes: 2 additions & 2 deletions lib/inputstreamhelper/__init__.py
Expand Up @@ -512,15 +512,15 @@ def _select_best_chromeos_image(devices):
# Select the newest version
from distutils.version import LooseVersion # pylint: disable=import-error,no-name-in-module
if LooseVersion(device['version']) > LooseVersion(best['version']):
log('{device[hwid]} ({device[version]}) is newer than {best[hwid]} ({best[version]})', # pylint: disable=invalid-format-index
log('{device[hwid]} ({device[version]}) is newer than {best[hwid]} ({best[version]})',
device=device,
best=best)
best = device

# Select the smallest image (disk space requirement)
elif LooseVersion(device['version']) == LooseVersion(best['version']):
if int(device['filesize']) + int(device['zipfilesize']) < int(best['filesize']) + int(best['zipfilesize']):
log('{device[hwid]} ({device_size}) is smaller than {best[hwid]} ({best_size})', # pylint: disable=invalid-format-index
log('{device[hwid]} ({device_size}) is smaller than {best[hwid]} ({best_size})',
device=device,
best=best,
device_size=int(device['filesize']) + int(device['zipfilesize']),
Expand Down
2 changes: 1 addition & 1 deletion lib/inputstreamhelper/kodiutils.py
Expand Up @@ -27,7 +27,7 @@ def has_socks():
if hasattr(has_socks, 'cached'):
return getattr(has_socks, 'cached')
try:
import socks # noqa: F401; pylint: disable=unused-variable,unused-import
import socks # noqa: F401; pylint: disable=unused-variable,unused-import,useless-suppression
except ImportError:
has_socks.cached = False
return None # Detect if this is the first run
Expand Down
2 changes: 1 addition & 1 deletion lib/inputstreamhelper/unicodehelper.py
Expand Up @@ -13,6 +13,6 @@ def to_unicode(text, encoding='utf-8', errors='strict'):
def from_unicode(text, encoding='utf-8', errors='strict'):
"""Force unicode to text"""
import sys
if sys.version_info.major == 2 and isinstance(text, unicode): # noqa: F821; pylint: disable=undefined-variable
if sys.version_info.major == 2 and isinstance(text, unicode): # noqa: F821; pylint: disable=undefined-variable,useless-suppression
return text.encode(encoding, errors)
return text
2 changes: 1 addition & 1 deletion test/test_ishelper_android_arm.py
Expand Up @@ -2,7 +2,7 @@
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

# pylint: disable=duplicate-code,invalid-name,missing-docstring,protected-access
# pylint: disable=invalid-name,missing-docstring

from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
Expand Down
2 changes: 1 addition & 1 deletion test/test_ishelper_linux_arm.py
Expand Up @@ -2,7 +2,7 @@
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

# pylint: disable=duplicate-code,invalid-name,missing-docstring,protected-access
# pylint: disable=invalid-name,missing-docstring

from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
Expand Down
2 changes: 1 addition & 1 deletion test/test_ishelper_linux_x64.py
Expand Up @@ -2,7 +2,7 @@
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

# pylint: disable=duplicate-code,invalid-name,missing-docstring,protected-access
# pylint: disable=invalid-name,missing-docstring

from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
Expand Down
2 changes: 1 addition & 1 deletion test/test_ishelper_macos_x64.py
Expand Up @@ -2,7 +2,7 @@
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

# pylint: disable=duplicate-code,invalid-name,missing-docstring,protected-access
# pylint: disable=invalid-name,missing-docstring

from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
Expand Down
2 changes: 1 addition & 1 deletion test/test_ishelper_windows_x64.py
Expand Up @@ -2,7 +2,7 @@
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

# pylint: disable=duplicate-code,invalid-name,missing-docstring,protected-access
# pylint: disable=invalid-name,missing-docstring

from __future__ import absolute_import, division, print_function, unicode_literals
import unittest
Expand Down
2 changes: 1 addition & 1 deletion test/test_proxy.py
Expand Up @@ -2,7 +2,7 @@
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

# pylint: disable=duplicate-code,invalid-name,missing-docstring,protected-access
# pylint: disable=invalid-name,missing-docstring

from __future__ import absolute_import, division, print_function, unicode_literals
import sys
Expand Down

0 comments on commit 76133b1

Please sign in to comment.