diff options
| author | Markus Heiser <markus.heiser@darmarit.de> | 2024-03-11 14:06:26 +0100 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-03-11 14:55:38 +0100 |
| commit | 542f7d0d7bd1a12e1884ba4a1508b40e2514d472 (patch) | |
| tree | 5256282b267e494200d02914593457854567fec4 /searx/metrics/error_recorder.py | |
| parent | 8205f170ff983e5240d32dc17d7fdb526ebe5fe7 (diff) | |
[mod] pylint all files with one profile / drop PYLINT_SEARXNG_DISABLE_OPTION
In the past, some files were tested with the standard profile, others with a
profile in which most of the messages were switched off ... some files were not
checked at all.
- ``PYLINT_SEARXNG_DISABLE_OPTION`` has been abolished
- the distinction ``# lint: pylint`` is no longer necessary
- the pylint tasks have been reduced from three to two
1. ./searx/engines -> lint engines with additional builtins
2. ./searx ./searxng_extra ./tests -> lint all other python files
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/metrics/error_recorder.py')
| -rw-r--r-- | searx/metrics/error_recorder.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/searx/metrics/error_recorder.py b/searx/metrics/error_recorder.py index 1d0d6e7a3..df25e8d41 100644 --- a/searx/metrics/error_recorder.py +++ b/searx/metrics/error_recorder.py @@ -1,3 +1,6 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later +# pylint: disable=missing-module-docstring, invalid-name + import typing import inspect from json import JSONDecodeError @@ -16,7 +19,7 @@ from searx.engines import engines errors_per_engines = {} -class ErrorContext: +class ErrorContext: # pylint: disable=missing-class-docstring __slots__ = ( 'filename', @@ -29,7 +32,9 @@ class ErrorContext: 'secondary', ) - def __init__(self, filename, function, line_no, code, exception_classname, log_message, log_parameters, secondary): + def __init__( # pylint: disable=too-many-arguments + self, filename, function, line_no, code, exception_classname, log_message, log_parameters, secondary + ): self.filename = filename self.function = function self.line_no = line_no @@ -39,7 +44,7 @@ class ErrorContext: self.log_parameters = log_parameters self.secondary = secondary - def __eq__(self, o) -> bool: + def __eq__(self, o) -> bool: # pylint: disable=invalid-name if not isinstance(o, ErrorContext): return False return ( @@ -109,7 +114,7 @@ def get_request_exception_messages( status_code = None reason = None hostname = None - if hasattr(exc, '_request') and exc._request is not None: + if hasattr(exc, '_request') and exc._request is not None: # pylint: disable=protected-access # exc.request is property that raise an RuntimeException # if exc._request is not defined. url = exc.request.url @@ -123,7 +128,7 @@ def get_request_exception_messages( return (status_code, reason, hostname) -def get_messages(exc, filename) -> typing.Tuple: +def get_messages(exc, filename) -> typing.Tuple: # pylint: disable=too-many-return-statements if isinstance(exc, JSONDecodeError): return (exc.msg,) if isinstance(exc, TypeError): |