diff options
| author | Alexander Neben <alexander.neben@mongodb.com> | 2022-09-02 21:56:05 +0000 |
|---|---|---|
| committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-09-02 22:55:09 +0000 |
| commit | 97ac02fa506b4a9e7e0729b9c492bc4ace79499c (patch) | |
| tree | 975a4d92d9a33f3eb49920daf4ffe8deba3f84b7 | |
| parent | d4d4a26801f7b3033cd6103b6a317cc547ee142c (diff) | |
| download | mongo-97ac02fa506b4a9e7e0729b9c492bc4ace79499c.tar.gz | |
SERVER-68593 Disable low value python warnings
177 files changed, 301 insertions, 639 deletions
diff --git a/.pydocstyle b/.pydocstyle index 2fed49e4f98..451ead697dc 100644 --- a/.pydocstyle +++ b/.pydocstyle @@ -2,6 +2,14 @@ [pydocstyle] inherit = false +# D100 - Missing docstring in public module +# D101 - Missing docstring in public class +# D102 - Missing docstring in public method +# D103 - Missing docstring in public function +# D104 - Missing docstring in public package +# D105 - Missing docstring in magic method +# D106 - Missing docstring in public nested class +# D107 - Missing docstring in __init__ # D105 - Missing docstring in magic method # D107 - Missing docstring in __init__ # D202 - No blank lines allowed after function docstring @@ -13,6 +21,6 @@ inherit = false # D407 - Missing dashed underline after section # D413 - Missing blank line after last section # D415 - First line should end with a period, question mark, or exclamation point -ignore = D105,D202,D203,D212,D213,D301,D401,D407,D413,D415 +ignore = D100,D101,D102,D103,D104,D105,D106,D107,D202,D203,D212,D213,D301,D401,D407,D413,D415 # Do not run on buildscripts/tests/ match = ^((?!buildscripts[\\\/]tests[\\\/]).)*$ diff --git a/.pylintrc b/.pylintrc index 75ae207605d..524963aa2c9 100644 --- a/.pylintrc +++ b/.pylintrc @@ -31,7 +31,8 @@ variable-rgx=[a-z_][a-z0-9_]{1,50}$ # R0801 - duplicate-code - See PM-1380 # E0611 - no-name-in-module -disable=bad-continuation,fixme,import-error,line-too-long,no-member,locally-disabled,no-else-return,redefined-variable-type,too-few-public-methods,unused-import,useless-object-inheritance,deprecated-module,unnecessary-pass,duplicate-code,no-else-raise,deprecated-method,exec-used,no-name-in-module,raise-missing-from, unnecessary-comprehension,super-with-arguments,consider-using-sys-exit,import-outside-toplevel,no-else-continue,no-else-break,too-many-arguments,too-many-locals +disable=bad-continuation,consider-using-sys-exit,deprecated-method,deprecated-module,duplicate-code,exec-used,fixme,import-error,import-outside-toplevel,line-too-long,locally-disabled,missing-class-docstring,missing-docstring,missing-docstring,missing-function-docstring,missing-module-docstring,no-else-break,no-else-continue,no-else-raise,no-else-return,no-member,no-name-in-module,no-self-use,raise-missing-from,redefined-variable-type,super-with-arguments,too-few-public-methods,too-many-arguments,too-many-branches,too-many-function-args,too-many-instance-attributes,too-many-lines,too-many-locals,too-many-public-methods,too-many-return-statements,too-many-statements,unnecessary-comprehension,unnecessary-pass,unused-import,useless-object-inheritance +enable=useless-suppression [IMPORTS] known-third-party=boto3,botocore,psutil,yaml,xmlrunner diff --git a/buildscripts/benchmarks/compare.py b/buildscripts/benchmarks/compare.py index ef63acfbdff..e6e47b7984d 100644 --- a/buildscripts/benchmarks/compare.py +++ b/buildscripts/benchmarks/compare.py @@ -16,7 +16,7 @@ class _Result(Enum): @dataclass -class _ResultTableRow: # pylint: disable=too-many-instance-attributes +class _ResultTableRow: """Representation of result table row.""" test_name: str diff --git a/buildscripts/blackduck_hub.py b/buildscripts/blackduck_hub.py index 15746f3773d..2b1a00c043f 100644 --- a/buildscripts/blackduck_hub.py +++ b/buildscripts/blackduck_hub.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 """Utility script to run Black Duck scans and query Black Duck database.""" -#pylint: disable=too-many-lines import argparse import functools @@ -19,13 +18,13 @@ from abc import ABCMeta, abstractmethod from typing import Dict, List, Optional import urllib3.util.retry as urllib3_retry -import requests import yaml from blackduck.HubRestApi import HubInstance +import requests try: - import requests.packages.urllib3.exceptions as urllib3_exceptions #pylint: disable=ungrouped-imports + import requests.packages.urllib3.exceptions as urllib3_exceptions except ImportError: # Versions of the requests package prior to 1.2.0 did not vendor the urllib3 package. urllib3_exceptions = None @@ -176,7 +175,6 @@ class HTTPHandler(object): # Derived from buildscripts/resmokelib/logging/buildlogger.py class BuildloggerServer(object): - # pylint: disable=too-many-instance-attributes """ A remote server to which build logs can be sent. @@ -185,7 +183,6 @@ class BuildloggerServer(object): """ def __init__(self, username, password, task_id, builder, build_num, build_phase, url): - # pylint: disable=too-many-arguments """Initialize BuildloggerServer.""" self.username = username self.password = password @@ -245,7 +242,7 @@ class BuildloggerServer(object): raise ValueError("Encountered an HTTP error: %s" % (err)) except requests.RequestException as err: raise ValueError("Encountered a network error: %s" % (err)) - except: # pylint: disable=bare-except + except: raise ValueError("Encountered an error.") return self.handler.make_url(endpoint) @@ -451,7 +448,6 @@ class Component: def __init__(self, name, version, licenses, policy_status, security_risk, newest_release, is_manually_added): - # pylint: disable=too-many-arguments """Initialize Black Duck component.""" self.name = name self.version = version @@ -463,7 +459,6 @@ class Component: @staticmethod def parse(hub, component): - # pylint: disable=too-many-locals """Parse a Black Duck component from a dictionary.""" name = component["componentName"] cversion = component.get("componentVersionName", "unknown_version") @@ -621,7 +616,6 @@ class TestResultEncoder(json.JSONEncoder): def default(self, o): """Serialize objects by default as a dictionary.""" - # pylint: disable=method-hidden return o.__dict__ diff --git a/buildscripts/burn_in_tests.py b/buildscripts/burn_in_tests.py index 84c7d98aab0..a97aa83b2cf 100755 --- a/buildscripts/burn_in_tests.py +++ b/buildscripts/burn_in_tests.py @@ -611,7 +611,6 @@ class BurnInOrchestrator: self.burn_in_executor.execute(tests_by_task) -# pylint: disable=too-many-function-args @click.command(context_settings=dict(ignore_unknown_options=True)) @click.option("--no-exec", "no_exec", default=False, is_flag=True, help="Do not execute the found tests.") @@ -634,7 +633,6 @@ class BurnInOrchestrator: @click.option("--install-dir", "install_dir", type=str, help="Path to bin directory of a testable installation") @click.argument("resmoke_args", nargs=-1, type=click.UNPROCESSED) -# pylint: disable=too-many-arguments,too-many-locals def main(build_variant: str, no_exec: bool, repeat_tests_num: Optional[int], repeat_tests_min: Optional[int], repeat_tests_max: Optional[int], repeat_tests_secs: Optional[int], resmoke_args: str, verbose: bool, diff --git a/buildscripts/ciconfig/evergreen.py b/buildscripts/ciconfig/evergreen.py index fb63b2201ec..6c52a5f55d4 100644 --- a/buildscripts/ciconfig/evergreen.py +++ b/buildscripts/ciconfig/evergreen.py @@ -6,7 +6,7 @@ configuration file. from __future__ import annotations import datetime -import distutils.spawn # pylint: disable=no-name-in-module +import distutils.spawn from typing import Set, List, Optional import yaml @@ -39,7 +39,7 @@ def parse_evergreen_file(path, evergreen_binary="evergreen"): return EvergreenProjectConfig(config) -class EvergreenProjectConfig(object): # pylint: disable=too-many-instance-attributes +class EvergreenProjectConfig(object): """Represent an Evergreen project configuration file.""" def __init__(self, conf): diff --git a/buildscripts/clang_format.py b/buildscripts/clang_format.py index a93e8ecef8b..de335123ded 100755 --- a/buildscripts/clang_format.py +++ b/buildscripts/clang_format.py @@ -71,7 +71,6 @@ def callo(args, **kwargs): def get_tar_path(version, tar_path): """Return the path to clang-format in the llvm tarball.""" - # pylint: disable=too-many-function-args return CLANG_FORMAT_SOURCE_TAR_BASE.substitute(version=version, tar_path=tar_path) @@ -136,7 +135,6 @@ class ClangFormat(object): """ClangFormat class.""" def __init__(self, path, cache_dir): - # pylint: disable=too-many-branches,too-many-statements """Initialize ClangFormat.""" self.path = None @@ -406,8 +404,7 @@ def format_my_func(clang_format, origin_branch): _format_files(clang_format, files) -def reformat_branch( # pylint: disable=too-many-branches,too-many-locals,too-many-statements - clang_format, commit_prior_to_reformat, commit_after_reformat): +def reformat_branch(clang_format, commit_prior_to_reformat, commit_after_reformat): """Reformat a branch made before a clang-format run.""" clang_format = ClangFormat(clang_format, _get_build_dir()) diff --git a/buildscripts/debugsymb_mapper.py b/buildscripts/debugsymb_mapper.py index 4e9df04398e..d85ad64d9c9 100644 --- a/buildscripts/debugsymb_mapper.py +++ b/buildscripts/debugsymb_mapper.py @@ -153,7 +153,6 @@ class DownloadOptions(object): class Mapper: """A class to to basically all of the work.""" - # pylint: disable=too-many-instance-attributes # This amount of attributes are necessary. default_web_service_base_url: str = "https://symbolizer-service.server-tig.prod.corp.mongodb.com" diff --git a/buildscripts/errorcodes.py b/buildscripts/errorcodes.py index 46e0ac09850..d4a2698b2ea 100755 --- a/buildscripts/errorcodes.py +++ b/buildscripts/errorcodes.py @@ -25,9 +25,7 @@ except ImportError: MAXIMUM_CODE = 9999999 # JIRA Ticket + XX -# pylint: disable=invalid-name codes = [] # type: ignore -# pylint: enable=invalid-name # Each AssertLocation identifies the C++ source location of an assertion AssertLocation = namedtuple("AssertLocation", ['sourceFile', 'byteOffset', 'lines', 'code']) @@ -237,7 +235,7 @@ def read_error_codes(src_root='src/mongo'): return (codes, errors, seen) -def replace_bad_codes(errors, next_code_generator): # pylint: disable=too-many-locals +def replace_bad_codes(errors, next_code_generator): """ Modify C++ source files to replace invalid assertion codes. diff --git a/buildscripts/eslint.py b/buildscripts/eslint.py index 07cbb0ddc5c..8ff93a00796 100755 --- a/buildscripts/eslint.py +++ b/buildscripts/eslint.py @@ -24,7 +24,7 @@ import urllib.error import urllib.parse import urllib.request -from distutils import spawn # pylint: disable=no-name-in-module +from distutils import spawn from optparse import OptionParser import structlog @@ -93,7 +93,6 @@ def get_eslint_from_cache(dest_file, platform, arch): print("Downloading ESLint %s from %s, saving to %s" % (ESLINT_VERSION, url, temp_tar_file)) urllib.request.urlretrieve(url, temp_tar_file) - # pylint: disable=too-many-function-args print("Extracting ESLint %s to %s" % (ESLINT_VERSION, dest_file)) eslint_distfile = ESLINT_SOURCE_TAR_BASE.substitute(platform=platform, arch=arch) extract_eslint(temp_tar_file, eslint_distfile) @@ -103,7 +102,7 @@ def get_eslint_from_cache(dest_file, platform, arch): class ESLint(object): """Class encapsulates finding a suitable copy of ESLint, and linting an individual file.""" - def __init__(self, path, cache_dir): # pylint: disable=too-many-branches + def __init__(self, path, cache_dir): """Initialize ESLint.""" eslint_progname = ESLINT_PROGNAME diff --git a/buildscripts/evergreen_task_timeout.py b/buildscripts/evergreen_task_timeout.py index 350e389d571..fd92c0d1af5 100755 --- a/buildscripts/evergreen_task_timeout.py +++ b/buildscripts/evergreen_task_timeout.py @@ -162,6 +162,9 @@ def output_timeout(exec_timeout: timedelta, idle_timeout: Optional[timedelta], :param idle_timeout: Idle timeout to output. :param output_file: Location of output file to write. """ + # the math library is triggering this error in this function for some + # reason + # pylint: disable=c-extension-no-member output = { "exec_timeout_secs": math.ceil(exec_timeout.total_seconds()), } diff --git a/buildscripts/gdb/mongo.py b/buildscripts/gdb/mongo.py index ea3bf3c45d9..03e89d89c54 100644 --- a/buildscripts/gdb/mongo.py +++ b/buildscripts/gdb/mongo.py @@ -233,7 +233,7 @@ class DumpGlobalServiceContext(gdb.Command): """Initialize DumpGlobalServiceContext.""" RegisterMongoCommand.register(self, "mongodb-service-context", gdb.COMMAND_DATA) - def invoke(self, arg, _from_tty): # pylint: disable=no-self-use,unused-argument + def invoke(self, arg, _from_tty): # pylint: disable=unused-argument """Invoke GDB command to print the Global Service Context.""" gdb.execute("print *('mongo::(anonymous namespace)::globalServiceContext')") @@ -255,7 +255,7 @@ class GetMongoDecoration(gdb.Command): """Initialize GetMongoDecoration.""" RegisterMongoCommand.register(self, "mongo-decoration", gdb.COMMAND_DATA) - def invoke(self, args, _from_tty): # pylint: disable=unused-argument,no-self-use + def invoke(self, args, _from_tty): # pylint: disable=unused-argument """Invoke GetMongoDecoration.""" argarr = args.split(" ") if len(argarr) < 2: @@ -293,7 +293,7 @@ class DumpMongoDSessionCatalog(gdb.Command): """Initialize DumpMongoDSessionCatalog.""" RegisterMongoCommand.register(self, "mongod-dump-sessions", gdb.COMMAND_DATA) - def invoke(self, args, _from_tty): # pylint: disable=unused-argument,no-self-use,too-many-locals,too-many-branches,too-many-statements + def invoke(self, args, _from_tty): # pylint: disable=unused-argument """Invoke DumpMongoDSessionCatalog.""" # See if a particular session id was specified. argarr = args.split(" ") @@ -425,7 +425,7 @@ class DumpMongoDBMutexes(gdb.Command): """Initialize DumpMongoDBMutexs.""" RegisterMongoCommand.register(self, "mongodb-dump-mutexes", gdb.COMMAND_DATA) - def invoke(self, args, _from_tty): # pylint: disable=unused-argument,no-self-use,too-many-locals,too-many-branches,too-many-statements + def invoke(self, args, _from_tty): # pylint: disable=unused-argument """Invoke DumpMongoDBMutexes.""" print("Dumping mutex info for all Clients") @@ -520,7 +520,7 @@ class MongoDBDumpRecoveryUnits(gdb.Command): print("Not invoking mongod recovery unit dump for: %s" % (main_binary_name)) @staticmethod - def dump_recovery_units(recovery_unit_impl_type): # pylint: disable=too-many-locals + def dump_recovery_units(recovery_unit_impl_type): """GDB in-process python supplement.""" # Temporarily disable printing static members to make the output more readable @@ -653,7 +653,7 @@ class BtIfActive(gdb.Command): """Initialize BtIfActive.""" RegisterMongoCommand.register(self, "mongodb-bt-if-active", gdb.COMMAND_DATA) - def invoke(self, arg, _from_tty): # pylint: disable=no-self-use,unused-argument + def invoke(self, arg, _from_tty): # pylint: disable=unused-argument """Invoke GDB to print stack trace.""" try: idle_location = gdb.parse_and_eval("mongo::for_debuggers::idleThreadLocation") @@ -862,7 +862,7 @@ class MongoDBPPrintBsonAtPointer(gdb.Command): """Init.""" RegisterMongoCommand.register(self, "mongodb-pprint-bson", gdb.COMMAND_STATUS) - def invoke(self, args, _from_tty): # pylint: disable=no-self-use + def invoke(self, args, _from_tty): """Invoke.""" args = args.split(' ') if len(args) == 0 or (len(args) == 1 and len(args[0]) == 0): @@ -892,7 +892,7 @@ class MongoDBHelp(gdb.Command): """Initialize MongoDBHelp.""" gdb.Command.__init__(self, "mongodb-help", gdb.COMMAND_SUPPORT) - def invoke(self, arg, _from_tty): # pylint: disable=no-self-use,unused-argument + def invoke(self, arg, _from_tty): # pylint: disable=unused-argument """Register the mongo print commands.""" RegisterMongoCommand.print_commands() diff --git a/buildscripts/gdb/mongo_lock.py b/buildscripts/gdb/mongo_lock.py index 448d3518f46..6fb2d9cb210 100644 --- a/buildscripts/gdb/mongo_lock.py +++ b/buildscripts/gdb/mongo_lock.py @@ -307,7 +307,7 @@ def find_mutex_holder(graph, thread_dict, show): graph.add_edge(Lock(int(mutex_value), "Mutex"), mutex_holder) -def find_lock_manager_holders(graph, thread_dict, show): # pylint: disable=too-many-locals +def find_lock_manager_holders(graph, thread_dict, show): """Find lock manager holders.""" frame = find_frame(r'mongo::LockerImpl::') if not frame: diff --git a/buildscripts/gdb/udb.py b/buildscripts/gdb/udb.py index 98fff5b284e..1432a4453ab 100644 --- a/buildscripts/gdb/udb.py +++ b/buildscripts/gdb/udb.py @@ -1,6 +1,5 @@ """Utility functions for udb.""" -# pylint: disable=unused-argument,missing-docstring,no-self-use import os import re from typing import Optional @@ -176,7 +175,6 @@ class LoadDistTest(gdb.Command): return None - # pylint: disable=too-many-branches,too-many-locals def invoke(self, args, from_tty): """GDB Command API invoke.""" arglist = args.split() diff --git a/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py b/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py index 2a9d3c72420..dc539b01a52 100644 --- a/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py +++ b/buildscripts/idl/check_stable_api_commands_have_idl_definitions.py @@ -42,7 +42,8 @@ from pymongo import MongoClient # Permit imports from "buildscripts". sys.path.append(os.path.normpath(os.path.join(os.path.abspath(__file__), '../../..'))) -# pylint: disable=wrong-import-position,wrong-import-order +# pylint: disable=wrong-import-position +from idl import syntax from buildscripts.idl.lib import list_idls, parse_idl from buildscripts.resmokelib import configure_resmoke from buildscripts.resmokelib.logging import loggers @@ -50,7 +51,7 @@ from buildscripts.resmokelib.testing.fixtures import interface from buildscripts.resmokelib.testing.fixtures.fixturelib import FixtureLib from buildscripts.resmokelib.testing.fixtures.shardedcluster import ShardedClusterFixture from buildscripts.resmokelib.testing.fixtures.standalone import MongoDFixture -from idl import syntax +# pylint: enable=wrong-import-position LOGGER_NAME = 'check-idl-definitions' LOGGER = logging.getLogger(LOGGER_NAME) diff --git a/buildscripts/idl/idl/ast.py b/buildscripts/idl/idl/ast.py index 8b4e4de90fc..c49bfee0be5 100644 --- a/buildscripts/idl/idl/ast.py +++ b/buildscripts/idl/idl/ast.py @@ -54,8 +54,6 @@ class IDLBoundSpec(object): class IDLAST(object): """The in-memory representation of an IDL file.""" - # pylint: disable=too-many-instance-attributes - def __init__(self): # type: () -> None """Construct an IDLAST.""" @@ -94,8 +92,6 @@ class Type(common.SourceLocation): The type of a struct field or command field, for the sake of C++ code generation. """ - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a Type.""" @@ -128,8 +124,6 @@ class Struct(common.SourceLocation): represent that struct type using ast.Type with is_struct=True. """ - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a struct.""" @@ -170,8 +164,6 @@ class Validator(common.SourceLocation): If more than one is included, they must ALL evaluate to true. """ - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a Validator.""" @@ -194,8 +186,6 @@ class Field(common.SourceLocation): Not all fields are set, it depends on the input document. """ - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a Field.""" @@ -261,8 +251,6 @@ class Command(Struct): All fields are either required or have a non-None default. """ - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a command.""" @@ -402,8 +390,6 @@ class ServerParameterClass(common.SourceLocation): class ServerParameter(common.SourceLocation): """IDL ServerParameter setting.""" - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a ServerParameter.""" @@ -457,8 +443,6 @@ class ConfigGlobal(common.SourceLocation): class ConfigOption(common.SourceLocation): """IDL ConfigOption setting.""" - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a ConfigOption.""" diff --git a/buildscripts/idl/idl/binder.py b/buildscripts/idl/idl/binder.py index 84966494572..e3f75be5683 100644 --- a/buildscripts/idl/idl/binder.py +++ b/buildscripts/idl/idl/binder.py @@ -25,7 +25,6 @@ # exception statement from all source files in the program, then also delete # it in the license file. # -# pylint: disable=too-many-lines """Transform idl.syntax trees from the parser into well-defined idl.ast trees.""" import collections @@ -177,7 +176,6 @@ def _validate_chain_type_properties(ctxt, idl_type, syntax_type): def _validate_type_properties(ctxt, idl_type, syntax_type): # type: (errors.ParserContext, Union[syntax.Type, ast.Type], str) -> None - # pylint: disable=too-many-branches """Validate each type is correct.""" # Validate bson type restrictions if not _validate_bson_types_list(ctxt, idl_type, syntax_type): @@ -258,7 +256,6 @@ def _get_struct_qualified_cpp_name(struct): def _bind_struct_common(ctxt, parsed_spec, struct, ast_struct): # type: (errors.ParserContext, syntax.IDLSpec, syntax.Struct, ast.Struct) -> None - # pylint: disable=too-many-branches ast_struct.name = struct.name ast_struct.description = struct.description @@ -488,7 +485,6 @@ def _bind_variant_field(ctxt, ast_field, idl_type): def _bind_command_type(ctxt, parsed_spec, command): # type: (errors.ParserContext, syntax.IDLSpec, syntax.Command) -> ast.Field """Bind the type field in a command as the first field.""" - # pylint: disable=too-many-branches,too-many-statements ast_field = ast.Field(command.file_name, command.line, command.column) ast_field.name = command.name ast_field.description = command.description @@ -681,7 +677,6 @@ def _validate_check_uniqueness(ctxt, access_checks): def _bind_access_check(ctxt, parsed_spec, command): # type: (errors.ParserContext, syntax.IDLSpec, syntax.Command) -> Optional[List[ast.AccessCheck]] """Bind the access_check field in a command.""" - # pylint: disable=too-many-return-statements if not command.access_check: return None @@ -770,7 +765,6 @@ def _validate_default_of_type_struct(ctxt, field): def _validate_variant_type(ctxt, syntax_symbol, field): # type: (errors.ParserContext, syntax.VariantType, syntax.Field) -> None - # pylint: disable=unused-argument """Validate that this field is a proper variant type.""" # Check for duplicate BSON serialization types. @@ -995,7 +989,6 @@ def _bind_field(ctxt, parsed_spec, field): - Create the idl.ast version from the idl.syntax tree. - Validate the resulting type is correct. """ - # pylint: disable=too-many-branches,too-many-statements ast_field = ast.Field(field.file_name, field.line, field.column) ast_field.name = field.name ast_field.description = field.description @@ -1467,7 +1460,6 @@ def _bind_config_option(ctxt, globals_spec, option): # type: (errors.ParserContext, syntax.Global, syntax.ConfigOption) -> ast.ConfigOption """Bind a config setting.""" - # pylint: disable=too-many-branches,too-many-statements,too-many-return-statements node = ast.ConfigOption(option.file_name, option.line, option.column) if _is_invalid_config_short_name(option.short_name or ''): diff --git a/buildscripts/idl/idl/common.py b/buildscripts/idl/idl/common.py index 768f0e8e11f..39f5f032183 100644 --- a/buildscripts/idl/idl/common.py +++ b/buildscripts/idl/idl/common.py @@ -84,7 +84,6 @@ def template_format(template, template_params=None): # str. # See https://docs.python.org/2/library/string.html#template-strings template = _escape_template_string(template) - # pylint: disable=too-many-function-args return string.Template(template).substitute(template_params) # type: ignore @@ -95,7 +94,6 @@ def template_args(template, **kwargs): # str. # See https://docs.python.org/2/library/string.html#template-strings template = _escape_template_string(template) - # pylint: disable=too-many-function-args return string.Template(template).substitute(kwargs) # type: ignore diff --git a/buildscripts/idl/idl/compiler.py b/buildscripts/idl/idl/compiler.py index fb1c1278f1f..b5a41352d20 100644 --- a/buildscripts/idl/idl/compiler.py +++ b/buildscripts/idl/idl/compiler.py @@ -47,8 +47,6 @@ from . import syntax class CompilerArgs(object): """Set of compiler arguments.""" - # pylint: disable=too-many-instance-attributes - def __init__(self): # type: () -> None """Create a container for compiler arguments.""" diff --git a/buildscripts/idl/idl/cpp_types.py b/buildscripts/idl/idl/cpp_types.py index b6bf62d9f9a..af0c97a89df 100644 --- a/buildscripts/idl/idl/cpp_types.py +++ b/buildscripts/idl/idl/cpp_types.py @@ -652,7 +652,6 @@ class _BinDataBsonCppTypeBase(BsonCppTypeBase): def get_bson_cpp_type(ast_type): # type: (ast.Type) -> Optional[BsonCppTypeBase] """Get a class that provides custom serialization for the given BSON type.""" - # pylint: disable=too-many-return-statements # Does not support list of types if len(ast_type.bson_serialization_type) > 1: diff --git a/buildscripts/idl/idl/errors.py b/buildscripts/idl/idl/errors.py index 3fcf0828249..c15b795b012 100644 --- a/buildscripts/idl/idl/errors.py +++ b/buildscripts/idl/idl/errors.py @@ -25,7 +25,6 @@ # exception statement from all source files in the program, then also delete # it in the license file. # -# pylint: disable=too-many-lines """ Common error handling code for IDL compiler. @@ -153,7 +152,6 @@ class ParserError(common.SourceLocation): def __init__(self, error_id, msg, file_name, line, column): # type: (str, str, str, int, int) -> None """Construct a parser error with source location information.""" - # pylint: disable=too-many-arguments self.error_id = error_id self.msg = msg super(ParserError, self).__init__(file_name, line, column) @@ -227,8 +225,6 @@ class ParserContext(object): - single class responsible for producing actual error messages. """ - # pylint: disable=too-many-public-methods - def __init__(self, file_name, errors): # type: (str, ParserErrorCollection) -> None """Construct a new ParserContext.""" @@ -321,7 +317,6 @@ class ParserContext(object): def is_scalar_sequence_or_scalar_node(self, node, node_name): # type: (Union[yaml.nodes.MappingNode, yaml.nodes.ScalarNode, yaml.nodes.SequenceNode], str) -> bool - # pylint: disable=invalid-name """Return True if the YAML node is a Scalar or Sequence.""" if not node.id == "scalar" and not node.id == "sequence": self._add_node_error( @@ -337,7 +332,6 @@ class ParserContext(object): def is_scalar_or_mapping_node(self, node, node_name): # type: (Union[yaml.nodes.MappingNode, yaml.nodes.ScalarNode, yaml.nodes.SequenceNode], str) -> bool - # pylint: disable=invalid-name """Return True if the YAML node is a Scalar or Mapping.""" if not node.id == "scalar" and not node.id == "mapping": self._add_node_error( @@ -389,7 +383,6 @@ class ParserContext(object): def add_missing_required_field_error(self, node, node_parent, node_name): # type: (yaml.nodes.Node, str, str) -> None """Add an error about a YAML node missing a required child.""" - # pylint: disable=invalid-name self._add_node_error( node, ERROR_ID_MISSING_REQUIRED_FIELD, "IDL node '%s' is missing required scalar '%s'" % (node_parent, node_name)) @@ -397,7 +390,6 @@ class ParserContext(object): def add_missing_ast_required_field_error(self, location, ast_type, ast_parent, ast_name): # type: (common.SourceLocation, str, str, str) -> None """Add an error about a AST node missing a required child.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_MISSING_AST_REQUIRED_FIELD, "%s '%s' is missing required scalar '%s'" % (ast_type, ast_parent, ast_name)) @@ -426,7 +418,6 @@ class ParserContext(object): def add_bad_bson_bindata_subtype_error(self, location, ast_type, ast_parent, bson_type_name): # type: (common.SourceLocation, str, str, str) -> None """Add an error about a bindata_subtype associated with a type that is not bindata.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_BAD_BSON_BINDATA_SUBTYPE_TYPE, ("The bindata_subtype field for %s '%s' is not valid for bson type '%s'") % (ast_type, ast_parent, bson_type_name)) @@ -434,7 +425,6 @@ class ParserContext(object): def add_bad_bson_bindata_subtype_value_error(self, location, ast_type, ast_parent, value): # type: (common.SourceLocation, str, str, str) -> None """Add an error about a bad value for bindata_subtype.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_BAD_BSON_BINDATA_SUBTYPE_VALUE, ("The bindata_subtype field's value '%s' for %s '%s' is not valid") % (value, ast_type, ast_parent)) @@ -442,7 +432,6 @@ class ParserContext(object): def add_bad_setat_specifier(self, location, specifier): # type: (common.SourceLocation, str) -> None """Add an error about a bad set_at specifier.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_BAD_SETAT_SPECIFIER, ("Unexpected set_at specifier: '%s', expected 'startup' or 'runtime'") % (specifier)) @@ -457,7 +446,6 @@ class ParserContext(object): def add_ignored_field_must_be_empty_error(self, location, name, field_name): # type: (common.SourceLocation, str, str) -> None """Add an error about field must be empty for ignored fields.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_FIELD_MUST_BE_EMPTY_FOR_IGNORED, ("Field '%s' cannot contain a value for property '%s' when a field is marked as ignored" @@ -466,15 +454,13 @@ class ParserContext(object): def add_struct_default_must_be_true_or_empty_error(self, location, name): # type: (common.SourceLocation, str) -> None """Add an error about default must be True or empty for fields of type struct.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_DEFAULT_MUST_BE_TRUE_OR_EMPTY_FOR_STRUCT, ( "Field '%s' can only contain value 'true' for property 'default' when a field's type is a struct" ) % (name)) - def add_not_custom_scalar_serialization_not_supported_error(self, location, ast_type, - ast_parent, bson_type_name): + def add_not_custom_scalar_serialization_not_supported_error( # pylint: disable=invalid-name + self, location, ast_type, ast_parent, bson_type_name): # type: (common.SourceLocation, str, str, str) -> None - # pylint: disable=invalid-name """Add an error about field must be empty for fields of type struct.""" self._add_error( location, ERROR_ID_CUSTOM_SCALAR_SERIALIZATION_NOT_SUPPORTED, @@ -484,7 +470,6 @@ class ParserContext(object): def add_bad_any_type_use_error(self, location, bson_type, ast_type, ast_parent): # type: (common.SourceLocation, str, str, str) -> None - # pylint: disable=invalid-name """Add an error about any being used in a list of bson types.""" self._add_error( location, ERROR_ID_BAD_ANY_TYPE_USE, @@ -493,7 +478,6 @@ class ParserContext(object): def add_bad_cpp_numeric_type_use_error(self, location, ast_type, ast_parent, cpp_type): # type: (common.SourceLocation, str, str, str) -> None - # pylint: disable=invalid-name """Add an error about any being used in a list of bson types.""" self._add_error( location, ERROR_ID_BAD_NUMERIC_CPP_TYPE, @@ -524,21 +508,18 @@ class ParserContext(object): def add_bindata_no_default(self, location, ast_type, ast_parent): # type: (common.SourceLocation, str, str) -> None - # pylint: disable=invalid-name """Add an error about a bindata type with a default value.""" self._add_error(location, ERROR_ID_BAD_BINDATA_DEFAULT, ("Default values are not allowed for %s '%s'") % (ast_type, ast_parent)) def add_chained_type_not_found_error(self, location, type_name): # type: (common.SourceLocation, str) -> None - # pylint: disable=invalid-name """Add an error about a chained_type not found.""" self._add_error(location, ERROR_ID_CHAINED_TYPE_NOT_FOUND, ("Type '%s' is not a valid chained type") % (type_name)) def add_chained_type_wrong_type_error(self, location, type_name, bson_type_name): # type: (common.SourceLocation, str, str) -> None - # pylint: disable=invalid-name """Add an error about a chained_type being the wrong type.""" self._add_error(location, ERROR_ID_CHAINED_TYPE_WRONG_BSON_TYPE, ("Chained Type '%s' has the wrong bson serialization type '%s', only" + @@ -554,7 +535,6 @@ class ParserContext(object): def add_chained_type_no_strict_error(self, location, struct_name): # type: (common.SourceLocation, str) -> None - # pylint: disable=invalid-name """Add an error about strict parser validate and chained types.""" self._add_error(location, ERROR_ID_CHAINED_NO_TYPE_STRICT, ("Strict IDL parser validation is not supported with chained types for " + @@ -562,14 +542,12 @@ class ParserContext(object): def add_chained_struct_not_found_error(self, location, struct_name): # type: (common.SourceLocation, str) -> None - # pylint: disable=invalid-name """Add an error about a chained_struct not found.""" self._add_error(location, ERROR_ID_CHAINED_STRUCT_NOT_FOUND, ("Type '%s' is not a valid chained struct") % (struct_name)) def add_chained_nested_struct_no_strict_error(self, location, struct_name, nested_struct_name): # type: (common.SourceLocation, str, str) -> None - # pylint: disable=invalid-name """Add an error about strict parser validate and chained types.""" self._add_error(location, ERROR_ID_CHAINED_NO_NESTED_STRUCT_STRICT, ("Strict IDL parser validation is not supported for a chained struct '%s'" + @@ -578,7 +556,6 @@ class ParserContext(object): def add_chained_nested_struct_no_nested_error(self, location, struct_name, chained_name): # type: (common.SourceLocation, str, str) -> None - # pylint: disable=invalid-name """Add an error about struct's chaining being a struct with nested chaining.""" self._add_error(location, ERROR_ID_CHAINED_NO_NESTED_CHAINED, ("Struct '%s' is not allowed to nest struct '%s' since it has chained" + @@ -620,7 +597,6 @@ class ParserContext(object): def add_enum_non_continuous_range_error(self, location, enum_name): # type: (common.SourceLocation, str) -> None """Add an error for an enum having duplicate values.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_ENUM_NON_CONTINUOUS_RANGE, ("Enum '%s' has non-continuous integer variables, enums must have a " + "continuous range of integer variables.") % (enum_name)) @@ -650,7 +626,6 @@ class ParserContext(object): def add_bad_field_default_and_optional(self, location, field_name): # type: (common.SourceLocation, str) -> None """Add an error about a field being optional and having a default value.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_ILLEGAL_FIELD_DEFAULT_AND_OPTIONAL, ("Field '%s' can only be marked as optional or have a default value," + " not both.") % @@ -659,7 +634,6 @@ class ParserContext(object): def add_bad_struct_field_as_doc_sequence_error(self, location, struct_name, field_name): # type: (common.SourceLocation, str, str) -> None """Add an error about using a field in a struct being marked with supports_doc_sequence.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_STRUCT_NO_DOC_SEQUENCE, ("Field '%s' in struct '%s' cannot be used as a Command Document Sequence" " type. They are only supported in commands.") % (field_name, struct_name)) @@ -667,7 +641,6 @@ class ParserContext(object): def add_bad_non_array_as_doc_sequence_error(self, location, struct_name, field_name): # type: (common.SourceLocation, str, str) -> None """Add an error about using a non-array type field being marked with supports_doc_sequence.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_NO_DOC_SEQUENCE_FOR_NON_ARRAY, ("Field '%s' in command '%s' cannot be used as a Command Document Sequence" " type since it is not an array.") % (field_name, struct_name)) @@ -675,7 +648,6 @@ class ParserContext(object): def add_bad_non_object_as_doc_sequence_error(self, location, field_name): # type: (common.SourceLocation, str) -> None """Add an error about using a non-struct or BSON object for a doc sequence.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_NO_DOC_SEQUENCE_FOR_NON_OBJECT, ("Field '%s' cannot be used as a Command Document Sequence" " type since it is not a BSON object or struct.") % (field_name)) @@ -683,15 +655,13 @@ class ParserContext(object): def add_bad_command_name_duplicates_field(self, location, command_name): # type: (common.SourceLocation, str) -> None """Add an error about a command and field having the same name.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_COMMAND_DUPLICATES_FIELD, ("Command '%s' cannot have the same name as a field.") % (command_name)) - def add_bad_field_non_const_getter_in_immutable_struct_error(self, location, struct_name, - field_name): + def add_bad_field_non_const_getter_in_immutable_struct_error( # pylint: disable=invalid-name + self, location, struct_name, field_name): # type: (common.SourceLocation, str, str) -> None """Add an error about marking a field with non_const_getter in an immutable struct.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_NON_CONST_GETTER_IN_IMMUTABLE_STRUCT, ("Cannot generate a non-const getter for field '%s' in struct '%s' since" @@ -765,7 +735,6 @@ class ParserContext(object): def add_duplicate_comparison_order_field_error(self, location, struct_name, comparison_order): # type: (common.SourceLocation, str, int) -> None """Add an error about fields having duplicate comparison_orders.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_IS_DUPLICATE_COMPARISON_ORDER, ("Struct '%s' cannot have two fields with the same comparison_order value '%d'.") % @@ -774,7 +743,6 @@ class ParserContext(object): def add_extranous_command_type(self, location, command_name): # type: (common.SourceLocation, str) -> None """Add an error about commands having type when not needed.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_IS_COMMAND_TYPE_EXTRANEOUS, ("Command '%s' cannot have a 'type' property unless namespace equals 'type'.") % @@ -783,7 +751,6 @@ class ParserContext(object): def add_value_not_numeric_error(self, location, attrname, value): # type: (common.SourceLocation, str, str) -> None """Add an error about non-numeric value where number expected.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_VALUE_NOT_NUMERIC, ("'%s' requires a numeric value, but %s can not be cast") % (attrname, value)) @@ -791,7 +758,6 @@ class ParserContext(object): def add_server_parameter_invalid_attr(self, location, attrname, conflicts): # type: (common.SourceLocation, str, str) -> None """Add an error about invalid fields in a server parameter definition.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_SERVER_PARAMETER_INVALID_ATTR, ("'%s' attribute not permitted with '%s' server parameter") % (attrname, conflicts)) @@ -799,7 +765,6 @@ class ParserContext(object): def add_server_parameter_required_attr(self, location, attrname, required, dependant=None): # type: (common.SourceLocation, str, str, str) -> None """Add an error about missing fields in a server parameter definition.""" - # pylint: disable=invalid-name qualifier = '' if dependant is None else (" when using '%s' attribute" % (dependant)) self._add_error(location, ERROR_ID_SERVER_PARAMETER_REQUIRED_ATTR, ("'%s' attribute required%s with '%s' server parameter") % @@ -808,70 +773,60 @@ class ParserContext(object): def add_server_parameter_invalid_method_override(self, location, method): # type: (common.SourceLocation, str) -> None """Add an error about invalid method override in SCP method override.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_SERVER_PARAMETER_INVALID_METHOD_OVERRIDE, ("No such method to override in server parameter class: '%s'") % (method)) def add_bad_source_specifier(self, location, value): # type: (common.SourceLocation, str) -> None """Add an error about invalid source specifier.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_BAD_SOURCE_SPECIFIER, ("'%s' is not a valid source specifier") % (value)) def add_bad_duplicate_behavior(self, location, value): # type: (common.SourceLocation, str) -> None """Add an error about invalid duplicate behavior specifier.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_BAD_DUPLICATE_BEHAVIOR_SPECIFIER, ("'%s' is not a valid duplicate behavior specifier") % (value)) def add_bad_numeric_range(self, location, attrname, value): # type: (common.SourceLocation, str, str) -> None """Add an error about invalid range specifier.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_BAD_NUMERIC_RANGE, ("'%s' is not a valid numeric range for '%s'") % (value, attrname)) def add_missing_shortname_for_positional_arg(self, location): # type: (common.SourceLocation) -> None """Add an error about required short_name for positional args.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_MISSING_SHORTNAME_FOR_POSITIONAL, "Missing 'short_name' for positional arg") def add_invalid_short_name(self, location, name): # type: (common.SourceLocation, str) -> None """Add an error about invalid short names.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_INVALID_SHORT_NAME, ("Invalid 'short_name' value '%s'") % (name)) def add_invalid_single_name(self, location, name): # type: (common.SourceLocation, str) -> None """Add an error about invalid single names.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_INVALID_SINGLE_NAME, ("Invalid 'single_name' value '%s'") % (name)) def add_missing_short_name_with_single_name(self, location, name): # type: (common.SourceLocation, str) -> None """Add an error about missing required short name when using single name.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_MISSING_SHORT_NAME_WITH_SINGLE_NAME, ("Missing 'short_name' required with 'single_name' value '%s'") % (name)) def add_feature_flag_default_true_missing_version(self, location): # type: (common.SourceLocation) -> None """Add an error about a default flag with a default value of true but no version.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_FEATURE_FLAG_DEFAULT_TRUE_MISSING_VERSION, ("Missing 'version' required for feature flag that defaults to true")) def add_feature_flag_default_false_has_version(self, location): # type: (common.SourceLocation) -> None """Add an error about a default flag with a default value of false but has a version.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_FEATURE_FLAG_DEFAULT_FALSE_HAS_VERSION, ("The 'version' attribute is not allowed for feature flag that defaults to false")) @@ -879,7 +834,6 @@ class ParserContext(object): def add_reply_type_invalid_type(self, location, command_name, reply_type_name): # type: (common.SourceLocation, str, str) -> None """Add an error about a command whose reply_type refers to an unknown type.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_INVALID_REPLY_TYPE, ("Command '%s' has invalid reply_type '%s'" % (command_name, reply_type_name))) @@ -887,7 +841,6 @@ class ParserContext(object): def add_stability_no_api_version(self, location, command_name): # type: (common.SourceLocation, str) -> None """Add an error about a command with 'stability' but no 'api_version'.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_STABILITY_NO_API_VERSION, ("Command '%s' specifies 'stability' but has no 'api_version'" % (command_name, ))) @@ -895,7 +848,6 @@ class ParserContext(object): def add_missing_reply_type(self, location, command_name): # type: (common.SourceLocation, str) -> None """Add an error about a command with 'api_version' but no 'reply_type'.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_MISSING_REPLY_TYPE, ("Command '%s' has an 'api_version' but no 'reply_type'" % (command_name, ))) @@ -903,7 +855,6 @@ class ParserContext(object): def add_bad_field_always_serialize_not_optional(self, location, field_name): # type: (common.SourceLocation, str) -> None """Add an error about a field with 'always_serialize' but 'optional' isn't set to true.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_ILLEGAL_FIELD_ALWAYS_SERIALIZE_NOT_OPTIONAL, ("Field '%s' specifies 'always_serialize' but 'optional' isn't true.") % (field_name)) @@ -911,21 +862,18 @@ class ParserContext(object): def add_duplicate_command_name_and_alias(self, node): # type: (yaml.nodes.Node) -> None """Add an error about a command name and command alias having the same name.""" - # pylint: disable=invalid-name self._add_node_error(node, ERROR_ID_COMMAND_DUPLICATES_NAME_AND_ALIAS, "Duplicate command_name and command_alias found.") def add_unknown_enum_value(self, location, enum_name, enum_value): # type: (common.SourceLocation, str, str) -> None """Add an error about an unknown enum value.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_UNKOWN_ENUM_VALUE, "Cannot find enum value '%s' in enum '%s'." % (enum_value, enum_name)) def add_either_check_or_privilege(self, location): # type: (common.SourceLocation) -> None """Add an error about specifing both a check and a privilege or neither.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_EITHER_CHECK_OR_PRIVILEGE, "Must specify either a 'check' and a 'privilege' in an access_check, not both.") @@ -933,21 +881,18 @@ class ParserContext(object): def add_duplicate_action_types(self, location, name): # type: (common.SourceLocation, str) -> None """Add an error about specifying an action type twice in the same list.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_DUPLICATE_ACTION_TYPE, "Cannot specify an action_type '%s' more then once" % (name)) def add_duplicate_access_check(self, location, name): # type: (common.SourceLocation, str) -> None """Add an error about specifying an access check twice in the same list.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_DUPLICATE_ACCESS_CHECK, "Cannot specify an access_check '%s' more then once" % (name)) def add_duplicate_privilege(self, location, resource_pattern, action_type): # type: (common.SourceLocation, str, str) -> None """Add an error about specifying a privilege twice in the same list.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_DUPLICATE_PRIVILEGE, "Cannot specify the pair of resource_pattern '%s' and action_type '%s' more then once" % @@ -956,7 +901,6 @@ class ParserContext(object): def add_empty_access_check(self, location): # type: (common.SourceLocation) -> None """Add an error about specifying one of ignore, none, simple or complex in an access check.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_EMPTY_ACCESS_CHECK, "Must one and only one of either a 'ignore', 'none', 'simple', or 'complex' in an access_check." @@ -965,14 +909,12 @@ class ParserContext(object): def add_missing_access_check(self, location, name): # type: (common.SourceLocation, str) -> None """Add an error about a missing access_check when api_version != "".""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_MISSING_ACCESS_CHECK, 'Command "%s" has api_version != "" but is missing access_check.' % (name)) def add_stability_unknown_value(self, location): # type: (common.SourceLocation) -> None """Add an error about a field with unknown value set to 'stability' option.""" - # pylint: disable=invalid-name self._add_error( location, ERROR_ID_STABILITY_UNKNOWN_VALUE, "Field option 'stability' has unknown value, should be one of 'stable', 'unstable' or 'internal.'" @@ -981,7 +923,6 @@ class ParserContext(object): def add_duplicate_unstable_stability(self, location): # type: (common.SourceLocation) -> None """Add an error about a field specifying both 'unstable' and 'stability'.""" - # pylint: disable=invalid-name self._add_error(location, ERROR_ID_DUPLICATE_UNSTABLE_STABILITY, ( "Field specifies both 'unstable' and 'stability' options, should use 'stability: [stable|unstable|internal]' instead and remove the deprecated 'unstable' option." )) diff --git a/buildscripts/idl/idl/generator.py b/buildscripts/idl/idl/generator.py index 7636f684494..337fe5df7c5 100644 --- a/buildscripts/idl/idl/generator.py +++ b/buildscripts/idl/idl/generator.py @@ -25,7 +25,6 @@ # exception statement from all source files in the program, then also delete # it in the license file. # -# pylint: disable=too-many-lines """IDL C++ Code Generator.""" import hashlib @@ -441,8 +440,6 @@ class _CppFileWriterBase(object): class _CppHeaderFileWriter(_CppFileWriterBase): """C++ .h File writer.""" - # pylint: disable=too-many-public-methods - def gen_class_declaration_block(self, class_name): # type: (str) -> writer.IndentedScopedBlock """Generate a class declaration block.""" @@ -494,7 +491,6 @@ class _CppHeaderFileWriter(_CppFileWriterBase): def gen_protected_serializer_methods(self, struct): # type: (ast.Struct) -> None - # pylint: disable=invalid-name """Generate protected serializer method declarations.""" struct_type_info = struct_types.get_struct_info(struct) @@ -628,7 +624,6 @@ class _CppHeaderFileWriter(_CppFileWriterBase): def gen_string_constants_declarations(self, struct): # type: (ast.Struct) -> None - # pylint: disable=invalid-name """Generate a StringData constant for field name.""" for field in _get_all_fields(struct): @@ -740,7 +735,6 @@ class _CppHeaderFileWriter(_CppFileWriterBase): def gen_comparison_operators_declarations(self, struct): # type: (ast.Struct) -> None """Generate comparison operators declarations for the type.""" - # pylint: disable=invalid-name with self._block("auto _relopTuple() const {", "}"): sorted_fields = sorted([ @@ -979,7 +973,6 @@ class _CppHeaderFileWriter(_CppFileWriterBase): def generate(self, spec): # type: (ast.IDLAST) -> None """Generate the C++ header to a stream.""" - # pylint: disable=too-many-branches,too-many-statements,too-many-locals,too-many-return-statements self.gen_file_header() self._writer.write_unindented_line('#pragma once') @@ -1174,7 +1167,6 @@ class _CppHeaderFileWriter(_CppFileWriterBase): class _CppSourceFileWriter(_CppFileWriterBase): - # pylint: disable=too-many-public-methods """C++ .cpp File writer.""" _EMPTY_TENANT = "boost::optional<mongo::TenantId>{}" @@ -1187,7 +1179,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): def _gen_field_deserializer_expression(self, element_name, field, ast_type, tenant): # type: (str, ast.Field, ast.Type, str) -> str - # pylint: disable=invalid-name,too-many-return-statements """ Generate the C++ deserializer piece for a field. @@ -1305,7 +1296,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): def _gen_variant_deserializer(self, field, bson_element, tenant): # type: (ast.Field, str, str) -> None - # pylint: disable=too-many-statements """Generate the C++ deserializer piece for a variant field.""" self._writer.write_empty_line() self._writer.write_line('const BSONType variantType = %s.type();' % (bson_element, )) @@ -1403,7 +1393,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): If field_type is scalar and check_type is True (the default), generate type-checking code. Array elements are always type-checked. """ - # pylint: disable=too-many-arguments if field_type.is_array: predicate = "MONGO_likely(ctxt.checkAndAssertType(%s, Array))" % (bson_element) with self._predicate(predicate): @@ -1510,7 +1499,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): def gen_op_msg_request_namespace_check(self, struct): # type: (ast.Struct) -> None """Generate a namespace check for a command.""" - # pylint: disable=invalid-name if not isinstance(struct, ast.Command): return @@ -1526,7 +1514,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): def _gen_constructor(self, struct, constructor, default_init): # type: (ast.Struct, struct_types.MethodInfo, bool) -> None """Generate the C++ constructor definition.""" - # pylint: disable=too-many-branches initializers = ['_%s(std::move(%s))' % (arg.name, arg.name) for arg in constructor.args] @@ -1625,7 +1612,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): def _gen_fields_deserializer_common(self, struct, bson_object, tenant=_EMPTY_TENANT): # type: (ast.Struct, str, str) -> _FieldUsageCheckerBase """Generate the C++ code to deserialize list of fields.""" - # pylint: disable=too-many-branches field_usage_check = _get_field_usage_checker(self._writer, struct) if isinstance(struct, ast.Command): self._writer.write_line('BSONElement commandElement;') @@ -1713,7 +1699,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): def get_bson_deserializer_static_common(self, struct, static_method_info, method_info): # type: (ast.Struct, struct_types.MethodInfo, struct_types.MethodInfo) -> None """Generate the C++ deserializer static method.""" - # pylint: disable=invalid-name func_def = static_method_info.get_definition() with self._block('%s {' % (func_def), '}'): @@ -1834,7 +1819,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): def gen_op_msg_request_deserializer_methods(self, struct): # type: (ast.Struct) -> None """Generate the C++ deserializer method definitions from OpMsgRequest.""" - # pylint: disable=invalid-name # Commands that have concatentate_with_db namespaces require db name as a parameter # 'Empty' structs (those with no fields) don't need to be deserialized if not isinstance(struct, ast.Command): @@ -2032,7 +2016,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): def _gen_serializer_method_common(self, field): # type: (ast.Field) -> None - # pylint: disable=too-many-locals """Generate the serialize method definition.""" member_name = _get_field_member_name(field) @@ -2189,7 +2172,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): def gen_op_msg_request_serializer_method(self, struct): # type: (ast.Struct) -> None """Generate the serialzer method definition for OpMsgRequest.""" - # pylint: disable=invalid-name if not isinstance(struct, ast.Command): return @@ -2214,7 +2196,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): def gen_string_constants_definitions(self, struct): # type: (ast.Struct) -> None - # pylint: disable=invalid-name """Generate a StringData constant for field name in the cpp file.""" for field in _get_all_fields(struct): @@ -2236,7 +2217,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): def gen_authorization_contract_definition(self, struct): # type: (ast.Struct) -> None - # pylint: disable=invalid-name """Generate the authorization contract defintion.""" if not isinstance(struct, ast.Command): @@ -2575,8 +2555,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): # type: (ast.IDLAST, str) -> None """Generate Config Option instances.""" - # pylint: disable=too-many-branches,too-many-statements - has_storage_targets = False for opt in spec.configs: if opt.cpp_varname is not None: @@ -2645,8 +2623,6 @@ class _CppSourceFileWriter(_CppFileWriterBase): # type: (ast.IDLAST, str) -> None """Generate the C++ source to a stream.""" - # pylint: disable=too-many-statements - self.gen_file_header() # Include platform/basic.h diff --git a/buildscripts/idl/idl/parser.py b/buildscripts/idl/idl/parser.py index b4d47c2c0c1..5f4d0cbec19 100644 --- a/buildscripts/idl/idl/parser.py +++ b/buildscripts/idl/idl/parser.py @@ -25,7 +25,6 @@ # exception statement from all source files in the program, then also delete # it in the license file. # -# pylint: disable=too-many-lines """ IDL Parser. @@ -91,7 +90,6 @@ def _generic_parser( syntax_node, # type: Any mapping_rules # type: Dict[str, _RuleDesc] ): # type: (...) -> None - # pylint: disable=too-many-branches field_name_set = set() # type: Set[str] for [first_node, second_node] in node.value: @@ -810,8 +808,6 @@ def _parse_command(ctxt, spec, name, node): # type: (errors.ParserContext, syntax.IDLSpec, str, Union[yaml.nodes.MappingNode, yaml.nodes.ScalarNode, yaml.nodes.SequenceNode]) -> None """Parse a command section in the IDL file.""" - # pylint: disable=too-many-branches - if not ctxt.is_mapping_node(node, "command"): return @@ -1034,7 +1030,6 @@ def _parse(stream, error_file_name): stream: is a io.Stream. error_file_name: just a file name for error messages to use. """ - # pylint: disable=too-many-branches # This will raise an exception if the YAML parse fails root_node = yaml.compose(stream) @@ -1128,7 +1123,6 @@ def parse(stream, input_file_name, resolver): stream: is a io.Stream. input_file_name: a file name for error messages to use, and to help resolve imported files. """ - # pylint: disable=too-many-locals root_doc = _parse(stream, input_file_name) diff --git a/buildscripts/idl/idl/struct_types.py b/buildscripts/idl/idl/struct_types.py index 6aeb1760db0..1559d8ecd52 100644 --- a/buildscripts/idl/idl/struct_types.py +++ b/buildscripts/idl/idl/struct_types.py @@ -83,7 +83,6 @@ class MethodInfo(object): def __init__(self, class_name, method_name, args, return_type=None, static=False, const=False, explicit=False): # type: (str, str, List[str], str, bool, bool, bool) -> None - # pylint: disable=too-many-arguments """Create a MethodInfo instance.""" self.class_name = class_name self.method_name = method_name @@ -193,21 +192,18 @@ class StructTypeInfoBase(object, metaclass=ABCMeta): def get_op_msg_request_serializer_method(self): # type: () -> Optional[MethodInfo] """Get the OpMsg serializer method for a struct.""" - # pylint: disable=invalid-name pass @abstractmethod def get_op_msg_request_deserializer_static_method(self): # type: () -> Optional[MethodInfo] """Get the public static OpMsg deserializer method for a struct.""" - # pylint: disable=invalid-name pass @abstractmethod def get_op_msg_request_deserializer_method(self): # type: () -> Optional[MethodInfo] """Get the protected OpMsg deserializer method for a struct.""" - # pylint: disable=invalid-name pass @abstractmethod diff --git a/buildscripts/idl/idl/syntax.py b/buildscripts/idl/idl/syntax.py index 83245954cc1..90d53bebeae 100644 --- a/buildscripts/idl/idl/syntax.py +++ b/buildscripts/idl/idl/syntax.py @@ -234,7 +234,6 @@ class SymbolTable(object): def resolve_field_type(self, ctxt, location, field_name, field_type): # type: (errors.ParserContext, common.SourceLocation, str, FieldType) -> Optional[Union[Enum, Struct, Type]] """Find the type or struct a field refers to or log an error.""" - # pylint: disable=too-many-return-statements,too-many-branches,too-many-locals if isinstance(field_type, FieldTypeVariant): variant = VariantType(field_type.file_name, field_type.line, field_type.column) @@ -358,8 +357,6 @@ class Type(common.SourceLocation): populated. """ - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a Type.""" @@ -413,8 +410,6 @@ class Validator(common.SourceLocation): If more than one is included, they must ALL evaluate to true. """ - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a Validator.""" @@ -449,8 +444,6 @@ class Field(common.SourceLocation): populated. """ - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a Field.""" @@ -515,8 +508,6 @@ class Struct(common.SourceLocation): All fields are either required or have a non-None default. """ - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a Struct.""" @@ -634,8 +625,6 @@ class Command(Struct): Namespace is required. """ - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a Command.""" @@ -846,8 +835,6 @@ class ServerParameterClass(common.SourceLocation): class ServerParameter(common.SourceLocation): """IDL ServerParameter information.""" - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a ServerParameter.""" @@ -873,8 +860,6 @@ class ServerParameter(common.SourceLocation): class FeatureFlag(common.SourceLocation): """IDL FeatureFlag information.""" - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a FeatureFlag.""" @@ -917,8 +902,6 @@ class ConfigGlobal(common.SourceLocation): class ConfigOption(common.SourceLocation): """Runtime configuration setting definition.""" - # pylint: disable=too-many-instance-attributes - def __init__(self, file_name, line, column): # type: (str, int, int) -> None """Construct a ConfigOption.""" diff --git a/buildscripts/idl/idl/writer.py b/buildscripts/idl/idl/writer.py index 4e82fcf1f21..5884e0cbf2e 100644 --- a/buildscripts/idl/idl/writer.py +++ b/buildscripts/idl/idl/writer.py @@ -77,7 +77,6 @@ def get_method_name(name): def get_method_name_from_qualified_method_name(name): # type: (str) -> str - # pylint: disable=invalid-name """Get a method name from a fully qualified method name.""" # TODO: in the future, we may want to support full-qualified calls to static methods # Strip the global prefix from enum functions diff --git a/buildscripts/idl/idl_check_compatibility.py b/buildscripts/idl/idl_check_compatibility.py index 80a417231c9..dc6e44422a8 100644 --- a/buildscripts/idl/idl_check_compatibility.py +++ b/buildscripts/idl/idl_check_compatibility.py @@ -25,7 +25,6 @@ # exception statement from all source files in the program, then also delete # it in the license file. # -# pylint: disable=too-many-lines """Checks compatibility of old and new IDL files. In order to support user-selectable API versions for the server, server commands are now @@ -463,7 +462,6 @@ def get_field_type(field: Union[syntax.Field, syntax.Command], idl_file: syntax. def check_subset(ctxt: IDLCompatibilityContext, cmd_name: str, field_name: str, type_name: str, sub_list: List[Union[str, syntax.EnumValue]], super_list: List[Union[str, syntax.EnumValue]], file_path: str): - # pylint: disable=too-many-arguments """Check if sub_list is a subset of the super_list and log an error if not.""" if not set(sub_list).issubset(super_list): ctxt.add_reply_field_not_subset_error(cmd_name, field_name, type_name, file_path) @@ -473,7 +471,6 @@ def check_superset(ctxt: IDLCompatibilityContext, cmd_name: str, type_name: str, super_list: List[Union[str, syntax.EnumValue]], sub_list: List[Union[str, syntax.EnumValue]], file_path: str, param_name: Optional[str], is_command_parameter: bool): - # pylint: disable=too-many-arguments """Check if super_list is a superset of the sub_list and log an error if not.""" if not set(super_list).issuperset(sub_list): ctxt.add_command_or_param_type_not_superset_error(cmd_name, type_name, file_path, @@ -482,7 +479,6 @@ def check_superset(ctxt: IDLCompatibilityContext, cmd_name: str, type_name: str, def check_reply_field_type_recursive(ctxt: IDLCompatibilityContext, field_pair: FieldCompatibilityPair) -> None: - # pylint: disable=too-many-branches """Check compatibility between old and new reply field type if old field type is a syntax.Type instance.""" old_field = field_pair.old new_field = field_pair.new @@ -598,7 +594,6 @@ def check_reply_field_type_recursive(ctxt: IDLCompatibilityContext, def check_reply_field_type(ctxt: IDLCompatibilityContext, field_pair: FieldCompatibilityPair): """Check compatibility between old and new reply field type.""" - # pylint: disable=too-many-branches old_field = field_pair.old new_field = field_pair.new cmd_name = field_pair.cmd_name @@ -665,7 +660,6 @@ def check_array_type(ctxt: IDLCompatibilityContext, symbol: str, - ArrayTypeCheckResult.FALSE : when the old type and new type aren't of array type. - ArrayTypeCheckResult.INVALID : when one of the types is not of array type while the other one is. """ - # pylint: disable=too-many-arguments,too-many-branches old_is_array = isinstance(old_type, syntax.ArrayType) new_is_array = isinstance(new_type, syntax.ArrayType) if not old_is_array and not new_is_array: @@ -684,7 +678,6 @@ def check_reply_field(ctxt: IDLCompatibilityContext, old_field: syntax.Field, new_idl_file: syntax.IDLParsedSpec, old_idl_file_path: str, new_idl_file_path: str): """Check compatibility between old and new reply field.""" - # pylint: disable=too-many-arguments old_field_type = get_field_type(old_field, old_idl_file, old_idl_file_path) new_field_type = get_field_type(new_field, new_idl_file, new_idl_file_path) old_field_optional = old_field.optional or (old_field_type @@ -730,7 +723,6 @@ def check_reply_fields(ctxt: IDLCompatibilityContext, old_reply: syntax.Struct, new_idl_file: syntax.IDLParsedSpec, old_idl_file_path: str, new_idl_file_path: str): """Check compatibility between old and new reply fields.""" - # pylint: disable=too-many-arguments,too-many-branches for new_chained_type in new_reply.chained_types or []: resolved_new_chained_type = get_chained_type_or_struct(new_chained_type, new_idl_file, new_idl_file_path) @@ -805,7 +797,6 @@ def check_reply_fields(ctxt: IDLCompatibilityContext, old_reply: syntax.Struct, def check_param_or_command_type_recursive(ctxt: IDLCompatibilityContext, field_pair: FieldCompatibilityPair, is_command_parameter: bool): - # pylint: disable=too-many-branches,too-many-locals """ Check compatibility between old and new command or param type recursively. @@ -936,7 +927,6 @@ def check_param_or_command_type_recursive(ctxt: IDLCompatibilityContext, def check_param_or_command_type(ctxt: IDLCompatibilityContext, field_pair: FieldCompatibilityPair, is_command_parameter: bool): """Check compatibility between old and new command parameter type or command type.""" - # pylint: disable=too-many-branches old_field = field_pair.old new_field = field_pair.new field_name = field_pair.field_name @@ -1004,7 +994,6 @@ def check_param_or_type_validator(ctxt: IDLCompatibilityContext, old_field: synt Check compatibility between old and new validators in command parameter type and command type struct fields. """ - # pylint: disable=too-many-arguments if new_field.validator: if old_field.validator: if new_field.validator != old_field.validator: @@ -1034,7 +1023,6 @@ def check_command_params_or_type_struct_fields( cmd_name: str, old_idl_file: syntax.IDLParsedSpec, new_idl_file: syntax.IDLParsedSpec, old_idl_file_path: str, new_idl_file_path: str, is_command_parameter: bool): """Check compatibility between old and new parameters or command type fields.""" - # pylint: disable=too-many-arguments,too-many-branches # Check chained types. for old_chained_type in old_struct.chained_types or []: resolved_old_chained_type = get_chained_type_or_struct(old_chained_type, old_idl_file, @@ -1137,7 +1125,6 @@ def check_command_param_or_type_struct_field( old_idl_file_path: str, new_idl_file_path: str, type_name: Optional[str], is_command_parameter: bool): """Check compatibility between the old and new command parameter or command type struct field.""" - # pylint: disable=too-many-arguments ignore_list_name: str = cmd_name + "-param-" + new_field.name if not is_unstable(old_field.stability) and is_unstable( new_field.stability) and ignore_list_name not in IGNORE_STABLE_TO_UNSTABLE_LIST: @@ -1188,7 +1175,6 @@ def check_namespace(ctxt: IDLCompatibilityContext, old_cmd: syntax.Command, new_ old_idl_file: syntax.IDLParsedSpec, new_idl_file: syntax.IDLParsedSpec, old_idl_file_path: str, new_idl_file_path: str): """Check compatibility between old and new namespace.""" - # pylint: disable=too-many-arguments old_namespace = old_cmd.namespace new_namespace = new_cmd.namespace @@ -1364,7 +1350,7 @@ def check_security_access_checks(ctxt: IDLCompatibilityContext, new_access_checks: syntax.AccessChecks, cmd: syntax.Command, new_idl_file_path: str) -> None: """Check the compatibility between security access checks of the old and new command.""" - # pylint:disable=too-many-locals,too-many-branches,too-many-nested-blocks + # pylint:disable=too-many-nested-blocks cmd_name = cmd.command_name if old_access_checks is not None and new_access_checks is not None: old_access_check_type = old_access_checks.get_access_check_type() @@ -1405,7 +1391,6 @@ def check_security_access_checks(ctxt: IDLCompatibilityContext, def check_compatibility(old_idl_dir: str, new_idl_dir: str, old_import_directories: List[str], new_import_directories: List[str]) -> IDLCompatibilityErrorCollection: """Check IDL compatibility between old and new IDL commands.""" - # pylint: disable=too-many-locals ctxt = IDLCompatibilityContext(old_idl_dir, new_idl_dir, IDLCompatibilityErrorCollection()) new_commands, new_command_file, new_command_file_path = get_new_commands( diff --git a/buildscripts/idl/idl_compatibility_errors.py b/buildscripts/idl/idl_compatibility_errors.py index 6b50aabfeb2..c170031edaf 100644 --- a/buildscripts/idl/idl_compatibility_errors.py +++ b/buildscripts/idl/idl_compatibility_errors.py @@ -25,7 +25,6 @@ # exception statement from all source files in the program, then also delete # it in the license file. # -# pylint: disable=too-many-lines """ Common error handling code for IDL compatibility checker. @@ -151,7 +150,6 @@ class IDLCompatibilityError(object): - file - a string, the path to the IDL file where the error occurred. """ - #pylint: disable=too-many-arguments def __init__(self, error_id: str, command_name: str, msg: str, old_idl_dir: str, new_idl_dir: str, file: str) -> None: """Construct an IDLCompatibility error.""" @@ -182,7 +180,6 @@ class IDLCompatibilityErrorCollection(object): """Initialize IDLCompatibilityErrorCollection.""" self._errors: List[IDLCompatibilityError] = [] - #pylint: disable=too-many-arguments def add(self, error_id: str, command_name: str, msg: str, old_idl_dir: str, new_idl_dir: str, file: str) -> None: """Add an error message with directory information.""" @@ -254,8 +251,6 @@ class IDLCompatibilityContext(object): - single class responsible for producing actual error messages. """ - # pylint:disable=too-many-public-methods - def __init__(self, old_idl_dir: str, new_idl_dir: str, errors: IDLCompatibilityErrorCollection) -> None: """Construct a new IDLCompatibilityContext.""" @@ -319,7 +314,6 @@ class IDLCompatibilityContext(object): def add_command_or_param_type_not_superset_error(self, command_name: str, type_name: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments """Add an error about the command or parameter type not being a superset.""" if is_command_parameter: self._add_error( @@ -339,7 +333,6 @@ class IDLCompatibilityContext(object): def add_command_or_param_type_contains_validator_error(self, command_name: str, field_name: str, file: str, type_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments """ Add an error about a type containing a validator. @@ -361,7 +354,7 @@ class IDLCompatibilityContext(object): def add_command_or_param_type_validators_not_equal_error( self, command_name: str, field_name: str, file: str, type_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments,invalid-name + # pylint: disable=invalid-name """Add an error about the new and old command or parameter type validators not being equal.""" if is_command_parameter: self._add_error( @@ -384,7 +377,6 @@ class IDLCompatibilityContext(object): def add_new_command_or_param_type_bson_any_error( self, command_name: str, old_type: str, new_type: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments """ Add an error about BSON serialization type. @@ -410,7 +402,6 @@ class IDLCompatibilityContext(object): def add_new_command_or_param_type_enum_or_struct_error( self, command_name: str, new_type: str, old_type: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments """ Add an error about a type that is an enum or struct. @@ -434,7 +425,7 @@ class IDLCompatibilityContext(object): def add_new_param_or_command_type_field_added_required_error( self, command_name: str, field_name: str, file: str, type_name: str, is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments,invalid-name + # pylint: disable=invalid-name """ Add a new added required parameter or command type field error. @@ -458,7 +449,6 @@ class IDLCompatibilityContext(object): def add_new_param_or_command_type_field_missing_error(self, command_name: str, field_name: str, file: str, type_name: str, is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments """Add an error about a parameter or command type field that is missing in the new command.""" if is_command_parameter: self._add_error( @@ -475,7 +465,6 @@ class IDLCompatibilityContext(object): def add_new_param_or_command_type_field_required_error(self, command_name: str, field_name: str, file: str, type_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments """ Add a required parameter or command type field error. @@ -497,7 +486,7 @@ class IDLCompatibilityContext(object): def add_new_param_or_command_type_field_stable_required_no_default_error( self, struct_name: str, field_name: str, file: str, type_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments,invalid-name + # pylint: disable=invalid-name """ Add a stable required parameter or command type field error. @@ -523,7 +512,6 @@ class IDLCompatibilityContext(object): def add_new_param_or_command_type_field_unstable_error(self, command_name: str, field_name: str, file: str, type_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments """ Add an unstable parameter or command type field error. @@ -545,7 +533,6 @@ class IDLCompatibilityContext(object): def add_new_command_or_param_type_not_enum_error( self, command_name: str, new_type: str, old_type: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments """ Add an not enum parameter or command type field error. @@ -567,7 +554,6 @@ class IDLCompatibilityContext(object): def add_new_command_or_param_type_not_struct_error( self, command_name: str, new_type: str, old_type: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments """Add an error about the new command or parameter type not being a struct when the old one is.""" if is_command_parameter: self._add_error( @@ -586,7 +572,7 @@ class IDLCompatibilityContext(object): def add_new_command_or_param_type_not_variant_type_error(self, command_name: str, new_type: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments,invalid-name + # pylint: disable=invalid-name """ Add an error about the new command or parameter type not being a variant type. @@ -609,7 +595,7 @@ class IDLCompatibilityContext(object): def add_new_command_or_param_variant_type_not_superset_error( self, command_name: str, variant_type_name: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments,invalid-name + # pylint: disable=invalid-name """ Add an error about the new variant types not being a superset. @@ -635,7 +621,7 @@ class IDLCompatibilityContext(object): def add_new_command_or_param_chained_type_not_superset_error( self, command_name: str, chained_type_name: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments,invalid-name + # pylint: disable=invalid-name """ Add an error about the new chained types not being a superset. @@ -757,7 +743,6 @@ class IDLCompatibilityContext(object): def add_new_reply_field_type_not_enum_error(self, command_name: str, field_name: str, new_field_type: str, old_field_type: str, file: str) -> None: - # pylint: disable=too-many-arguments """Add an error about the new reply field type not being an enum when the old one is.""" self._add_error(ERROR_ID_NEW_REPLY_FIELD_TYPE_NOT_ENUM, command_name, ("'%s' has a reply field or sub-field '%s' of type '%s' " @@ -768,7 +753,6 @@ class IDLCompatibilityContext(object): def add_new_reply_field_type_not_struct_error(self, command_name: str, field_name: str, new_field_type: str, old_field_type: str, file: str) -> None: - # pylint: disable=too-many-arguments """Add an error about the new reply field type not being a struct when the old one is.""" self._add_error(ERROR_ID_NEW_REPLY_FIELD_TYPE_NOT_STRUCT, command_name, ("'%s' has a reply field or sub-field '%s' of type '%s' " @@ -779,7 +763,6 @@ class IDLCompatibilityContext(object): def add_new_reply_field_type_enum_or_struct_error(self, command_name: str, field_name: str, new_field_type: str, old_field_type: str, file: str) -> None: - # pylint: disable=too-many-arguments """ Add an error about a reply field type being incompatible with the old field type. @@ -803,7 +786,6 @@ class IDLCompatibilityContext(object): def add_new_reply_field_variant_type_error(self, command_name: str, field_name: str, old_field_type: str, file: str) -> None: - # pylint: disable=too-many-arguments """Add an error about the new reply field type being variant when the old one is not.""" self._add_error(ERROR_ID_NEW_REPLY_FIELD_VARIANT_TYPE, command_name, ("'%s' has a reply field or sub-field '%s' that has a variant " @@ -813,7 +795,6 @@ class IDLCompatibilityContext(object): def add_new_reply_field_variant_type_not_subset_error( self, command_name: str, field_name: str, variant_type_name: str, file: str) -> None: - # pylint: disable=too-many-arguments """ Add an error about the reply field variant types not being a subset. @@ -829,7 +810,6 @@ class IDLCompatibilityContext(object): def add_new_reply_chained_type_not_subset_error(self, command_name: str, reply_name: str, chained_type_name: str, file: str) -> None: - # pylint: disable=too-many-arguments """ Add an error about the reply chained types not being a subset. @@ -847,7 +827,6 @@ class IDLCompatibilityContext(object): def add_old_command_or_param_type_bson_any_error( self, command_name: str, old_type: str, new_type: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments """ Add an error about BSON serialization type. @@ -872,7 +851,7 @@ class IDLCompatibilityContext(object): def add_old_command_or_param_type_bson_any_not_allowed_error( self, command_name: str, type_name: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments,invalid-name + # pylint: disable=invalid-name """ Add an error about the old command or param type bson serialization type being 'any'. @@ -896,7 +875,7 @@ class IDLCompatibilityContext(object): def add_new_command_or_param_type_bson_any_not_allowed_error( self, command_name: str, type_name: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments,invalid-name + # pylint: disable=invalid-name """ Add an error about the new command or param type bson serialization type being 'any'. @@ -920,7 +899,6 @@ class IDLCompatibilityContext(object): def add_command_or_param_cpp_type_not_equal_error(self, command_name: str, type_name: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments,invalid-name """Add an error about the old and new command or param cpp_type not being equal.""" if is_command_parameter: self._add_error(ERROR_ID_COMMAND_PARAMETER_CPP_TYPE_NOT_EQUAL, command_name, @@ -937,7 +915,6 @@ class IDLCompatibilityContext(object): def add_command_or_param_serializer_not_equal_error(self, command_name: str, type_name: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments,invalid-name """Add an error about the old and new command or param serializer not being equal.""" if is_command_parameter: self._add_error(ERROR_ID_COMMAND_PARAMETER_SERIALIZER_NOT_EQUAL, command_name, @@ -954,7 +931,6 @@ class IDLCompatibilityContext(object): def add_command_or_param_deserializer_not_equal_error(self, command_name: str, type_name: str, file: str, field_name: Optional[str], is_command_parameter: bool) -> None: - # pylint: disable=too-many-arguments,invalid-name """Add an error about the old and new command or param deserializer not being equal.""" if is_command_parameter: self._add_error(ERROR_ID_COMMAND_PARAMETER_DESERIALIZER_NOT_EQUAL, command_name, @@ -1034,7 +1010,6 @@ class IDLCompatibilityContext(object): def add_type_not_array_error(self, symbol: str, command_name: str, symbol_name: str, new_type: str, old_type: str, file: str) -> None: - # pylint: disable=too-many-arguments """ Add an error about type not being an ArrayType when it should be. diff --git a/buildscripts/idl/tests/test_binder.py b/buildscripts/idl/tests/test_binder.py index b4fc4700250..19b5973c19d 100644 --- a/buildscripts/idl/tests/test_binder.py +++ b/buildscripts/idl/tests/test_binder.py @@ -27,7 +27,6 @@ # exception statement from all source files in the program, then also delete # it in the license file. # -# pylint: disable=too-many-lines """Test cases for IDL binder.""" import textwrap @@ -69,8 +68,6 @@ def indent_text(count, unindented_text): class TestBinder(testcase.IDLTestcase): """Test cases for the IDL binder.""" - # pylint: disable=too-many-public-methods - # Create a text wrap for common types. common_types = textwrap.dedent(""" types: @@ -1834,7 +1831,6 @@ class TestBinder(testcase.IDLTestcase): def test_command_doc_sequence_positive(self): # type: () -> None """Positive supports_doc_sequence tests.""" - # pylint: disable=invalid-name # Setup some common types test_preamble = self.common_types + textwrap.dedent(""" @@ -1875,7 +1871,6 @@ class TestBinder(testcase.IDLTestcase): def test_command_doc_sequence_negative(self): # type: () -> None """Negative supports_doc_sequence tests.""" - # pylint: disable=invalid-name # Setup some common types test_preamble = self.common_types diff --git a/buildscripts/idl/tests/test_compatibility.py b/buildscripts/idl/tests/test_compatibility.py index 4e5b684c656..8632c14e8be 100644 --- a/buildscripts/idl/tests/test_compatibility.py +++ b/buildscripts/idl/tests/test_compatibility.py @@ -34,7 +34,6 @@ import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) -# pylint: disable=too-many-lines import idl_check_compatibility # noqa: E402 pylint: disable=wrong-import-position import idl_compatibility_errors # noqa: E402 pylint: disable=wrong-import-position @@ -140,7 +139,7 @@ class TestIDLCompatibilityChecker(unittest.TestCase): str(new_command_type_struct_bson_serialization_type_any_error), "newCommandTypeStructFieldBsonSerializationTypeAny") - # pylint: disable=too-many-locals,too-many-statements,invalid-name + # pylint: disable=invalid-name def test_should_fail(self): """Tests that incompatible old and new IDL commands should fail.""" dir_path = path.dirname(path.realpath(__file__)) diff --git a/buildscripts/idl/tests/test_parser.py b/buildscripts/idl/tests/test_parser.py index 122a0e6c64d..7caca54b07f 100644 --- a/buildscripts/idl/tests/test_parser.py +++ b/buildscripts/idl/tests/test_parser.py @@ -28,7 +28,6 @@ # it in the license file. # """Test cases for IDL parser.""" -# pylint: disable=too-many-lines import textwrap import unittest @@ -46,7 +45,6 @@ else: class TestParser(testcase.IDLTestcase): - # pylint: disable=too-many-public-methods """Test the IDL parser only.""" def test_empty(self): @@ -1386,7 +1384,6 @@ class TestParser(testcase.IDLTestcase): def test_command_doc_sequence_positive(self): # type: () -> None """Positive supports_doc_sequence test cases.""" - # pylint: disable=invalid-name # supports_doc_sequence can be false self.assert_parse( @@ -1421,7 +1418,6 @@ class TestParser(testcase.IDLTestcase): def test_command_doc_sequence_negative(self): # type: () -> None """Negative supports_doc_sequence test cases.""" - # pylint: disable=invalid-name # supports_doc_sequence must be a bool self.assert_parse_fail( diff --git a/buildscripts/libdeps/gacli.py b/buildscripts/libdeps/gacli.py index 92841c3a1f4..a7e2fc5da1d 100755 --- a/buildscripts/libdeps/gacli.py +++ b/buildscripts/libdeps/gacli.py @@ -225,7 +225,6 @@ def load_graph_data(graph_file, output_format): def main(): - # pylint: disable=too-many-branches """Perform graph analysis based on input args.""" args = setup_args_parser() diff --git a/buildscripts/libdeps/graph_visualizer_web_stack/flask/flask_backend.py b/buildscripts/libdeps/graph_visualizer_web_stack/flask/flask_backend.py index d8bc80ac853..1c106160552 100644 --- a/buildscripts/libdeps/graph_visualizer_web_stack/flask/flask_backend.py +++ b/buildscripts/libdeps/graph_visualizer_web_stack/flask/flask_backend.py @@ -49,7 +49,6 @@ import libdeps.analyzer class BackendServer: """Create small class for storing variables and state of the backend.""" - # pylint: disable=too-many-instance-attributes def __init__(self, graphml_dir, frontend_url, memory_limit): """Create and setup the state variables.""" self.app = flask.Flask(__name__) diff --git a/buildscripts/libdeps/libdeps/analyzer.py b/buildscripts/libdeps/libdeps/analyzer.py index 129e6b92a53..3b3ab40bac1 100644 --- a/buildscripts/libdeps/libdeps/analyzer.py +++ b/buildscripts/libdeps/libdeps/analyzer.py @@ -21,7 +21,6 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -# pylint: disable=too-many-lines """ Libdeps Graph Analysis Tool. @@ -116,7 +115,6 @@ def schema_check(func, schema_version): class Analyzer: """Base class for different types of analyzers.""" - # pylint: disable=too-many-instance-attributes def __init__(self, dependency_graph, progress=True): """Store the graph and extract the build_dir from the graph.""" @@ -575,7 +573,6 @@ class Efficiency(Analyzer): @schema_check(schema_version=1) def run(self): """Find efficiency of each public dependency originating from a node.""" - # pylint:disable=too-many-nested-blocks efficiencies_data = {} @@ -912,7 +909,6 @@ class GaPrettyPrinter(GaPrinter): def _print_depends_reports(self, results): """Print the depends reports result data.""" - # pylint: disable=too-many-branches if DependsReportTypes.DIRECT_DEPENDS.name in results: print("\nNodes that directly depend on:") for node in results[DependsReportTypes.DIRECT_DEPENDS.name]: diff --git a/buildscripts/linter/base.py b/buildscripts/linter/base.py index 863cbfbc8e9..eb3832568d5 100644 --- a/buildscripts/linter/base.py +++ b/buildscripts/linter/base.py @@ -26,9 +26,8 @@ class LinterBase(object, metaclass=ABCMeta): """Get the command to run a linter.""" pass - def get_fix_cmd_args(self, file_name): + def get_fix_cmd_args(self, _file_name): # type: (str) -> Optional[List[str]] - # pylint: disable=no-self-use,unused-argument """Get the command to run a linter fix.""" return None @@ -40,7 +39,6 @@ class LinterBase(object, metaclass=ABCMeta): def needs_file_diff(self): # type: () -> bool - # pylint: disable=no-self-use """ Check if we need to diff the output of this linter with the original file. diff --git a/buildscripts/linter/git.py b/buildscripts/linter/git.py index ef321620305..37218ca46f8 100644 --- a/buildscripts/linter/git.py +++ b/buildscripts/linter/git.py @@ -71,7 +71,7 @@ class Repo(_git.Repository): Returns the full path to the file for clang-format to consume. """ - if candidates is not None and len(candidates) > 0: # pylint: disable=len-as-condition + if candidates is not None and len(candidates) > 0: candidates = [self._get_local_dir(f) for f in candidates] valid_files = list( set(candidates).intersection(self.get_candidate_files(filter_function))) @@ -122,7 +122,6 @@ class Repo(_git.Repository): def get_working_tree_candidate_files(self, filter_function): # type: (Callable[[str], bool]) -> List[str] - # pylint: disable=invalid-name """Query git to get a list of all files in the working tree to consider for analysis.""" return self._git_ls_files(["--cached", "--others"], filter_function) diff --git a/buildscripts/linter/git_base.py b/buildscripts/linter/git_base.py index f54bc8e87c5..852cb74fc28 100644 --- a/buildscripts/linter/git_base.py +++ b/buildscripts/linter/git_base.py @@ -6,7 +6,7 @@ import subprocess LOGGER = logging.getLogger(__name__) -class Repository(object): # pylint: disable=too-many-public-methods +class Repository(object): """Represent a local git repository.""" def __init__(self, directory): @@ -239,8 +239,8 @@ class GitException(Exception): """ - def __init__( # pylint: disable=too-many-arguments - self, message, returncode=None, cmd=None, process_args=None, stdout=None, stderr=None): + def __init__(self, message, returncode=None, cmd=None, process_args=None, stdout=None, + stderr=None): """Initialize GitException.""" Exception.__init__(self, message) self.returncode = returncode @@ -262,8 +262,7 @@ class GitCommandResult(object): """ - def __init__( # pylint: disable=too-many-arguments - self, cmd, process_args, returncode, stdout=None, stderr=None): + def __init__(self, cmd, process_args, returncode, stdout=None, stderr=None): """Initialize GitCommandResult.""" self.cmd = cmd self.process_args = process_args diff --git a/buildscripts/linter/runner.py b/buildscripts/linter/runner.py index 46680865f92..1a0fd3e56b2 100644 --- a/buildscripts/linter/runner.py +++ b/buildscripts/linter/runner.py @@ -65,7 +65,6 @@ def _find_linter(linter, config_dict): Return a LinterInstance with the location of the linter binary if a linter binary with the matching version is found. None otherwise. """ - # pylint: disable=too-many-branches,too-many-return-statements if linter.cmd_name in config_dict and config_dict[linter.cmd_name] is not None: cmd = [config_dict[linter.cmd_name]] @@ -172,7 +171,6 @@ class LintRunner(object): def run_lint(self, linter, file_name): # type: (base.LinterInstance, str) -> bool """Run the specified linter for the file.""" - # pylint: disable=too-many-locals linter_args = linter.linter.get_lint_cmd_args(file_name) if not linter_args: diff --git a/buildscripts/lldb/lldb_printers.py b/buildscripts/lldb/lldb_printers.py index 8989dbfca2e..6c0bee9d53b 100644 --- a/buildscripts/lldb/lldb_printers.py +++ b/buildscripts/lldb/lldb_printers.py @@ -119,18 +119,18 @@ class UniquePtrPrinter: self.valobj = valobj self.update() - def num_children(self): # pylint: disable=no-self-use,no-method-argument + def num_children(self): """Match LLDB's expected API.""" return 1 - def get_child_index(self, name): # pylint: disable=no-self-use,no-method-argument + def get_child_index(self, name): """Match LLDB's expected API.""" if name == "ptr": return 0 else: return None - def get_child_at_index(self, index): # pylint: disable=no-self-use,no-method-argument + def get_child_at_index(self, index): """Match LLDB's expected API. Always prints object pointed at by the ptr. @@ -141,11 +141,11 @@ class UniquePtrPrinter: else: return None - def has_children(): # pylint: disable=no-self-use,no-method-argument + def has_children(self): """Match LLDB's expected API.""" return True - def update(self): # pylint: disable=no-self-use,no-method-argument + def update(self): """Match LLDB's expected API.""" pass @@ -158,25 +158,25 @@ class OptionalPrinter: self.valobj = valobj self.update() - def num_children(self): # pylint: disable=no-self-use,no-method-argument + def num_children(self): """Match LLDB's expected API.""" return 1 - def get_child_index(self, name): # pylint: disable=no-self-use,no-method-argument + def get_child_index(self, name): """Match LLDB's expected API.""" if name == "value": return 0 else: return None - def get_child_at_index(self, index): # pylint: disable=no-self-use,no-method-argument + def get_child_at_index(self, index): """Match LLDB's expected API.""" if index == 0: return self.value else: return None - def has_children(): # pylint: disable=no-self-use,no-method-argument + def has_children(self): """Match LLDB's expected API.""" return True diff --git a/buildscripts/make_vcxproj.py b/buildscripts/make_vcxproj.py index 0d53b28e711..a2efabafe47 100644 --- a/buildscripts/make_vcxproj.py +++ b/buildscripts/make_vcxproj.py @@ -145,7 +145,7 @@ def _replace_vcxproj(file_name, restore_elements): file_handle.write(str_value) -class ProjFileGenerator(object): # pylint: disable=too-many-instance-attributes +class ProjFileGenerator(object): """Generate a .vcxproj and .vcxprof.filters file.""" def __init__(self, target, vs_version): @@ -274,7 +274,7 @@ class ProjFileGenerator(object): # pylint: disable=too-many-instance-attributes return True return False - def __write_filters(self): # pylint: disable=too-many-branches + def __write_filters(self): """Generate the vcxproj.filters file.""" # 1. get a list of directories for all the files # 2. get all the C++ files in each of these dirs diff --git a/buildscripts/moduleconfig.py b/buildscripts/moduleconfig.py index b4d0bba0490..3076e22be50 100644 --- a/buildscripts/moduleconfig.py +++ b/buildscripts/moduleconfig.py @@ -33,7 +33,6 @@ import os def discover_modules(module_root, allowed_modules): - # pylint: disable=too-many-branches """Scan module_root for subdirectories that look like MongoDB modules. Return a list of imported build.py module objects. diff --git a/buildscripts/mongosymb.py b/buildscripts/mongosymb.py index 035b00f3a07..ca29f46ed37 100755 --- a/buildscripts/mongosymb.py +++ b/buildscripts/mongosymb.py @@ -31,13 +31,12 @@ from typing import Dict, List, Any, Union, Optional import requests -# pylint: disable=wrong-import-position -# pylint: disable=too-many-branches from tenacity import wait_fixed, stop_after_delay, retry_if_result, Retrying sys.path.append(str(Path(os.getcwd(), __file__).parent.parent)) -from buildscripts.util.oauth import Configs, get_oauth_credentials, get_client_cred_oauth_credentials -from buildscripts.build_system_options import PathOptions + +from buildscripts.util.oauth import Configs, get_oauth_credentials, get_client_cred_oauth_credentials #pylint: disable=wrong-import-position +from buildscripts.build_system_options import PathOptions #pylint: disable=wrong-import-position SYMBOLIZER_PATH_ENV = "MONGOSYMB_SYMBOLIZER_PATH" # since older versions may have issues with symbolizing, we are setting the toolchain version to v4 @@ -180,7 +179,6 @@ class PathResolver(DbgFileResolver): Cache size differs according to the situation, system resources and overall decision of development team. """ - # pylint: disable=too-many-instance-attributes # This amount of attributes are necessary. # the main (API) sever that we'll be sending requests to diff --git a/buildscripts/packager.py b/buildscripts/packager.py index 380498be593..ef281a0b907 100755 --- a/buildscripts/packager.py +++ b/buildscripts/packager.py @@ -192,7 +192,6 @@ class Distro(object): Power and x86 have different names for apt/yum (ppc64le/ppc64el and x86_64/amd64). """ - # pylint: disable=too-many-return-statements if re.search("^(debian|ubuntu)", self.dname): if arch == "ppc64le": return "ppc64el" @@ -217,7 +216,6 @@ class Distro(object): return "x86_64" else: raise Exception("BUG: unsupported platform?") - # pylint: enable=too-many-return-statements def repodir(self, arch, build_os, spec): # noqa: D406,D407,D412,D413 """Return the directory where we'll place the package files for (distro, distro_version). @@ -276,13 +274,13 @@ class Distro(object): else: raise Exception("unsupported distro: %s" % self.dname) - def repo_os_version(self, build_os): # pylint: disable=too-many-branches + def repo_os_version(self, build_os): """Return an OS version suitable for package repo directory naming. Example, 5, 6 or 7 for redhat/centos, "precise," "wheezy," etc. for Ubuntu/Debian, 11 for suse, "2013.03" for amazon. """ - # pylint: disable=too-many-return-statements + if self.dname == 'suse': return re.sub(r'^suse(\d+)$', r'\1', build_os) if self.dname == 'redhat': @@ -319,7 +317,6 @@ class Distro(object): raise Exception("unsupported build_os: %s" % build_os) else: raise Exception("unsupported distro: %s" % self.dname) - # pylint: enable=too-many-return-statements def make_pkg(self, build_os, arch, spec, srcdir): """Return the package.""" @@ -668,7 +665,7 @@ Description: MongoDB packages os.chdir(oldpwd) -def move_repos_into_place(src, dst): # pylint: disable=too-many-branches +def move_repos_into_place(src, dst): """Move the repos into place.""" # Find all the stuff in src/*, move it to a freshly-created # directory beside dst, then play some games with symlinks so that @@ -758,7 +755,7 @@ def write_debian_changelog(path, spec, srcdir): fh.write(sb) -def make_rpm(distro, build_os, arch, spec, srcdir): # pylint: disable=too-many-locals +def make_rpm(distro, build_os, arch, spec, srcdir): """Create the RPM specfile.""" suffix = spec.suffix() sdir = setupdir(distro, build_os, arch, spec) diff --git a/buildscripts/packager_enterprise.py b/buildscripts/packager_enterprise.py index b8f042f6cf9..14751b81452 100755 --- a/buildscripts/packager_enterprise.py +++ b/buildscripts/packager_enterprise.py @@ -116,13 +116,12 @@ class EnterpriseDistro(packager.Distro): else: raise Exception("BUG: unsupported platform?") - def build_os(self, arch): # pylint: disable=too-many-branches + def build_os(self, arch): """Return the build os label in the binary package to download. The labels "rhel57", "rhel62", "rhel67", "rhel70", "rhel80" are for redhat, the others are delegated to the super class. """ - # pylint: disable=too-many-return-statements if arch == "ppc64le": if self.dname == 'ubuntu': return ["ubuntu1604", "ubuntu1804"] @@ -150,7 +149,6 @@ class EnterpriseDistro(packager.Distro): if re.search("(redhat|fedora|centos)", self.dname): return ["rhel80", "rhel70", "rhel62", "rhel57"] return super(EnterpriseDistro, self).build_os(arch) - # pylint: enable=too-many-return-statements def main(): @@ -321,7 +319,7 @@ Description: MongoDB packages os.chdir(oldpwd) -def move_repos_into_place(src, dst): # pylint: disable=too-many-branches +def move_repos_into_place(src, dst): """Move the repos into place.""" # Find all the stuff in src/*, move it to a freshly-created # directory beside dst, then play some games with symlinks so that diff --git a/buildscripts/pylinters.py b/buildscripts/pylinters.py index 147def19f57..df356ab8d83 100755 --- a/buildscripts/pylinters.py +++ b/buildscripts/pylinters.py @@ -176,7 +176,7 @@ def _fix_files(linters, config_dict, file_names): for linter in linter_instances: run_linter = lambda param1: lint_runner.run(linter.cmd_path + linter.linter. # pylint: disable=cell-var-from-loop - get_fix_cmd_args(param1)) # pylint: disable=cell-var-from-loop + get_fix_cmd_args(param1)) lint_clean = parallel.parallel_process([os.path.abspath(f) for f in file_names], run_linter) diff --git a/buildscripts/quickcpplint.py b/buildscripts/quickcpplint.py index df75a40d8ad..8d78a9c9d5c 100755 --- a/buildscripts/quickcpplint.py +++ b/buildscripts/quickcpplint.py @@ -63,7 +63,6 @@ def lint_all(file_names: List[str]) -> None: def lint_my(origin_branch: List[str]) -> None: - # pylint: disable=unused-argument """Lint files command based on local changes.""" files = git.get_my_files_to_check(is_interesting_file, origin_branch) files = [f for f in files if os.path.exists(f)] diff --git a/buildscripts/resmokelib/configure_resmoke.py b/buildscripts/resmokelib/configure_resmoke.py index af8a0fb09fe..0adf81ca691 100644 --- a/buildscripts/resmokelib/configure_resmoke.py +++ b/buildscripts/resmokelib/configure_resmoke.py @@ -97,7 +97,7 @@ def _validate_options(parser, args): parser.error(str(error_msgs)) -def _validate_config(parser): # pylint: disable=too-many-branches +def _validate_config(parser): """Do validation on the config settings.""" if _config.REPEAT_TESTS_MAX: @@ -150,7 +150,7 @@ def _find_resmoke_wrappers(): return list(candidate_installs) -def _update_config_vars(values): # pylint: disable=too-many-statements,too-many-locals,too-many-branches +def _update_config_vars(values): """Update the variables of the config module.""" config = _config.DEFAULTS.copy() diff --git a/buildscripts/resmokelib/core/pipe.py b/buildscripts/resmokelib/core/pipe.py index 168345049f8..53c065e252f 100644 --- a/buildscripts/resmokelib/core/pipe.py +++ b/buildscripts/resmokelib/core/pipe.py @@ -13,7 +13,7 @@ from typing import List MAX_LOG_LINE = int(3.5 * 1024 * 1024) -class LoggerPipe(threading.Thread): # pylint: disable=too-many-instance-attributes +class LoggerPipe(threading.Thread): """Asynchronously reads the output of a subprocess and sends it to a logger.""" # The start() and join() methods are not intended to be called directly on the LoggerPipe diff --git a/buildscripts/resmokelib/core/process.py b/buildscripts/resmokelib/core/process.py index f4517aa6cef..f8c457e808d 100644 --- a/buildscripts/resmokelib/core/process.py +++ b/buildscripts/resmokelib/core/process.py @@ -76,8 +76,6 @@ class Process(object): """Wrapper around subprocess.Popen class.""" # pylint: disable=protected-access - # pylint: disable=too-many-arguments - # pylint: disable=too-many-instance-attributes def __init__(self, logger, args, env=None, env_vars=None, cwd=None): """Initialize the process with the specified logger, arguments, and environment.""" @@ -175,7 +173,7 @@ class Process(object): if return_code == win32con.STILL_ACTIVE: raise - def stop(self, mode=None): # pylint: disable=too-many-branches + def stop(self, mode=None): """Terminate the process.""" if mode is None: mode = fixture_interface.TeardownMode.TERMINATE diff --git a/buildscripts/resmokelib/core/programs.py b/buildscripts/resmokelib/core/programs.py index 8c94cadcad9..11f40520752 100644 --- a/buildscripts/resmokelib/core/programs.py +++ b/buildscripts/resmokelib/core/programs.py @@ -76,7 +76,7 @@ def mongod_program(logger, job_num, executable, process_kwargs, mongod_options): return make_process(logger, args, **process_kwargs), mongod_options["port"] -def mongos_program(logger, job_num, executable=None, process_kwargs=None, mongos_options=None): # pylint: disable=too-many-arguments +def mongos_program(logger, job_num, executable=None, process_kwargs=None, mongos_options=None): """Return a Process instance that starts a mongos with arguments constructed from 'kwargs'.""" args = [executable] @@ -97,9 +97,8 @@ def mongos_program(logger, job_num, executable=None, process_kwargs=None, mongos return make_process(logger, args, **process_kwargs), mongos_options["port"] -def mongo_shell_program( # pylint: disable=too-many-arguments,too-many-branches,too-many-locals,too-many-statements - logger, executable=None, connection_string=None, filename=None, test_filename=None, - process_kwargs=None, **kwargs): +def mongo_shell_program(logger, executable=None, connection_string=None, filename=None, + test_filename=None, process_kwargs=None, **kwargs): """Return a Process instance that starts a mongo shell. The shell is started with the given connection string and arguments constructed from 'kwargs'. diff --git a/buildscripts/resmokelib/generate_fcv_constants/__init__.py b/buildscripts/resmokelib/generate_fcv_constants/__init__.py index 2ccbc9e5b60..287c899e48c 100644 --- a/buildscripts/resmokelib/generate_fcv_constants/__init__.py +++ b/buildscripts/resmokelib/generate_fcv_constants/__init__.py @@ -28,7 +28,7 @@ class GenerateFCVConstants(Subcommand): # This will cause multiversion constants to be generated. self._setup_logging() - import buildscripts.resmokelib.multiversionconstants # pylint: disable=unused-import + import buildscripts.resmokelib.multiversionconstants buildscripts.resmokelib.multiversionconstants.log_constants(self._exec_logger) diff --git a/buildscripts/resmokelib/hang_analyzer/dumper.py b/buildscripts/resmokelib/hang_analyzer/dumper.py index e5112b870b3..8f8fb7efdcc 100644 --- a/buildscripts/resmokelib/hang_analyzer/dumper.py +++ b/buildscripts/resmokelib/hang_analyzer/dumper.py @@ -7,7 +7,7 @@ import sys import tempfile from abc import ABCMeta, abstractmethod from collections import namedtuple -from distutils import spawn # pylint: disable=no-name-in-module +from distutils import spawn from buildscripts.resmokelib.hang_analyzer.process import call, callo, find_program from buildscripts.resmokelib.hang_analyzer.process_list import Pinfo @@ -52,7 +52,7 @@ class Dumper(metaclass=ABCMeta): self._dbg_output = dbg_output @abstractmethod - def dump_info( # pylint: disable=too-many-arguments,too-many-locals + def dump_info( self, pinfo: Pinfo, take_dump: bool, @@ -174,8 +174,7 @@ class WindowsDumper(Dumper): return cmds - def dump_info( # pylint: disable=too-many-arguments - self, pinfo, take_dump): + def dump_info(self, pinfo, take_dump): """Dump useful information to the console.""" debugger = "cdb.exe" dbg = self._find_debugger(debugger) @@ -358,8 +357,7 @@ class GDBDumper(Dumper): ] return cmds - def _process_specific( # pylint: disable=too-many-locals - self, pinfo, take_dump, logger=None): + def _process_specific(self, pinfo, take_dump, logger=None): """Return the commands that attach to each process, dump info and detach.""" cmds = [] diff --git a/buildscripts/resmokelib/hang_analyzer/hang_analyzer.py b/buildscripts/resmokelib/hang_analyzer/hang_analyzer.py index 44d0b23e54e..9af3d1095fb 100755 --- a/buildscripts/resmokelib/hang_analyzer/hang_analyzer.py +++ b/buildscripts/resmokelib/hang_analyzer/hang_analyzer.py @@ -33,7 +33,7 @@ from buildscripts.resmokelib.symbolizer import Symbolizer class HangAnalyzer(Subcommand): """Main class for the hang analyzer subcommand.""" - def __init__(self, options, task_id=None, logger=None, **_kwargs): # pylint: disable=unused-argument + def __init__(self, options, task_id=None, logger=None, **_kwargs): """ Configure processe lists based on options. @@ -68,7 +68,7 @@ class HangAnalyzer(Subcommand): self._configure_processes() self._setup_logging(logger) - def execute(self): # pylint: disable=too-many-branches,too-many-locals,too-many-statements + def execute(self): """ Execute hang analysis. diff --git a/buildscripts/resmokelib/hang_analyzer/process.py b/buildscripts/resmokelib/hang_analyzer/process.py index 629f78a2594..9f40c20fe12 100644 --- a/buildscripts/resmokelib/hang_analyzer/process.py +++ b/buildscripts/resmokelib/hang_analyzer/process.py @@ -6,7 +6,7 @@ import signal import subprocess import sys import time -from distutils import spawn # pylint: disable=no-name-in-module +from distutils import spawn from datetime import datetime import psutil diff --git a/buildscripts/resmokelib/logging/buildlogger.py b/buildscripts/resmokelib/logging/buildlogger.py index 597291b7219..1d0421369c3 100644 --- a/buildscripts/resmokelib/logging/buildlogger.py +++ b/buildscripts/resmokelib/logging/buildlogger.py @@ -218,9 +218,8 @@ class _BaseBuildloggerHandler(handlers.BufferedHandler): class BuildloggerTestHandler(_BaseBuildloggerHandler): """Buildlogger handler for the test logs.""" - def __init__( # pylint: disable=too-many-arguments - self, build_config, build_id, test_id, capacity=_SEND_AFTER_LINES, - interval_secs=_SEND_AFTER_SECS): + def __init__(self, build_config, build_id, test_id, capacity=_SEND_AFTER_LINES, + interval_secs=_SEND_AFTER_SECS): """Initialize the buildlogger handler with the credentials, build id, and test id.""" endpoint = APPEND_TEST_LOGS_ENDPOINT % { "build_id": build_id, diff --git a/buildscripts/resmokelib/logging/handlers.py b/buildscripts/resmokelib/logging/handlers.py index f0a6fc724f1..46542e96792 100644 --- a/buildscripts/resmokelib/logging/handlers.py +++ b/buildscripts/resmokelib/logging/handlers.py @@ -31,8 +31,6 @@ class BufferedHandler(logging.Handler): should be flushed. If it should, then flush() is expected to do what's needed. """ - # pylint: disable=too-many-instance-attributes - def __init__(self, capacity, interval_secs): """Initialize the handler with the buffer size and timeout. @@ -84,7 +82,7 @@ class BufferedHandler(logging.Handler): """Release.""" pass - def process_record(self, record): # pylint: disable=no-self-use + def process_record(self, record): """Apply a transformation to the record before it gets added to the buffer. The default implementation returns 'record' unmodified. diff --git a/buildscripts/resmokelib/logging/loggers.py b/buildscripts/resmokelib/logging/loggers.py index 6d5fee06912..a5464420307 100644 --- a/buildscripts/resmokelib/logging/loggers.py +++ b/buildscripts/resmokelib/logging/loggers.py @@ -193,7 +193,6 @@ def new_testqueue_logger(test_kind): return logger -#pylint: disable=too-many-arguments def new_test_logger(test_shortname, test_basename, command, parent, job_num, test_id, job_logger): """Create a new test logger that will be a child of the given parent.""" name = "%s:%s" % (parent.name, test_shortname) diff --git a/buildscripts/resmokelib/multiversion/multiversion_service.py b/buildscripts/resmokelib/multiversion/multiversion_service.py index 90cbd7698bf..98c986005ee 100644 --- a/buildscripts/resmokelib/multiversion/multiversion_service.py +++ b/buildscripts/resmokelib/multiversion/multiversion_service.py @@ -163,15 +163,15 @@ class MongoReleases(BaseModel): def get_fcv_versions(self) -> List[Version]: """Get the Version representation of all fcv versions.""" - return [Version(fcv) for fcv in self.feature_compatibility_versions] + return [Version(fcv) for fcv in self.feature_compatibility_versions] # pylint: disable=not-an-iterable def get_lts_versions(self) -> List[Version]: """Get the Version representation of the lts versions.""" - return [Version(lts) for lts in self.long_term_support_releases] + return [Version(lts) for lts in self.long_term_support_releases] # pylint: disable=not-an-iterable def get_eol_versions(self) -> List[Version]: """Get the Version representation of the EOL versions.""" - return [Version(eol) for eol in self.eol_versions] + return [Version(eol) for eol in self.eol_versions] # pylint: disable=not-an-iterable class MultiversionService: diff --git a/buildscripts/resmokelib/powercycle/__init__.py b/buildscripts/resmokelib/powercycle/__init__.py index 943bdfc2d79..0712dffb6d6 100644 --- a/buildscripts/resmokelib/powercycle/__init__.py +++ b/buildscripts/resmokelib/powercycle/__init__.py @@ -103,7 +103,7 @@ class PowercyclePlugin(PluginInterface): # Only need to return run_parser for further processing; others don't need additional args. return run_parser - def add_subcommand(self, subparsers): # pylint: disable=too-many-statements + def add_subcommand(self, subparsers): """Create and add the parser for the subcommand.""" intermediate_parser = subparsers.add_parser( SUBCOMMAND, help=__doc__, usage=""" diff --git a/buildscripts/resmokelib/powercycle/lib/__init__.py b/buildscripts/resmokelib/powercycle/lib/__init__.py index 4cc3492d42f..bdb177189b3 100644 --- a/buildscripts/resmokelib/powercycle/lib/__init__.py +++ b/buildscripts/resmokelib/powercycle/lib/__init__.py @@ -18,7 +18,7 @@ from buildscripts.resmokelib.powercycle.lib.named_temp_file import NamedTempFile LOGGER = logging.getLogger(__name__) -# pylint: disable=abstract-method, too-many-instance-attributes +# pylint: disable=abstract-method class PowercycleCommand(Subcommand): """Base class for remote operations to set up powercycle.""" diff --git a/buildscripts/resmokelib/powercycle/lib/remote_operations.py b/buildscripts/resmokelib/powercycle/lib/remote_operations.py index a011e786f75..6d4405e6bd3 100644 --- a/buildscripts/resmokelib/powercycle/lib/remote_operations.py +++ b/buildscripts/resmokelib/powercycle/lib/remote_operations.py @@ -46,12 +46,11 @@ def posix_path(path): return "{quote}{path}{quote}".format(quote=path_quote, path=new_path) -class RemoteOperations(object): # pylint: disable=too-many-instance-attributes +class RemoteOperations(object): """Class to support remote operations.""" - def __init__( # pylint: disable=too-many-arguments - self, user_host, ssh_connection_options=None, ssh_options=None, scp_options=None, - shell_binary="/bin/bash", use_shell=False, ignore_ret=False, access_retry_count=5): + def __init__(self, user_host, ssh_connection_options=None, ssh_options=None, scp_options=None, + shell_binary="/bin/bash", use_shell=False, ignore_ret=False, access_retry_count=5): """Initialize RemoteOperations.""" self.user_host = user_host @@ -125,7 +124,7 @@ class RemoteOperations(object): # pylint: disable=too-many-instance-attributes """ return message.startswith("ssh:") - # pylint: disable=too-many-branches,too-many-arguments,too-many-locals,inconsistent-return-statements + # pylint: disable=inconsistent-return-statements def operation(self, operation_type, operation_param, operation_dir=None, retry=False, retry_count=5): """Execute Main entry for remote operations. Returns (code, output). diff --git a/buildscripts/resmokelib/powercycle/lib/services.py b/buildscripts/resmokelib/powercycle/lib/services.py index d43d32e9ae9..2cd1cc4c959 100644 --- a/buildscripts/resmokelib/powercycle/lib/services.py +++ b/buildscripts/resmokelib/powercycle/lib/services.py @@ -37,7 +37,7 @@ if _IS_WINDOWS: _try_import("win32serviceutil") -# pylint: disable=undefined-variable,unused-variable,too-many-instance-attributes +# pylint: disable=undefined-variable,unused-variable class WindowsService(object): """Windows service control class.""" @@ -191,15 +191,15 @@ class PosixService(object): self.db_path = db_path self.pids = [] - def create(self): # pylint: disable=no-self-use + def create(self): """Simulate create service. Returns (code, output) tuple.""" return 0, None - def update(self): # pylint: disable=no-self-use + def update(self): """Simulate update service. Returns (code, output) tuple.""" return 0, None - def delete(self): # pylint: disable=no-self-use + def delete(self): """Simulate delete service. Returns (code, output) tuple.""" return 0, None diff --git a/buildscripts/resmokelib/powercycle/powercycle.py b/buildscripts/resmokelib/powercycle/powercycle.py index 84718599dd1..38f7b9413f7 100755 --- a/buildscripts/resmokelib/powercycle/powercycle.py +++ b/buildscripts/resmokelib/powercycle/powercycle.py @@ -3,7 +3,7 @@ import atexit import collections import copy import datetime -import distutils.spawn # pylint: disable=no-name-in-module +import distutils.spawn import importlib import json import logging @@ -69,8 +69,6 @@ if _IS_WINDOWS: _try_import("win32service") _try_import("win32serviceutil") -# pylint: disable=too-many-lines - LOGGER = logging.getLogger(__name__) ONE_HOUR_SECS = 60 * 60 @@ -596,11 +594,10 @@ class Processes(object): cls.kill(proc) -class MongodControl(object): # pylint: disable=too-many-instance-attributes +class MongodControl(object): """Control mongod process.""" - def __init__( # pylint: disable=too-many-arguments - self, bin_dir, db_path, log_path, port, options=None): + def __init__(self, bin_dir, db_path, log_path, port, options=None): """Initialize MongodControl.""" self.process_name = "mongod{}".format(executable_extension()) @@ -725,9 +722,8 @@ class LocalToRemoteOperations(object): Return (return code, output). """ - def __init__( # pylint: disable=too-many-arguments - self, user_host, ssh_connection_options=None, ssh_options=None, - shell_binary="/bin/bash", use_shell=False, access_retry_count=5): + def __init__(self, user_host, ssh_connection_options=None, ssh_options=None, + shell_binary="/bin/bash", use_shell=False, access_retry_count=5): """Initialize LocalToRemoteOperations.""" self.remote_op = remote_operations.RemoteOperations( @@ -760,7 +756,6 @@ class LocalToRemoteOperations(object): return self.remote_op.access_info() -# pylint: disable=too-many-branches,too-many-locals,too-many-statements def remote_handler(options, task_config, root_dir): """Remote operations handler executes all remote operations on the remote host. @@ -1055,8 +1050,7 @@ def internal_crash(): return 1, "Crash did not occur" -def crash_server_or_kill_mongod( # pylint: disable=too-many-arguments,too-many-locals - task_config, crash_canary, local_ops, script_name, client_args): +def crash_server_or_kill_mongod(task_config, crash_canary, local_ops, script_name, client_args): """Crash server or kill mongod and optionally write canary doc. Return tuple (ret, output).""" crash_wait_time = powercycle_constants.CRASH_WAIT_TIME + random.randint( @@ -1127,8 +1121,7 @@ def get_mongo_client_args(host=None, port=None, task_config=None, return mongo_args -def mongo_shell( # pylint: disable=too-many-arguments - mongo_path, work_dir, host_port, mongo_cmds, retries=5, retry_sleep=5): +def mongo_shell(mongo_path, work_dir, host_port, mongo_cmds, retries=5, retry_sleep=5): """Start mongo_path from work_dir, connecting to host_port and executes mongo_cmds.""" cmds = "cd {}; echo {} | {} {}".format( pipes.quote(work_dir), pipes.quote(mongo_cmds), pipes.quote(mongo_path), host_port) @@ -1268,9 +1261,8 @@ def new_resmoke_config(config_file, new_config_file, test_data, eval_str=""): yaml.safe_dump(config, yaml_stream) -def resmoke_client( # pylint: disable=too-many-arguments - work_dir, mongo_path, host_port, js_test, resmoke_suite, repeat_num=1, no_wait=False, - log_file=None): +def resmoke_client(work_dir, mongo_path, host_port, js_test, resmoke_suite, repeat_num=1, + no_wait=False, log_file=None): """Start resmoke client from work_dir, connecting to host_port and executes js_test.""" log_output = f">> {log_file} 2>&1" if log_file else "" cmds = (f"cd {pipes.quote(work_dir)};" @@ -1300,7 +1292,7 @@ def get_remote_python(): return remote_python -def main(parser_actions, options): # pylint: disable=too-many-branches,too-many-locals,too-many-statements +def main(parser_actions, options): """Execute Main program.""" # pylint: disable=global-statement diff --git a/buildscripts/resmokelib/powercycle/powercycle_config.py b/buildscripts/resmokelib/powercycle/powercycle_config.py index 4b84e3f8912..91592431cc1 100644 --- a/buildscripts/resmokelib/powercycle/powercycle_config.py +++ b/buildscripts/resmokelib/powercycle/powercycle_config.py @@ -6,7 +6,7 @@ from buildscripts.resmokelib.powercycle import powercycle, powercycle_constants POWERCYCLE_TASKS_CONFIG = "buildscripts/resmokeconfig/powercycle/powercycle_tasks.yml" -class PowercycleTaskConfig: # pylint: disable=too-many-instance-attributes +class PowercycleTaskConfig: """Class represents single task in powercycle tasks config.""" def __init__(self, task_yaml): diff --git a/buildscripts/resmokelib/powercycle/remote_hang_analyzer/__init__.py b/buildscripts/resmokelib/powercycle/remote_hang_analyzer/__init__.py index f83464db90b..d0ab930ff92 100644 --- a/buildscripts/resmokelib/powercycle/remote_hang_analyzer/__init__.py +++ b/buildscripts/resmokelib/powercycle/remote_hang_analyzer/__init__.py @@ -13,7 +13,7 @@ class RunHangAnalyzerOnRemoteInstance(PowercycleCommand): COMMAND = "runHangAnalyzerOnRemoteInstance" - def execute(self) -> None: # pylint: disable=too-many-locals + def execute(self) -> None: """:return: None.""" if "private_ip_address" not in self.expansions: return diff --git a/buildscripts/resmokelib/powercycle/setup/__init__.py b/buildscripts/resmokelib/powercycle/setup/__init__.py index 99c554e2ced..a0021c5655e 100644 --- a/buildscripts/resmokelib/powercycle/setup/__init__.py +++ b/buildscripts/resmokelib/powercycle/setup/__init__.py @@ -12,7 +12,7 @@ class SetUpEC2Instance(PowercycleCommand): COMMAND = "setUpEC2Instance" - def execute(self) -> None: # pylint: disable=too-many-instance-attributes, too-many-locals, too-many-statements + def execute(self) -> None: """:return: None.""" default_retry_count = 2 diff --git a/buildscripts/resmokelib/run/__init__.py b/buildscripts/resmokelib/run/__init__.py index 64652279fa6..99f47b56417 100644 --- a/buildscripts/resmokelib/run/__init__.py +++ b/buildscripts/resmokelib/run/__init__.py @@ -1,5 +1,4 @@ """Command line utility for executing MongoDB tests of all kinds.""" -# pylint: disable=too-many-lines import argparse import collections @@ -40,7 +39,7 @@ _EVERGREEN_ARGUMENT_TITLE = "Evergreen options" _CEDAR_ARGUMENT_TITLE = "Cedar options" -class TestRunner(Subcommand): # pylint: disable=too-many-instance-attributes +class TestRunner(Subcommand): """The main class to run tests with resmoke.""" def __init__(self, command, start_time=time.time()): @@ -285,7 +284,6 @@ class TestRunner(Subcommand): # pylint: disable=too-many-instance-attributes fh.write(f"{resmoke_env_options} {local_resmoke_invocation}") def _check_for_mongo_processes(self): - # pylint: disable=too-many-branches, """Check for existing mongo processes as they could interfere with running the tests.""" if config.AUTO_KILL == 'off' or config.SHELL_CONN_STRING is not None: @@ -599,7 +597,6 @@ class TestRunnerEvg(TestRunner): class RunPlugin(PluginInterface): """Interface to parsing.""" - # pylint: disable=missing-docstring def add_subcommand(self, subparsers): """ Add subcommand parser. @@ -632,7 +629,7 @@ class RunPlugin(PluginInterface): return None @classmethod - def _add_run(cls, subparsers): # pylint: disable=too-many-statements + def _add_run(cls, subparsers): """Create and add the parser for the Run subcommand.""" parser = subparsers.add_parser("run", help="Runs the specified tests.") @@ -1166,7 +1163,7 @@ class RunPlugin(PluginInterface): help="Where to output the generated tags.") -def to_local_args(input_args=None): # pylint: disable=too-many-branches,too-many-locals +def to_local_args(input_args=None): """ Return a command line invocation for resmoke.py suitable for being run outside of Evergreen. diff --git a/buildscripts/resmokelib/selector.py b/buildscripts/resmokelib/selector.py index b9a06e0d742..139cd429f2d 100644 --- a/buildscripts/resmokelib/selector.py +++ b/buildscripts/resmokelib/selector.py @@ -339,10 +339,9 @@ def _make_expression_list(configs): class _SelectorConfig(object): """Base object to represent the configuration for test selection.""" - def __init__( # pylint: disable=too-many-arguments - self, root=None, roots=None, include_files=None, exclude_files=None, include_tags=None, - exclude_tags=None, include_with_any_tags=None, exclude_with_any_tags=None, - tag_file=None): + def __init__(self, root=None, roots=None, include_files=None, exclude_files=None, + include_tags=None, exclude_tags=None, include_with_any_tags=None, + exclude_with_any_tags=None, tag_file=None): """Initialize the _SelectorConfig from the configuration elements. Args: @@ -472,9 +471,9 @@ class _Selector(object): class _JSTestSelectorConfig(_SelectorConfig): """_SelectorConfig subclass for JavaScript tests.""" - def __init__( # pylint: disable=too-many-arguments - self, roots=None, include_files=None, exclude_files=None, include_with_any_tags=None, - exclude_with_any_tags=None, include_tags=None, exclude_tags=None, tag_file=None): + def __init__(self, roots=None, include_files=None, exclude_files=None, + include_with_any_tags=None, exclude_with_any_tags=None, include_tags=None, + exclude_tags=None, tag_file=None): _SelectorConfig.__init__( self, roots=roots, include_files=include_files, exclude_files=exclude_files, include_with_any_tags=include_with_any_tags, diff --git a/buildscripts/resmokelib/setup_multiversion/setup_multiversion.py b/buildscripts/resmokelib/setup_multiversion/setup_multiversion.py index 41c6168ba9b..5df6e47725a 100644 --- a/buildscripts/resmokelib/setup_multiversion/setup_multiversion.py +++ b/buildscripts/resmokelib/setup_multiversion/setup_multiversion.py @@ -93,7 +93,6 @@ class EvgURLInfo(NamedTuple): class SetupMultiversion(Subcommand): """Main class for the setup multiversion subcommand.""" - # pylint: disable=too-many-instance-attributes def __init__(self, download_options, install_dir="", link_dir="", mv_platform=None, edition=None, architecture=None, use_latest=None, versions=None, variant=None, install_last_lts=None, install_last_continuous=None, evergreen_config=None, @@ -373,7 +372,6 @@ class SetupMultiversion(Subcommand): @staticmethod def setup_mongodb(artifacts_url, binaries_url, symbols_url, python_venv_url, install_dir, bin_suffix=None, link_dir=None, install_dir_list=None): - # pylint: disable=too-many-arguments """Download, extract and symlink.""" for url in [artifacts_url, binaries_url, symbols_url, python_venv_url]: diff --git a/buildscripts/resmokelib/suitesconfig.py b/buildscripts/resmokelib/suitesconfig.py index 18fbc138611..51f71b4f74a 100644 --- a/buildscripts/resmokelib/suitesconfig.py +++ b/buildscripts/resmokelib/suitesconfig.py @@ -230,9 +230,7 @@ class MatrixSuiteConfig(SuiteConfigInterface): base_suite = ExplicitSuiteConfig.get_config_obj(base_suite_name) if base_suite is None: - # pylint: disable=too-many-format-args - raise ValueError("Unknown base suite %s for matrix suite %s".format( - base_suite_name, suite_name)) + raise ValueError(f"Unknown base suite {base_suite_name} for matrix suite {suite_name}") res = base_suite.copy() @@ -265,7 +263,7 @@ class MatrixSuiteConfig(SuiteConfigInterface): all_matrix_suites = cls.get_all_mappings(suites_dir) if suite_name in all_matrix_suites.keys(): - return all_matrix_suites[suite_name] # pylint: disable=unsubscriptable-object + return all_matrix_suites[suite_name] return None @classmethod diff --git a/buildscripts/resmokelib/symbolizer/__init__.py b/buildscripts/resmokelib/symbolizer/__init__.py index 444dae336c1..fa90cdbf053 100644 --- a/buildscripts/resmokelib/symbolizer/__init__.py +++ b/buildscripts/resmokelib/symbolizer/__init__.py @@ -161,7 +161,7 @@ class Symbolizer(Subcommand): LOGGER.info("Applying patch diff (if any)...") self._patch_diff_by_id() - except: # pylint: disable=bare-except + except: if self.dest_dir is not None: LOGGER.warning("Removing downloaded directory due to error", directory=self.dest_dir) diff --git a/buildscripts/resmokelib/testing/executor.py b/buildscripts/resmokelib/testing/executor.py index 22c1ffa1593..5d7cff38733 100644 --- a/buildscripts/resmokelib/testing/executor.py +++ b/buildscripts/resmokelib/testing/executor.py @@ -19,7 +19,7 @@ from buildscripts.resmokelib.testing.queue_element import queue_elem_factory, Qu from buildscripts.resmokelib.utils import queue as _queue -class TestSuiteExecutor(object): # pylint: disable=too-many-instance-attributes +class TestSuiteExecutor(object): """Execute a test suite. Responsible for setting up and tearing down the fixtures that the @@ -28,9 +28,8 @@ class TestSuiteExecutor(object): # pylint: disable=too-many-instance-attributes _TIMEOUT = 24 * 60 * 60 # =1 day (a long time to have tests run) - def __init__( # pylint: disable=too-many-arguments - self, exec_logger, suite, config=None, fixture=None, hooks=None, archive_instance=None, - archive=None): + def __init__(self, exec_logger, suite, config=None, fixture=None, hooks=None, + archive_instance=None, archive=None): """Initialize the TestSuiteExecutor with the test suite to run.""" self.logger = exec_logger @@ -66,7 +65,7 @@ class TestSuiteExecutor(object): # pylint: disable=too-many-instance-attributes """ return [self._make_job(job_num) for job_num in range(num_jobs)] - def run(self): # pylint: disable=too-many-branches + def run(self): """Execute the test suite. Any exceptions that occur during setting up or tearing down a diff --git a/buildscripts/resmokelib/testing/fixtures/fixturelib.py b/buildscripts/resmokelib/testing/fixtures/fixturelib.py index 78bda3c8c68..e2ff39d983c 100644 --- a/buildscripts/resmokelib/testing/fixtures/fixturelib.py +++ b/buildscripts/resmokelib/testing/fixtures/fixturelib.py @@ -15,8 +15,6 @@ from buildscripts.resmokelib.testing.fixtures import _builder class FixtureLib: """Class that exposes the resmokelib API that fixtures can use.""" - # pylint: disable=no-self-use - ################# # Logger tools # ################# @@ -45,7 +43,7 @@ class FixtureLib: """Build fixtures by calling builder API.""" return _builder.make_fixture(class_name, logger, job_num, *args, **kwargs) - def mongod_program(self, logger, job_num, executable, process_kwargs, mongod_options): # pylint: disable=too-many-arguments + def mongod_program(self, logger, job_num, executable, process_kwargs, mongod_options): """ Return a Process instance that starts mongod arguments constructed from 'mongod_options'. @@ -58,12 +56,12 @@ class FixtureLib: mongod_options) def mongos_program(self, logger, job_num, executable=None, process_kwargs=None, - mongos_options=None): # pylint: disable=too-many-arguments + mongos_options=None): """Return a Process instance that starts a mongos with arguments constructed from 'kwargs'.""" return core.programs.mongos_program(logger, job_num, executable, process_kwargs, mongos_options) - def generic_program(self, logger, args, process_kwargs=None, **kwargs): # pylint: disable=too-many-arguments + def generic_program(self, logger, args, process_kwargs=None, **kwargs): """Return a Process instance that starts an arbitrary executable. The executable arguments are constructed from 'kwargs'. @@ -112,7 +110,7 @@ class FixtureLib: return original -class _FixtureConfig(object): # pylint: disable=too-many-instance-attributes +class _FixtureConfig(object): """Class that stores fixture configuration info.""" def __init__(self): diff --git a/buildscripts/resmokelib/testing/fixtures/interface.py b/buildscripts/resmokelib/testing/fixtures/interface.py index 8adbe7425f7..57d22f87ec6 100644 --- a/buildscripts/resmokelib/testing/fixtures/interface.py +++ b/buildscripts/resmokelib/testing/fixtures/interface.py @@ -148,11 +148,11 @@ class Fixture(object, metaclass=registry.make_registry_metaclass(_FIXTURES)): # """ pass - def is_running(self): # pylint: disable=no-self-use + def is_running(self): """Return true if the fixture is still operating and more tests and can be run.""" return True - def get_node_info(self): # pylint: disable=no-self-use + def get_node_info(self): """Return a list of NodeInfo objects.""" return [] diff --git a/buildscripts/resmokelib/testing/fixtures/replicaset.py b/buildscripts/resmokelib/testing/fixtures/replicaset.py index a43b72a6d84..d9c463e29c9 100644 --- a/buildscripts/resmokelib/testing/fixtures/replicaset.py +++ b/buildscripts/resmokelib/testing/fixtures/replicaset.py @@ -37,17 +37,16 @@ def compare_optime(optime1, optime2): return compare_timestamp(optime1["ts"], optime2["ts"]) -class ReplicaSetFixture(interface.ReplFixture): # pylint: disable=too-many-instance-attributes, too-many-public-methods +class ReplicaSetFixture(interface.ReplFixture): """Fixture which provides JSTests with a replica set to run against.""" - def __init__( # pylint: disable=too-many-arguments, too-many-locals - self, logger, job_num, fixturelib, mongod_executable=None, mongod_options=None, - dbpath_prefix=None, preserve_dbpath=False, num_nodes=2, start_initial_sync_node=False, - write_concern_majority_journal_default=None, auth_options=None, - replset_config_options=None, voting_secondaries=True, all_nodes_electable=False, - use_replica_set_connection_string=None, linear_chain=False, default_read_concern=None, - default_write_concern=None, shard_logging_prefix=None, replicaset_logging_prefix=None, - replset_name=None): + def __init__(self, logger, job_num, fixturelib, mongod_executable=None, mongod_options=None, + dbpath_prefix=None, preserve_dbpath=False, num_nodes=2, + start_initial_sync_node=False, write_concern_majority_journal_default=None, + auth_options=None, replset_config_options=None, voting_secondaries=True, + all_nodes_electable=False, use_replica_set_connection_string=None, + linear_chain=False, default_read_concern=None, default_write_concern=None, + shard_logging_prefix=None, replicaset_logging_prefix=None, replset_name=None): """Initialize ReplicaSetFixture.""" interface.ReplFixture.__init__(self, logger, job_num, fixturelib, @@ -110,7 +109,7 @@ class ReplicaSetFixture(interface.ReplFixture): # pylint: disable=too-many-inst self.initial_sync_node = None self.initial_sync_node_idx = -1 - def setup(self): # pylint: disable=too-many-branches,too-many-statements,too-many-locals + def setup(self): """Set up the replica set.""" # Version-agnostic options for mongod/s can be set here. diff --git a/buildscripts/resmokelib/testing/fixtures/shard_split.py b/buildscripts/resmokelib/testing/fixtures/shard_split.py index 04f94f9843f..ce80daf270c 100644 --- a/buildscripts/resmokelib/testing/fixtures/shard_split.py +++ b/buildscripts/resmokelib/testing/fixtures/shard_split.py @@ -23,13 +23,13 @@ def _teardown_and_clean_node(node): shutil.rmtree(node.get_dbpath_prefix(), ignore_errors=False) -class ShardSplitFixture(interface.MultiClusterFixture): # pylint: disable=too-many-instance-attributes +class ShardSplitFixture(interface.MultiClusterFixture): """Fixture which provides JSTests with a replica set and recipient nodes to run splits against.""" AWAIT_REPL_TIMEOUT_MINS = 5 AWAIT_REPL_TIMEOUT_FOREVER_MINS = 24 * 60 - def __init__( # pylint: disable=too-many-arguments,too-many-locals + def __init__( self, logger, job_num, diff --git a/buildscripts/resmokelib/testing/fixtures/shardedcluster.py b/buildscripts/resmokelib/testing/fixtures/shardedcluster.py index 84574900e34..7de0c37ba08 100644 --- a/buildscripts/resmokelib/testing/fixtures/shardedcluster.py +++ b/buildscripts/resmokelib/testing/fixtures/shardedcluster.py @@ -11,7 +11,7 @@ import buildscripts.resmokelib.testing.fixtures.interface as interface import buildscripts.resmokelib.testing.fixtures.external as external -class ShardedClusterFixture(interface.Fixture): # pylint: disable=too-many-instance-attributes +class ShardedClusterFixture(interface.Fixture): """Fixture which provides JSTests with a sharded cluster to run against.""" _CONFIGSVR_REPLSET_NAME = "config-rs" @@ -19,12 +19,12 @@ class ShardedClusterFixture(interface.Fixture): # pylint: disable=too-many-inst AWAIT_SHARDING_INITIALIZATION_TIMEOUT_SECS = 60 - def __init__( # pylint: disable=too-many-arguments,too-many-locals - self, logger, job_num, fixturelib, mongos_executable=None, mongos_options=None, - mongod_executable=None, mongod_options=None, dbpath_prefix=None, preserve_dbpath=False, - num_shards=1, num_rs_nodes_per_shard=1, num_mongos=1, enable_sharding=None, - enable_balancer=True, enable_autosplit=True, auth_options=None, configsvr_options=None, - shard_options=None, cluster_logging_prefix=None): + def __init__(self, logger, job_num, fixturelib, mongos_executable=None, mongos_options=None, + mongod_executable=None, mongod_options=None, dbpath_prefix=None, + preserve_dbpath=False, num_shards=1, num_rs_nodes_per_shard=1, num_mongos=1, + enable_sharding=None, enable_balancer=True, enable_autosplit=True, + auth_options=None, configsvr_options=None, shard_options=None, + cluster_logging_prefix=None): """Initialize ShardedClusterFixture with different options for the cluster processes.""" interface.Fixture.__init__(self, logger, job_num, fixturelib, dbpath_prefix=dbpath_prefix) @@ -429,7 +429,6 @@ class ExternalShardedClusterFixture(external.ExternalFixture, ShardedClusterFixt class _MongoSFixture(interface.Fixture): """Fixture which provides JSTests with a mongos to connect to.""" - # pylint: disable=too-many-arguments def __init__(self, logger, job_num, fixturelib, dbpath_prefix, mongos_executable=None, mongos_options=None, add_feature_flags=False): """Initialize _MongoSFixture.""" @@ -542,7 +541,6 @@ class _MongoSFixture(interface.Fixture): exit_code = self.mongos.wait() # Python's subprocess module returns negative versions of system calls. - # pylint: disable=invalid-unary-operand-type if exit_code == 0 or (mode is not None and exit_code == -(mode.value)): self.logger.info("Successfully stopped the mongos on port {:d}".format(self.port)) else: diff --git a/buildscripts/resmokelib/testing/fixtures/standalone.py b/buildscripts/resmokelib/testing/fixtures/standalone.py index 03dc436e15d..5cdf70059e1 100644 --- a/buildscripts/resmokelib/testing/fixtures/standalone.py +++ b/buildscripts/resmokelib/testing/fixtures/standalone.py @@ -17,9 +17,8 @@ import buildscripts.resmokelib.testing.fixtures.interface as interface class MongoDFixture(interface.Fixture): """Fixture which provides JSTests with a standalone mongod to run against.""" - def __init__( # pylint: disable=too-many-arguments - self, logger, job_num, fixturelib, mongod_executable=None, mongod_options=None, - add_feature_flags=False, dbpath_prefix=None, preserve_dbpath=False, port=None): + def __init__(self, logger, job_num, fixturelib, mongod_executable=None, mongod_options=None, + add_feature_flags=False, dbpath_prefix=None, preserve_dbpath=False, port=None): """Initialize MongoDFixture with different options for the mongod process.""" interface.Fixture.__init__(self, logger, job_num, fixturelib, dbpath_prefix=dbpath_prefix) self.mongod_options = self.fixturelib.make_historic( @@ -149,7 +148,6 @@ class MongoDFixture(interface.Fixture): exit_code = self.mongod.wait() # Python's subprocess module returns negative versions of system calls. - # pylint: disable=invalid-unary-operand-type if exit_code == 0 or (mode is not None and exit_code == -(mode.value)): self.logger.info("Successfully stopped the mongod on port {:d}.".format(self.port)) else: @@ -215,8 +213,8 @@ class MongodLauncher(object): self.fixturelib = fixturelib self.config = fixturelib.get_config() - def launch_mongod_program( # pylint: disable=too-many-branches,too-many-statements,too-many-arguments - self, logger, job_num, executable=None, process_kwargs=None, mongod_options=None): + def launch_mongod_program(self, logger, job_num, executable=None, process_kwargs=None, + mongod_options=None): """ Return a Process instance that starts mongod arguments constructed from 'mongod_options'. diff --git a/buildscripts/resmokelib/testing/fixtures/talk_directly_to_shardsvrs.py b/buildscripts/resmokelib/testing/fixtures/talk_directly_to_shardsvrs.py index a241006f679..87ee370d5af 100644 --- a/buildscripts/resmokelib/testing/fixtures/talk_directly_to_shardsvrs.py +++ b/buildscripts/resmokelib/testing/fixtures/talk_directly_to_shardsvrs.py @@ -9,16 +9,16 @@ import buildscripts.resmokelib.testing.fixtures.interface as interface from buildscripts.resmokelib.testing.fixtures.fixturelib import FixtureLib -class TalkDirectlyToShardsvrsFixture(interface.MultiClusterFixture): # pylint: disable=too-many-instance-attributes +class TalkDirectlyToShardsvrsFixture(interface.MultiClusterFixture): """Fixture which provides JSTests with a set of shardsvrs and a config svr set to run against.""" - def __init__( # pylint: disable=too-many-arguments,too-many-locals - self, logger, job_num, fixturelib, common_mongod_options=None, dbpath_prefix=None, - preserve_dbpath=False, num_replica_sets=1, num_nodes_per_replica_set=3, - start_initial_sync_node=False, write_concern_majority_journal_default=None, - auth_options=None, replset_config_options=None, voting_secondaries=True, - all_nodes_electable=False, use_replica_set_connection_string=None, linear_chain=False, - mixed_bin_versions=None, default_read_concern=None, default_write_concern=None): + def __init__(self, logger, job_num, fixturelib, common_mongod_options=None, dbpath_prefix=None, + preserve_dbpath=False, num_replica_sets=1, num_nodes_per_replica_set=3, + start_initial_sync_node=False, write_concern_majority_journal_default=None, + auth_options=None, replset_config_options=None, voting_secondaries=True, + all_nodes_electable=False, use_replica_set_connection_string=None, + linear_chain=False, mixed_bin_versions=None, default_read_concern=None, + default_write_concern=None): """Initialize TalkDirectlyToShardsvrsFixture with different options for the replica set processes.""" interface.MultiClusterFixture.__init__(self, logger, job_num, fixturelib, diff --git a/buildscripts/resmokelib/testing/fixtures/tenant_migration.py b/buildscripts/resmokelib/testing/fixtures/tenant_migration.py index beb48e72f09..1518bdb792e 100644 --- a/buildscripts/resmokelib/testing/fixtures/tenant_migration.py +++ b/buildscripts/resmokelib/testing/fixtures/tenant_migration.py @@ -6,17 +6,16 @@ import buildscripts.resmokelib.testing.fixtures.interface as interface from buildscripts.resmokelib.testing.fixtures.fixturelib import FixtureLib -class TenantMigrationFixture(interface.MultiClusterFixture): # pylint: disable=too-many-instance-attributes +class TenantMigrationFixture(interface.MultiClusterFixture): """Fixture which provides JSTests with a set of replica sets to run tenant migration against.""" - def __init__( # pylint: disable=too-many-arguments,too-many-locals - self, logger, job_num, fixturelib, common_mongod_options=None, per_mongod_options=None, - dbpath_prefix=None, preserve_dbpath=False, num_replica_sets=1, - num_nodes_per_replica_set=2, start_initial_sync_node=False, - write_concern_majority_journal_default=None, auth_options=None, - replset_config_options=None, voting_secondaries=True, all_nodes_electable=False, - use_replica_set_connection_string=None, linear_chain=False, mixed_bin_versions=None, - default_read_concern=None, default_write_concern=None): + def __init__(self, logger, job_num, fixturelib, common_mongod_options=None, + per_mongod_options=None, dbpath_prefix=None, preserve_dbpath=False, + num_replica_sets=1, num_nodes_per_replica_set=2, start_initial_sync_node=False, + write_concern_majority_journal_default=None, auth_options=None, + replset_config_options=None, voting_secondaries=True, all_nodes_electable=False, + use_replica_set_connection_string=None, linear_chain=False, + mixed_bin_versions=None, default_read_concern=None, default_write_concern=None): """Initialize TenantMigrationFixture with different options for the replica set processes.""" interface.MultiClusterFixture.__init__(self, logger, job_num, fixturelib, diff --git a/buildscripts/resmokelib/testing/fixtures/yesfixture.py b/buildscripts/resmokelib/testing/fixtures/yesfixture.py index cf2780ded17..ca594fc52dc 100644 --- a/buildscripts/resmokelib/testing/fixtures/yesfixture.py +++ b/buildscripts/resmokelib/testing/fixtures/yesfixture.py @@ -9,7 +9,7 @@ from buildscripts.resmokelib.testing.fixtures.fixturelib import FixtureLib class YesFixture(interface.Fixture): # pylint: disable=abstract-method """Fixture which spawns several 'yes' executables to generate lots of log messages.""" - def __init__(self, logger, job_num, fixturelib, num_instances=1, message_length=100): # pylint: disable=too-many-arguments + def __init__(self, logger, job_num, fixturelib, num_instances=1, message_length=100): """Initialize YesFixture.""" interface.Fixture.__init__(self, logger, job_num, fixturelib) diff --git a/buildscripts/resmokelib/testing/hooks/antithesis_logging.py b/buildscripts/resmokelib/testing/hooks/antithesis_logging.py index 49b1a357cc5..8df7da69dc8 100644 --- a/buildscripts/resmokelib/testing/hooks/antithesis_logging.py +++ b/buildscripts/resmokelib/testing/hooks/antithesis_logging.py @@ -4,7 +4,7 @@ from time import sleep from buildscripts.resmokelib.testing.hooks import interface -class AntithesisLogging(interface.Hook): # pylint: disable=too-many-instance-attributes +class AntithesisLogging(interface.Hook): """Prints antithesis commands before & after test run.""" DESCRIPTION = "Prints antithesis commands before & after test run." diff --git a/buildscripts/resmokelib/testing/hooks/background_job.py b/buildscripts/resmokelib/testing/hooks/background_job.py index 92dbb5437a4..b01196ba462 100644 --- a/buildscripts/resmokelib/testing/hooks/background_job.py +++ b/buildscripts/resmokelib/testing/hooks/background_job.py @@ -6,7 +6,7 @@ import threading from buildscripts.resmokelib.testing.hooks import jsfile -class _BackgroundJob(threading.Thread): # pylint: disable=too-many-instance-attributes +class _BackgroundJob(threading.Thread): """A thread for running a JS file while a test is running.""" def __init__(self, thread_name): diff --git a/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py b/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py index 3f7f715a319..2ad144e5ec8 100644 --- a/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py +++ b/buildscripts/resmokelib/testing/hooks/cleanup_concurrency_workloads.py @@ -20,8 +20,8 @@ class CleanupConcurrencyWorkloads(interface.Hook): IS_BACKGROUND = False - def __init__( #pylint: disable=too-many-arguments - self, hook_logger, fixture, exclude_dbs=None, same_collection=False, same_db=False): + def __init__(self, hook_logger, fixture, exclude_dbs=None, same_collection=False, + same_db=False): """Initialize CleanupConcurrencyWorkloads.""" description = "CleanupConcurrencyWorkloads drops all databases in the fixture" interface.Hook.__init__(self, hook_logger, fixture, description) diff --git a/buildscripts/resmokelib/testing/hooks/cpp_libfuzzer.py b/buildscripts/resmokelib/testing/hooks/cpp_libfuzzer.py index c5f9c42248e..1053191a64c 100644 --- a/buildscripts/resmokelib/testing/hooks/cpp_libfuzzer.py +++ b/buildscripts/resmokelib/testing/hooks/cpp_libfuzzer.py @@ -6,7 +6,7 @@ from buildscripts.resmokelib import core from buildscripts.resmokelib.testing.hooks import interface -class LibfuzzerHook(interface.Hook): # pylint: disable=too-many-instance-attributes +class LibfuzzerHook(interface.Hook): """Merges inputs after a fuzzer run.""" DESCRIPTION = "Merges inputs after a fuzzer run" diff --git a/buildscripts/resmokelib/testing/hooks/drop_sharded_collections.py b/buildscripts/resmokelib/testing/hooks/drop_sharded_collections.py index 6cc7d66e3dc..db0c3e82534 100644 --- a/buildscripts/resmokelib/testing/hooks/drop_sharded_collections.py +++ b/buildscripts/resmokelib/testing/hooks/drop_sharded_collections.py @@ -13,10 +13,9 @@ class DropShardedCollections(jsfile.JSHook): IS_BACKGROUND = False - def __init__( # pylint: disable=super-init-not-called - self, hook_logger, fixture, shell_options=None): + def __init__(self, hook_logger, fixture, shell_options=None): """.""" description = "Drop all sharded collections" js_filename = os.path.join("jstests", "hooks", "drop_sharded_collections.js") - jsfile.JSHook.__init__( # pylint: disable=non-parent-init-called - self, hook_logger, fixture, js_filename, description, shell_options=shell_options) + jsfile.JSHook.__init__(self, hook_logger, fixture, js_filename, description, + shell_options=shell_options) diff --git a/buildscripts/resmokelib/testing/hooks/enable_spurious_write_conflicts.py b/buildscripts/resmokelib/testing/hooks/enable_spurious_write_conflicts.py index 913d67f8580..70389b9cc3f 100644 --- a/buildscripts/resmokelib/testing/hooks/enable_spurious_write_conflicts.py +++ b/buildscripts/resmokelib/testing/hooks/enable_spurious_write_conflicts.py @@ -15,8 +15,7 @@ class EnableSpuriousWriteConflicts(interface.Hook): IS_BACKGROUND = False - def __init__( # pylint: disable=too-many-arguments - self, hook_logger, fixture, shell_options=None): + def __init__(self, hook_logger, fixture, shell_options=None): """Initialize ToggleWriteConflicts.""" super().__init__(hook_logger, fixture, "TogglesWTWriteConflictExceptions") self._enable_js_filename = os.path.join("jstests", "hooks", "enable_write_conflicts.js") diff --git a/buildscripts/resmokelib/testing/hooks/initialsync.py b/buildscripts/resmokelib/testing/hooks/initialsync.py index 48a0e5f30df..29d43c9c9ff 100644 --- a/buildscripts/resmokelib/testing/hooks/initialsync.py +++ b/buildscripts/resmokelib/testing/hooks/initialsync.py @@ -63,8 +63,7 @@ class BackgroundInitialSyncTestCase(jsfile.DynamicJSTestCase): INTERRUPTED_DUE_TO_REPL_STATE_CHANGE = 11602 INTERRUPTED_DUE_TO_STORAGE_CHANGE = 355 - def __init__( # pylint: disable=too-many-arguments - self, logger, test_name, description, base_test_name, hook, shell_options=None): + def __init__(self, logger, test_name, description, base_test_name, hook, shell_options=None): """Initialize BackgroundInitialSyncTestCase.""" jsfile.DynamicJSTestCase.__init__(self, logger, test_name, description, base_test_name, hook, self.JS_FILENAME, shell_options) @@ -198,8 +197,7 @@ class IntermediateInitialSyncTestCase(jsfile.DynamicJSTestCase): JS_FILENAME = os.path.join("jstests", "hooks", "run_initial_sync_node_validation.js") - def __init__( # pylint: disable=too-many-arguments - self, logger, test_name, description, base_test_name, hook): + def __init__(self, logger, test_name, description, base_test_name, hook): """Initialize IntermediateInitialSyncTestCase.""" jsfile.DynamicJSTestCase.__init__(self, logger, test_name, description, base_test_name, hook, self.JS_FILENAME) diff --git a/buildscripts/resmokelib/testing/hooks/interface.py b/buildscripts/resmokelib/testing/hooks/interface.py index feafc9d20ef..e92a07a5c18 100644 --- a/buildscripts/resmokelib/testing/hooks/interface.py +++ b/buildscripts/resmokelib/testing/hooks/interface.py @@ -62,8 +62,7 @@ class Hook(object, metaclass=registry.make_registry_metaclass(_HOOKS)): # pylin class DynamicTestCase(testcase.TestCase): # pylint: disable=abstract-method """DynamicTestCase class.""" - def __init__( # pylint: disable=too-many-arguments - self, logger, test_name, description, base_test_name, hook): + def __init__(self, logger, test_name, description, base_test_name, hook): """Initialize DynamicTestCase.""" testcase.TestCase.__init__(self, logger, "Hook", test_name, dynamic=True) self.description = description diff --git a/buildscripts/resmokelib/testing/hooks/jsfile.py b/buildscripts/resmokelib/testing/hooks/jsfile.py index 4cfa7f5815a..7489968d834 100644 --- a/buildscripts/resmokelib/testing/hooks/jsfile.py +++ b/buildscripts/resmokelib/testing/hooks/jsfile.py @@ -12,14 +12,13 @@ class JSHook(interface.Hook): REGISTERED_NAME = registry.LEAVE_UNREGISTERED - def __init__( # pylint: disable=too-many-arguments - self, hook_logger, fixture, js_filename, description, shell_options=None): + def __init__(self, hook_logger, fixture, js_filename, description, shell_options=None): """Initialize JSHook.""" interface.Hook.__init__(self, hook_logger, fixture, description) self._js_filename = js_filename self._shell_options = shell_options - def _should_run_after_test(self): # pylint: disable=no-self-use + def _should_run_after_test(self): """Provide base callback. Callback that can be overrided by subclasses to indicate if the JavaScript file should be @@ -84,9 +83,8 @@ class PerClusterDataConsistencyHook(DataConsistencyHook): class DynamicJSTestCase(interface.DynamicTestCase): """A dynamic TestCase that runs a JavaScript file.""" - def __init__( # pylint: disable=too-many-arguments - self, logger, test_name, description, base_test_name, hook, js_filename, - shell_options=None): + def __init__(self, logger, test_name, description, base_test_name, hook, js_filename, + shell_options=None): """Initialize DynamicJSTestCase.""" interface.DynamicTestCase.__init__(self, logger, test_name, description, base_test_name, hook) @@ -104,7 +102,7 @@ class DynamicJSTestCase(interface.DynamicTestCase): interface.DynamicTestCase.reset_logger(self) self._js_test_case.reset_logger() - def configure(self, fixture, *args, **kwargs): # pylint: disable=unused-argument + def configure(self, fixture, *args, **kwargs): """Configure the fixture.""" super().configure(fixture, *args, **kwargs) self._js_test_builder.configure(fixture, *args, **kwargs) diff --git a/buildscripts/resmokelib/testing/hooks/oplog.py b/buildscripts/resmokelib/testing/hooks/oplog.py index d66352180da..94baea30482 100644 --- a/buildscripts/resmokelib/testing/hooks/oplog.py +++ b/buildscripts/resmokelib/testing/hooks/oplog.py @@ -5,7 +5,7 @@ import os.path from buildscripts.resmokelib.testing.hooks import jsfile -class CheckReplOplogs(jsfile.PerClusterDataConsistencyHook): # pylint: disable=non-parent-init-called,super-init-not-called +class CheckReplOplogs(jsfile.PerClusterDataConsistencyHook): """Check that local.oplog.rs matches on the primary and secondaries.""" IS_BACKGROUND = False diff --git a/buildscripts/resmokelib/testing/hooks/periodic_kill_secondaries.py b/buildscripts/resmokelib/testing/hooks/periodic_kill_secondaries.py index b0ff858c5dc..125649a0b2c 100644 --- a/buildscripts/resmokelib/testing/hooks/periodic_kill_secondaries.py +++ b/buildscripts/resmokelib/testing/hooks/periodic_kill_secondaries.py @@ -126,8 +126,7 @@ class PeriodicKillSecondariesTestCase(interface.DynamicTestCase): INTERRUPTED_DUE_TO_REPL_STATE_CHANGE = 11602 INTERRUPTED_DUE_TO_STORAGE_CHANGE = 355 - def __init__( # pylint: disable=too-many-arguments - self, logger, test_name, description, base_test_name, hook, test_report): + def __init__(self, logger, test_name, description, base_test_name, hook, test_report): """Initialize PeriodicKillSecondariesTestCase.""" interface.DynamicTestCase.__init__(self, logger, test_name, description, base_test_name, hook) @@ -262,8 +261,7 @@ class PeriodicKillSecondariesTestCase(interface.DynamicTestCase): self.logger.info(fixture.create_fixture_table(self.fixture)) self.fixture.await_ready() - def _check_invariants_as_standalone(self, secondary): # pylint: disable=too-many-locals - # pylint: disable=too-many-branches,too-many-statements + def _check_invariants_as_standalone(self, secondary): # We remove the --replSet option in order to start the node as a standalone. replset_name = secondary.mongod_options.pop("replSet") self.logger.info( diff --git a/buildscripts/resmokelib/testing/hooks/shard_split.py b/buildscripts/resmokelib/testing/hooks/shard_split.py index 10748f6e1e4..99c11d76482 100644 --- a/buildscripts/resmokelib/testing/hooks/shard_split.py +++ b/buildscripts/resmokelib/testing/hooks/shard_split.py @@ -16,7 +16,7 @@ from buildscripts.resmokelib.testing.hooks import interface from buildscripts.resmokelib.testing.hooks import dbhash_tenant_migration -class ContinuousShardSplit(interface.Hook): # pylint: disable=too-many-instance-attributes +class ContinuousShardSplit(interface.Hook): """Starts a shard split thread at the beginning of each test.""" DESCRIPTION = ("Continuous shard split operations") @@ -154,8 +154,8 @@ class ShardSplitLifeCycle(object): class _ShardSplitOptions: - def __init__( # pylint: disable=too-many-arguments - self, logger, shard_split_fixture, tenant_ids, recipient_tag_name, recipient_set_name): + def __init__(self, logger, shard_split_fixture, tenant_ids, recipient_tag_name, + recipient_set_name): self.logger = logger self.migration_id = uuid.uuid4() self.shard_split_fixture = shard_split_fixture @@ -197,7 +197,7 @@ class _ShardSplitOptions: return str(opts) -class _ShardSplitThread(threading.Thread): # pylint: disable=too-many-instance-attributes +class _ShardSplitThread(threading.Thread): THREAD_NAME = "ShardSplitThread" WAIT_SECS_RANGES = [[0.05, 0.1], [0.1, 0.5], [1, 5], [5, 15]] diff --git a/buildscripts/resmokelib/testing/hooks/stepdown.py b/buildscripts/resmokelib/testing/hooks/stepdown.py index 5c893d322d7..f77a2169ac6 100644 --- a/buildscripts/resmokelib/testing/hooks/stepdown.py +++ b/buildscripts/resmokelib/testing/hooks/stepdown.py @@ -17,7 +17,7 @@ from buildscripts.resmokelib.testing.fixtures import tenant_migration from buildscripts.resmokelib.testing.hooks import interface -class ContinuousStepdown(interface.Hook): # pylint: disable=too-many-instance-attributes +class ContinuousStepdown(interface.Hook): """Regularly connect to replica sets and send a replSetStepDown command.""" DESCRIPTION = ("Continuous stepdown (steps down the primary of replica sets at regular" @@ -28,11 +28,10 @@ class ContinuousStepdown(interface.Hook): # pylint: disable=too-many-instance-a # The hook stops the fixture partially during its execution. STOPS_FIXTURE = True - def __init__( # pylint: disable=too-many-arguments - self, hook_logger, fixture, config_stepdown=True, shard_stepdown=True, - stepdown_interval_ms=8000, terminate=False, kill=False, - use_stepdown_permitted_file=False, wait_for_mongos_retarget=False, - background_reconfig=False, auth_options=None, should_downgrade=False): + def __init__(self, hook_logger, fixture, config_stepdown=True, shard_stepdown=True, + stepdown_interval_ms=8000, terminate=False, kill=False, + use_stepdown_permitted_file=False, wait_for_mongos_retarget=False, + background_reconfig=False, auth_options=None, should_downgrade=False): """Initialize the ContinuousStepdown. Args: @@ -119,7 +118,7 @@ class ContinuousStepdown(interface.Hook): # pylint: disable=too-many-instance-a self._stepdown_thread.pause() self.logger.info("Paused the stepdown thread.") - def _add_fixture(self, fixture): # pylint: disable=too-many-branches + def _add_fixture(self, fixture): if isinstance(fixture, replicaset.ReplicaSetFixture): if not fixture.all_nodes_electable: raise ValueError( @@ -371,11 +370,10 @@ def is_shard_split(fixture): return fixture.__class__.__name__ == 'ShardSplitFixture' -class _StepdownThread(threading.Thread): # pylint: disable=too-many-instance-attributes - def __init__( # pylint: disable=too-many-arguments - self, logger, mongos_fixtures, rs_fixtures, stepdown_interval_secs, terminate, kill, - stepdown_lifecycle, wait_for_mongos_retarget, background_reconfig, fixture, - auth_options=None, should_downgrade=False): +class _StepdownThread(threading.Thread): + def __init__(self, logger, mongos_fixtures, rs_fixtures, stepdown_interval_secs, terminate, + kill, stepdown_lifecycle, wait_for_mongos_retarget, background_reconfig, fixture, + auth_options=None, should_downgrade=False): """Initialize _StepdownThread.""" threading.Thread.__init__(self, name="StepdownThread") self.daemon = True @@ -403,7 +401,6 @@ class _StepdownThread(threading.Thread): # pylint: disable=too-many-instance-at self._is_idle_evt = threading.Event() self._is_idle_evt.set() - # pylint: disable=too-many-function-args self._step_up_stats = collections.Counter() def run(self): @@ -519,7 +516,6 @@ class _StepdownThread(threading.Thread): # pylint: disable=too-many-instance-at for rs_fixture in self._rs_fixtures: self._step_down(rs_fixture) - # pylint: disable=R0912,R0914,R0915 def _step_down(self, rs_fixture): try: old_primary = rs_fixture.get_primary(timeout_secs=self._stepdown_interval_secs) @@ -603,7 +599,7 @@ class _StepdownThread(threading.Thread): # pylint: disable=too-many-instance-at new_primary.get_internal_connection_string() if secondaries else "none") self._step_up_stats[key] += 1 - def _do_wait_for_mongos_retarget(self): # pylint: disable=too-many-branches + def _do_wait_for_mongos_retarget(self): """Run collStats on each collection in each database on each mongos. This is to ensure mongos can target the primary for each shard with data, including the diff --git a/buildscripts/resmokelib/testing/hooks/tenant_migration.py b/buildscripts/resmokelib/testing/hooks/tenant_migration.py index 122dcb534a2..3e34c5be857 100644 --- a/buildscripts/resmokelib/testing/hooks/tenant_migration.py +++ b/buildscripts/resmokelib/testing/hooks/tenant_migration.py @@ -17,7 +17,7 @@ from buildscripts.resmokelib.testing.hooks import dbhash_tenant_migration from buildscripts.resmokelib.testing.hooks import interface -class ContinuousTenantMigration(interface.Hook): # pylint: disable=too-many-instance-attributes +class ContinuousTenantMigration(interface.Hook): """Starts a tenant migration thread at the beginning of each test.""" DESCRIPTION = ("Continuous tenant migrations") @@ -187,8 +187,7 @@ def get_primary(rs, logger, max_tries=5): # noqa: D205,D400 class _TenantMigrationOptions: - def __init__( # pylint: disable=too-many-arguments - self, donor_rs, recipient_rs, tenant_id, read_preference, logger): + def __init__(self, donor_rs, recipient_rs, tenant_id, read_preference, logger): self.donor_rs = donor_rs self.recipient_rs = recipient_rs self.migration_id = uuid.uuid4() @@ -229,7 +228,7 @@ class _TenantMigrationOptions: return str(opts) -class _TenantMigrationThread(threading.Thread): # pylint: disable=too-many-instance-attributes +class _TenantMigrationThread(threading.Thread): THREAD_NAME = "TenantMigrationThread" WAIT_SECS_RANGES = [[0.05, 0.1], [0.1, 0.5], [1, 5], [5, 15]] diff --git a/buildscripts/resmokelib/testing/job.py b/buildscripts/resmokelib/testing/job.py index ba9f54e6912..bf2d33a024e 100644 --- a/buildscripts/resmokelib/testing/job.py +++ b/buildscripts/resmokelib/testing/job.py @@ -12,12 +12,11 @@ from buildscripts.resmokelib.testing.testcases import fixture as _fixture from buildscripts.resmokelib.utils import queue as _queue -class Job(object): # pylint: disable=too-many-instance-attributes +class Job(object): """Run tests from a queue.""" - def __init__( # pylint: disable=too-many-arguments - self, job_num, logger, fixture, hooks, report, archival, suite_options, - test_queue_logger): + def __init__(self, job_num, logger, fixture, hooks, report, archival, suite_options, + test_queue_logger): """Initialize the job with the specified fixture and hooks.""" self.logger = logger diff --git a/buildscripts/resmokelib/testing/report.py b/buildscripts/resmokelib/testing/report.py index 05220e8d136..f2d153cf6b0 100644 --- a/buildscripts/resmokelib/testing/report.py +++ b/buildscripts/resmokelib/testing/report.py @@ -1,3 +1,4 @@ +# pylint: disable=invalid-name """Extension to the unittest.TestResult. This is used to support additional test status and timing information for the report.json file. @@ -14,7 +15,7 @@ from buildscripts.resmokelib.testing.symbolizer_service import ResmokeSymbolizer # pylint: disable=attribute-defined-outside-init -class TestReport(unittest.TestResult): # pylint: disable=too-many-instance-attributes +class TestReport(unittest.TestResult): """Record test status and timing information.""" def __init__(self, job_logger, suite_options, job_num=None): @@ -103,7 +104,7 @@ class TestReport(unittest.TestResult): # pylint: disable=too-many-instance-attr return combined_report - def startTest(self, test): # pylint: disable=invalid-name + def startTest(self, test): """Call before 'test' is run.""" unittest.TestResult.startTest(self, test) @@ -136,7 +137,7 @@ class TestReport(unittest.TestResult): # pylint: disable=too-many-instance-attr test.override_logger(test_logger) test_info.start_time = time.time() - def stopTest(self, test): # pylint: disable=invalid-name + def stopTest(self, test): """Call after 'test' has run.""" # check if there are stacktrace files, if so, invoke the symbolizer here. @@ -171,7 +172,7 @@ class TestReport(unittest.TestResult): # pylint: disable=too-many-instance-attr # Restore the original logger for the test. test.reset_logger() - def addError(self, test, err): # pylint: disable=invalid-name + def addError(self, test, err): """Call when a non-failureException was raised during the execution of 'test'.""" unittest.TestResult.addError(self, test, err) @@ -185,7 +186,7 @@ class TestReport(unittest.TestResult): # pylint: disable=too-many-instance-attr test_info.evergreen_status = "fail" test_info.return_code = test.return_code - def setError(self, test): # pylint: disable=invalid-name + def setError(self, test): """Change the outcome of an existing test to an error.""" self.job_logger.info("setError(%s)", test) @@ -205,7 +206,7 @@ class TestReport(unittest.TestResult): # pylint: disable=too-many-instance-attr self.num_errored = len(self.get_errored()) self.num_interrupted = len(self.get_interrupted()) - def addFailure(self, test, err): # pylint: disable=invalid-name + def addFailure(self, test, err): """Call when a failureException was raised during the execution of 'test'.""" unittest.TestResult.addFailure(self, test, err) @@ -223,7 +224,7 @@ class TestReport(unittest.TestResult): # pylint: disable=too-many-instance-attr test_info.evergreen_status = self.suite_options.report_failure_status test_info.return_code = test.return_code - def setFailure(self, test, return_code=1): # pylint: disable=invalid-name + def setFailure(self, test, return_code=1): """Change the outcome of an existing test to a failure.""" with self._lock: @@ -246,7 +247,7 @@ class TestReport(unittest.TestResult): # pylint: disable=too-many-instance-attr self.num_errored = len(self.get_errored()) self.num_interrupted = len(self.get_interrupted()) - def addSuccess(self, test): # pylint: disable=invalid-name + def addSuccess(self, test): """Call when 'test' executed successfully.""" unittest.TestResult.addSuccess(self, test) @@ -259,7 +260,7 @@ class TestReport(unittest.TestResult): # pylint: disable=too-many-instance-attr test_info.evergreen_status = "pass" test_info.return_code = test.return_code - def wasSuccessful(self): # pylint: disable=invalid-name + def wasSuccessful(self): """Return true if all tests executed successfully.""" with self._lock: @@ -387,7 +388,7 @@ class TestReport(unittest.TestResult): # pylint: disable=too-many-instance-attr raise ValueError("Details for %s not found in the report" % (test.basename())) -class TestInfo(object): # pylint: disable=too-many-instance-attributes +class TestInfo(object): """Holder for the test status and timing information.""" def __init__(self, test_id, test_file, dynamic): diff --git a/buildscripts/resmokelib/testing/suite.py b/buildscripts/resmokelib/testing/suite.py index e089d28b191..33215c08ee4 100644 --- a/buildscripts/resmokelib/testing/suite.py +++ b/buildscripts/resmokelib/testing/suite.py @@ -59,7 +59,7 @@ def synchronized(method): return synced -class Suite(object): # pylint: disable=too-many-instance-attributes,too-many-public-methods +class Suite(object): """A suite of tests of a particular kind (e.g. C++ unit tests, dbtests, jstests).""" def __init__(self, suite_name, suite_config, suite_options=_config.SuiteOptions.ALL_INHERITED): diff --git a/buildscripts/resmokelib/testing/testcases/benchmark_test.py b/buildscripts/resmokelib/testing/testcases/benchmark_test.py index 9902bd503ef..e5fb07ddac0 100644 --- a/buildscripts/resmokelib/testing/testcases/benchmark_test.py +++ b/buildscripts/resmokelib/testing/testcases/benchmark_test.py @@ -21,7 +21,7 @@ class BenchmarkTestCase(interface.ProcessTestCase): self.suite_bm_options = program_options self.bm_options = {} - def validate_benchmark_options(self): # pylint: disable=no-self-use + def validate_benchmark_options(self): """Error out early if any options are incompatible with benchmark test suites. :return: None diff --git a/buildscripts/resmokelib/testing/testcases/cpp_libfuzzer_test.py b/buildscripts/resmokelib/testing/testcases/cpp_libfuzzer_test.py index c0c8cb69c19..33ffa02bdb1 100644 --- a/buildscripts/resmokelib/testing/testcases/cpp_libfuzzer_test.py +++ b/buildscripts/resmokelib/testing/testcases/cpp_libfuzzer_test.py @@ -15,9 +15,8 @@ class CPPLibfuzzerTestCase(interface.ProcessTestCase): REGISTERED_NAME = "cpp_libfuzzer_test" DEFAULT_TIMEOUT = datetime.timedelta(hours=1) - def __init__( # pylint: disable=too-many-arguments - self, logger, program_executable, program_options=None, runs=1000000, - corpus_directory_stem="corpora"): + def __init__(self, logger, program_executable, program_options=None, runs=1000000, + corpus_directory_stem="corpora"): """Initialize the CPPLibfuzzerTestCase with the executable to run.""" interface.ProcessTestCase.__init__(self, logger, "C++ libfuzzer test", program_executable) diff --git a/buildscripts/resmokelib/testing/testcases/fsm_workload_test.py b/buildscripts/resmokelib/testing/testcases/fsm_workload_test.py index 242b4f98b91..9be2eaa2aaa 100644 --- a/buildscripts/resmokelib/testing/testcases/fsm_workload_test.py +++ b/buildscripts/resmokelib/testing/testcases/fsm_workload_test.py @@ -15,9 +15,8 @@ class FSMWorkloadTestCase(jsrunnerfile.JSRunnerFileTestCase): _COUNTER_LOCK = threading.Lock() _COUNTER = 0 - def __init__( #pylint: disable=too-many-arguments - self, logger, selected_tests, shell_executable=None, shell_options=None, same_db=False, - same_collection=False, db_name_prefix=None): + def __init__(self, logger, selected_tests, shell_executable=None, shell_options=None, + same_db=False, same_collection=False, db_name_prefix=None): """Initialize the FSMWorkloadTestCase with the FSM workload file.""" self.same_collection = same_collection diff --git a/buildscripts/resmokelib/testing/testcases/interface.py b/buildscripts/resmokelib/testing/testcases/interface.py index 19d52f3a08c..d07a786c39e 100644 --- a/buildscripts/resmokelib/testing/testcases/interface.py +++ b/buildscripts/resmokelib/testing/testcases/interface.py @@ -21,7 +21,7 @@ def make_test_case(test_kind, *args, **kwargs): return _TEST_CASES[test_kind](*args, **kwargs) -class TestCase(unittest.TestCase, metaclass=registry.make_registry_metaclass(_TEST_CASES)): # pylint: disable=too-many-instance-attributes, invalid-metaclass +class TestCase(unittest.TestCase, metaclass=registry.make_registry_metaclass(_TEST_CASES)): # pylint: disable=invalid-metaclass """A test case to execute.""" REGISTERED_NAME = registry.LEAVE_UNREGISTERED @@ -105,12 +105,12 @@ class TestCase(unittest.TestCase, metaclass=registry.make_registry_metaclass(_TE """Run the specified test.""" raise NotImplementedError("run_test must be implemented by TestCase subclasses") - def as_command(self): # pylint: disable=no-self-use + def as_command(self): """Return the command invocation used to run the test or None.""" return None -class UndoDBUtilsMixin: # pylint: disable=abstract-method +class UndoDBUtilsMixin: """Utility functions for interacting with UndoDB.""" def __init__(self, logger, *args, **kwargs): # pylint: disable=unused-argument @@ -127,7 +127,7 @@ class UndoDBUtilsMixin: # pylint: disable=abstract-method os.rename(recording, recording + '.tokeep') -class ProcessTestCase(TestCase, UndoDBUtilsMixin): # pylint: disable=abstract-method +class ProcessTestCase(TestCase, UndoDBUtilsMixin): """Base class for TestCases that executes an external process.""" def run_test(self): diff --git a/buildscripts/resmokelib/testing/testcases/jsrunnerfile.py b/buildscripts/resmokelib/testing/testcases/jsrunnerfile.py index 620b1636971..652cdb1dfdc 100644 --- a/buildscripts/resmokelib/testing/testcases/jsrunnerfile.py +++ b/buildscripts/resmokelib/testing/testcases/jsrunnerfile.py @@ -12,9 +12,8 @@ class JSRunnerFileTestCase(interface.ProcessTestCase): REGISTERED_NAME = registry.LEAVE_UNREGISTERED - def __init__( # pylint: disable=too-many-arguments - self, logger, test_kind, test_name, test_runner_file, shell_executable=None, - shell_options=None): + def __init__(self, logger, test_kind, test_name, test_runner_file, shell_executable=None, + shell_options=None): """Initialize the JSRunnerFileTestCase with the 'test_name' file.""" interface.ProcessTestCase.__init__(self, logger, test_kind, test_name) diff --git a/buildscripts/resmokelib/testing/testcases/jstest.py b/buildscripts/resmokelib/testing/testcases/jstest.py index 648937d6f12..e9d451847f4 100644 --- a/buildscripts/resmokelib/testing/testcases/jstest.py +++ b/buildscripts/resmokelib/testing/testcases/jstest.py @@ -22,7 +22,7 @@ class _SingleJSTestCase(interface.ProcessTestCase): REGISTERED_NAME = registry.LEAVE_UNREGISTERED - def __init__(self, logger, js_filename, _id, shell_executable=None, shell_options=None): # pylint: disable=too-many-arguments + def __init__(self, logger, js_filename, _id, shell_executable=None, shell_options=None): """Initialize the _SingleJSTestCase with the JS file to run.""" interface.ProcessTestCase.__init__(self, logger, "JSTest", js_filename) diff --git a/buildscripts/resmokelib/testing/testcases/sdam_json_test.py b/buildscripts/resmokelib/testing/testcases/sdam_json_test.py index cdff7efecc9..aa4d26cb684 100644 --- a/buildscripts/resmokelib/testing/testcases/sdam_json_test.py +++ b/buildscripts/resmokelib/testing/testcases/sdam_json_test.py @@ -24,7 +24,7 @@ class SDAMJsonTestCase(interface.ProcessTestCase): self.json_test_file = os.path.normpath(json_test_file) self.program_options = utils.default_if_none(program_options, {}).copy() - def _find_executable(self): # pylint: disable=no-self-use + def _find_executable(self): binary = os.path.join(config.INSTALL_DIR, "sdam_json_test") if os.name == "nt": binary += ".exe" diff --git a/buildscripts/resmokelib/testing/testcases/server_selection_json_test.py b/buildscripts/resmokelib/testing/testcases/server_selection_json_test.py index db018e58c52..d90209dd92d 100644 --- a/buildscripts/resmokelib/testing/testcases/server_selection_json_test.py +++ b/buildscripts/resmokelib/testing/testcases/server_selection_json_test.py @@ -25,7 +25,7 @@ class ServerSelectionJsonTestCase(interface.ProcessTestCase): self.json_test_file = os.path.normpath(json_test_file) self.program_options = utils.default_if_none(program_options, {}).copy() - def _find_executable(self): # pylint: disable=no-self-use + def _find_executable(self): binary = os.path.join(config.INSTALL_DIR, "server_selection_json_test") if os.name == "nt": binary += ".exe" diff --git a/buildscripts/resmokelib/utils/archival.py b/buildscripts/resmokelib/utils/archival.py index 487fc2e50fd..8fa20906107 100644 --- a/buildscripts/resmokelib/utils/archival.py +++ b/buildscripts/resmokelib/utils/archival.py @@ -84,12 +84,11 @@ def remove_file(file_name): return status, message -class Archival(object): # pylint: disable=too-many-instance-attributes +class Archival(object): """Class to support file archival to S3.""" - def __init__( # pylint: disable=too-many-arguments - self, logger, archival_json_file="archive.json", limit_size_mb=0, limit_files=0, - s3_client=None): + def __init__(self, logger, archival_json_file="archive.json", limit_size_mb=0, limit_files=0, + s3_client=None): """Initialize Archival.""" self.archival_json_file = archival_json_file @@ -278,7 +277,7 @@ class Archival(object): # pylint: disable=too-many-instance-attributes return 1, str(err), 0 # Round up the size of the archive. - size_mb = int(math.ceil(float(file_list_size(temp_file)) / (1024 * 1024))) + size_mb = int(math.ceil(float(file_list_size(temp_file)) / (1024 * 1024))) # pylint: disable=c-extension-no-member self._upload_queue.put( UploadArgs(self.archival_json_file, display_name, temp_file, "application/x-gzip", s3_bucket, s3_path, True)) diff --git a/buildscripts/resmokelib/utils/queue.py b/buildscripts/resmokelib/utils/queue.py index 88141c794d8..90c57408621 100644 --- a/buildscripts/resmokelib/utils/queue.py +++ b/buildscripts/resmokelib/utils/queue.py @@ -10,7 +10,7 @@ import queue as _queue import time # Exception that is raised when get_nowait() is called on an empty Queue. -Empty = _queue.Empty # pylint: disable=invalid-name +Empty = _queue.Empty class Queue(_queue.Queue): diff --git a/buildscripts/resmokelib/utils/registry.py b/buildscripts/resmokelib/utils/registry.py index d8230938681..dea287ecf1e 100644 --- a/buildscripts/resmokelib/utils/registry.py +++ b/buildscripts/resmokelib/utils/registry.py @@ -48,7 +48,7 @@ def make_registry_metaclass(registry_store, base_metaclass=None): class Registry(base_metaclass): """A metaclass that stores a reference to all registered classes.""" - def __new__(mcs, class_name, base_classes, class_dict): # pylint: disable=bad-mcs-classmethod-argument,bad-classmethod-argument + def __new__(mcs, class_name, base_classes, class_dict): # pylint: disable=bad-classmethod-argument """Create and returns a new instance of Registry. The registry is a class named 'class_name' derived from 'base_classes' diff --git a/buildscripts/scons_metrics/metrics.py b/buildscripts/scons_metrics/metrics.py index 125204dc4ac..cc9d366b790 100644 --- a/buildscripts/scons_metrics/metrics.py +++ b/buildscripts/scons_metrics/metrics.py @@ -65,7 +65,7 @@ class ObjectCountsMetric(NamedTuple): ) -class SconsMetrics: # pylint: disable=too-many-instance-attributes +class SconsMetrics: """Class representing SCons metrics.""" memory_before_reading_sconscript_files: Optional[int] = None diff --git a/buildscripts/tests/ciconfig/test_evergreen.py b/buildscripts/tests/ciconfig/test_evergreen.py index 32a8cd330f3..7f946b0b8b3 100644 --- a/buildscripts/tests/ciconfig/test_evergreen.py +++ b/buildscripts/tests/ciconfig/test_evergreen.py @@ -6,8 +6,6 @@ import unittest import buildscripts.ciconfig.evergreen as _evergreen -# pylint: disable=missing-docstring,protected-access - TEST_FILE_PATH = os.path.join(os.path.dirname(__file__), "evergreen.yml") @@ -66,7 +64,7 @@ class TestEvergreenProjectConfig(unittest.TestCase): self.assertIn("amazon", self.conf.distro_names) -class TestTask(unittest.TestCase): # pylint: disable=too-many-public-methods +class TestTask(unittest.TestCase): """Unit tests for the Task class.""" def test_from_dict(self): diff --git a/buildscripts/tests/patch_builds/test_change_data.py b/buildscripts/tests/patch_builds/test_change_data.py index 88eb2522224..055b182bf20 100644 --- a/buildscripts/tests/patch_builds/test_change_data.py +++ b/buildscripts/tests/patch_builds/test_change_data.py @@ -8,8 +8,6 @@ from mock import patch, MagicMock import buildscripts.patch_builds.change_data as under_test -# pylint: disable=missing-docstring - NS = "buildscripts.patch_builds.change_data" diff --git a/buildscripts/tests/resmoke_end2end/test_resmoke.py b/buildscripts/tests/resmoke_end2end/test_resmoke.py index 82434ee25c4..17dd536e5ea 100644 --- a/buildscripts/tests/resmoke_end2end/test_resmoke.py +++ b/buildscripts/tests/resmoke_end2end/test_resmoke.py @@ -13,8 +13,6 @@ import yaml from buildscripts.resmokelib import core -# pylint: disable=missing-docstring,protected-access - class _ResmokeSelftest(unittest.TestCase): @classmethod diff --git a/buildscripts/tests/resmoke_proxy/test_resmoke_proxy.py b/buildscripts/tests/resmoke_proxy/test_resmoke_proxy.py index 31c4c1d6a8e..d075b60fb4d 100644 --- a/buildscripts/tests/resmoke_proxy/test_resmoke_proxy.py +++ b/buildscripts/tests/resmoke_proxy/test_resmoke_proxy.py @@ -4,7 +4,7 @@ from unittest.mock import MagicMock from buildscripts.resmoke_proxy import resmoke_proxy as under_test -# pylint: disable=missing-docstring,invalid-name,unused-argument,no-self-use,protected-access +# pylint: disable=protected-access class TestResmokeProxy(unittest.TestCase): diff --git a/buildscripts/tests/resmokelib/core/test_pipe.py b/buildscripts/tests/resmokelib/core/test_pipe.py index 6ecece299a7..92d0a0aed69 100644 --- a/buildscripts/tests/resmokelib/core/test_pipe.py +++ b/buildscripts/tests/resmokelib/core/test_pipe.py @@ -10,7 +10,7 @@ import mock from buildscripts.resmokelib.core import pipe as _pipe -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access class TestLoggerPipe(unittest.TestCase): diff --git a/buildscripts/tests/resmokelib/core/test_redirect.py b/buildscripts/tests/resmokelib/core/test_redirect.py index 44a1b83d10e..b08514811ac 100644 --- a/buildscripts/tests/resmokelib/core/test_redirect.py +++ b/buildscripts/tests/resmokelib/core/test_redirect.py @@ -10,8 +10,6 @@ import unittest from buildscripts.resmokelib.core import redirect as _redirect -# pylint: disable=missing-docstring - class TestStdoutRedirect(unittest.TestCase): is_windows = os.name == "nt" diff --git a/buildscripts/tests/resmokelib/discovery/test_discovery.py b/buildscripts/tests/resmokelib/discovery/test_discovery.py index e3a45e03e63..afbe549e50b 100644 --- a/buildscripts/tests/resmokelib/discovery/test_discovery.py +++ b/buildscripts/tests/resmokelib/discovery/test_discovery.py @@ -6,8 +6,6 @@ from unittest.mock import MagicMock import buildscripts.resmokelib.discovery as under_test from buildscripts.resmokelib.testing.suite import Suite -# pylint: disable=missing-docstring - class TestTestDiscoverySubCommand(unittest.TestCase): def test_gather_tests_should_return_discovered_tests(self): diff --git a/buildscripts/tests/resmokelib/hang_analyzer/test_process_list.py b/buildscripts/tests/resmokelib/hang_analyzer/test_process_list.py index 5c5801f3f5d..d36e4f28df9 100644 --- a/buildscripts/tests/resmokelib/hang_analyzer/test_process_list.py +++ b/buildscripts/tests/resmokelib/hang_analyzer/test_process_list.py @@ -6,8 +6,6 @@ from mock import Mock, patch from buildscripts.resmokelib.hang_analyzer.process_list import Pinfo, get_processes -# # pylint: disable=missing-docstring - NS = "buildscripts.resmokelib.hang_analyzer.process_list" diff --git a/buildscripts/tests/resmokelib/logging/test_buildlogger.py b/buildscripts/tests/resmokelib/logging/test_buildlogger.py index 5cb8f783c9d..8167bbe6327 100644 --- a/buildscripts/tests/resmokelib/logging/test_buildlogger.py +++ b/buildscripts/tests/resmokelib/logging/test_buildlogger.py @@ -5,7 +5,7 @@ import unittest from buildscripts.resmokelib.logging import buildlogger -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access class TestLogsSplitter(unittest.TestCase): diff --git a/buildscripts/tests/resmokelib/logging/test_loggers.py b/buildscripts/tests/resmokelib/logging/test_loggers.py index 60657d74e1c..4536250a8a2 100644 --- a/buildscripts/tests/resmokelib/logging/test_loggers.py +++ b/buildscripts/tests/resmokelib/logging/test_loggers.py @@ -6,7 +6,7 @@ from unittest.mock import MagicMock from buildscripts.resmokelib.logging import loggers from buildscripts.resmokelib import config -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access class TestLoggers(unittest.TestCase): diff --git a/buildscripts/tests/resmokelib/multiversion/test_multiversion_service.py b/buildscripts/tests/resmokelib/multiversion/test_multiversion_service.py index 274b7e5ffbe..f6f1e665a40 100644 --- a/buildscripts/tests/resmokelib/multiversion/test_multiversion_service.py +++ b/buildscripts/tests/resmokelib/multiversion/test_multiversion_service.py @@ -5,7 +5,7 @@ from packaging.version import Version import buildscripts.resmokelib.multiversion.multiversion_service as under_test -# pylint: disable=missing-docstring,invalid-name +# pylint: disable=invalid-name class TestTagStr(TestCase): diff --git a/buildscripts/tests/resmokelib/powercycle/test_remote_operations.py b/buildscripts/tests/resmokelib/powercycle/test_remote_operations.py index be08191ae11..7c007604126 100755 --- a/buildscripts/tests/resmokelib/powercycle/test_remote_operations.py +++ b/buildscripts/tests/resmokelib/powercycle/test_remote_operations.py @@ -12,7 +12,7 @@ import unittest from buildscripts.resmokelib.powercycle.lib import remote_operations as rop -# pylint: disable=invalid-name,missing-docstring,protected-access +# pylint: disable=invalid-name class RemoteOperationsTestCase(unittest.TestCase): @@ -92,7 +92,7 @@ class RemoteOperationConnection(RemoteOperationsTestCase): class RemoteOperationShell(RemoteOperationsTestCase): @unittest.skip("Known broken. SERVER-48969 tracks re-enabling.") - def runTest(self): # pylint: disable=too-many-statements + def runTest(self): # Shell connect ret, buff = self.rop.shell("uname") @@ -175,7 +175,7 @@ class RemoteOperationShell(RemoteOperationsTestCase): class RemoteOperationCopyTo(RemoteOperationsTestCase): @unittest.skip("Known broken. SERVER-48969 tracks re-enabling.") - def runTest(self): # pylint: disable=too-many-statements + def runTest(self): # Copy to remote l_temp_path = tempfile.mkstemp(dir=self.temp_local_dir)[1] @@ -295,7 +295,7 @@ class RemoteOperationCopyTo(RemoteOperationsTestCase): class RemoteOperationCopyFrom(RemoteOperationsTestCase): @unittest.skip("Known broken. SERVER-48969 tracks re-enabling.") - def runTest(self): # pylint: disable=too-many-statements + def runTest(self): # Copy from remote r_temp_path = tempfile.mkstemp(dir=self.temp_remote_dir)[1] diff --git a/buildscripts/tests/resmokelib/run/test_auto_kill_rogue_process.py b/buildscripts/tests/resmokelib/run/test_auto_kill_rogue_process.py index 402adda4afd..3a46bdbcc92 100644 --- a/buildscripts/tests/resmokelib/run/test_auto_kill_rogue_process.py +++ b/buildscripts/tests/resmokelib/run/test_auto_kill_rogue_process.py @@ -1,5 +1,5 @@ """Unit tests for buildscripts/resmokelib/run/list_tags.py.""" -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access import unittest import logging import os diff --git a/buildscripts/tests/resmokelib/run/test_generate_multiversion_exclude_tags.py b/buildscripts/tests/resmokelib/run/test_generate_multiversion_exclude_tags.py index decc81f4433..56195f468c7 100644 --- a/buildscripts/tests/resmokelib/run/test_generate_multiversion_exclude_tags.py +++ b/buildscripts/tests/resmokelib/run/test_generate_multiversion_exclude_tags.py @@ -1,5 +1,4 @@ """Unit tests for buildscripts/resmokelib/run/generate_multiversion_exclude_tags.py.""" -# pylint: disable=missing-docstring import os import unittest from tempfile import TemporaryDirectory diff --git a/buildscripts/tests/resmokelib/run/test_list_tags.py b/buildscripts/tests/resmokelib/run/test_list_tags.py index 6649734c512..ef7d8b33980 100644 --- a/buildscripts/tests/resmokelib/run/test_list_tags.py +++ b/buildscripts/tests/resmokelib/run/test_list_tags.py @@ -1,5 +1,4 @@ """Unit tests for buildscripts/resmokelib/run/list_tags.py.""" -# pylint: disable=missing-docstring import unittest from buildscripts.resmokelib.run import list_tags diff --git a/buildscripts/tests/resmokelib/setup_multiversion/test_setup_multiversion.py b/buildscripts/tests/resmokelib/setup_multiversion/test_setup_multiversion.py index 96df66b6fd0..f660ef3208b 100644 --- a/buildscripts/tests/resmokelib/setup_multiversion/test_setup_multiversion.py +++ b/buildscripts/tests/resmokelib/setup_multiversion/test_setup_multiversion.py @@ -1,5 +1,4 @@ """Unit tests for buildscripts/resmokelib/setup_multiversion/setup_multiversion.py.""" -# pylint: disable=missing-docstring import unittest from argparse import Namespace diff --git a/buildscripts/tests/resmokelib/test_multiversionconstants_location.py b/buildscripts/tests/resmokelib/test_multiversionconstants_location.py index f17a1d0a8bd..0e3396083fd 100644 --- a/buildscripts/tests/resmokelib/test_multiversionconstants_location.py +++ b/buildscripts/tests/resmokelib/test_multiversionconstants_location.py @@ -2,8 +2,6 @@ import importlib import unittest -# pylint: disable=missing-docstring - class TestMultiversionconstantsLocation(unittest.TestCase): def test_multiversionconstants_location(self): diff --git a/buildscripts/tests/resmokelib/test_parser.py b/buildscripts/tests/resmokelib/test_parser.py index 86c134b1292..2e1ff9c9e70 100644 --- a/buildscripts/tests/resmokelib/test_parser.py +++ b/buildscripts/tests/resmokelib/test_parser.py @@ -5,8 +5,6 @@ import unittest from buildscripts.resmokelib.parser import parse, parse_command_line from buildscripts.resmokelib.run import to_local_args -# pylint: disable=missing-docstring - class TestLocalCommandLine(unittest.TestCase): """Unit tests for the to_local_args() function.""" diff --git a/buildscripts/tests/resmokelib/test_selector.py b/buildscripts/tests/resmokelib/test_selector.py index 635cbb096e9..589a99aa2d2 100644 --- a/buildscripts/tests/resmokelib/test_selector.py +++ b/buildscripts/tests/resmokelib/test_selector.py @@ -11,7 +11,7 @@ import buildscripts.resmokelib.parser as parser import buildscripts.resmokelib.selector as selector import buildscripts.resmokelib.utils.globstar as globstar -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access FIXTURE_PREFIX = "buildscripts/tests/selftest_fixtures" @@ -162,7 +162,7 @@ class MockTestFileExplorer(object): self.binary = MockTestFileExplorer.BINARY self.jstest_tag_file = {"dir/subdir1/test11.js": "tagA", "dir/subdir3/a/test3a1.js": "tagB"} - def is_glob_pattern(self, pattern): # pylint: disable=no-self-use + def is_glob_pattern(self, pattern): return globstar.is_glob_pattern(pattern) def iglob(self, pattern): @@ -175,16 +175,16 @@ class MockTestFileExplorer(object): def jstest_tags(self, file_path): return self.tags.get(file_path, []) - def read_root_file(self, root_file_path): # pylint: disable=no-self-use,unused-argument + def read_root_file(self, root_file_path): # pylint: disable=unused-argument return ["build/testA", "build/testB"] - def fnmatchcase(self, name, pattern): # pylint: disable=no-self-use + def fnmatchcase(self, name, pattern): return fnmatch.fnmatchcase(name, pattern) def isfile(self, path): return path in self.files - def list_dbtests(self, binary): # pylint: disable=no-self-use,unused-argument + def list_dbtests(self, binary): # pylint: disable=unused-argument return ["dbtestA", "dbtestB", "dbtestC"] def parse_tag_files(self, test_kind, tag_files=None, tagged_tests=None): # pylint: disable=unused-argument diff --git a/buildscripts/tests/resmokelib/test_suitesconfig.py b/buildscripts/tests/resmokelib/test_suitesconfig.py index 44d01c31ec1..a4b03953f7c 100644 --- a/buildscripts/tests/resmokelib/test_suitesconfig.py +++ b/buildscripts/tests/resmokelib/test_suitesconfig.py @@ -9,8 +9,6 @@ from buildscripts.resmokelib import suitesconfig parser.set_run_options() -# pylint: disable=missing-docstring - RESMOKELIB = "buildscripts.resmokelib" diff --git a/buildscripts/tests/resmokelib/test_undodb.py b/buildscripts/tests/resmokelib/test_undodb.py index 6bc15b1f328..e523a3b2770 100644 --- a/buildscripts/tests/resmokelib/test_undodb.py +++ b/buildscripts/tests/resmokelib/test_undodb.py @@ -5,9 +5,6 @@ from mock import MagicMock, Mock, patch, call import evergreen import buildscripts.resmokelib.undodb.fetch as fetch -# # pylint: disable=missing-docstring -# pylint: disable=no-self-use - class TestFetch(unittest.TestCase): """Unit tests for the Fetch subcommand.""" diff --git a/buildscripts/tests/resmokelib/testing/fixtures/test_api_adherence.py b/buildscripts/tests/resmokelib/testing/fixtures/test_api_adherence.py index 81b717bb0fe..387c12c105c 100644 --- a/buildscripts/tests/resmokelib/testing/fixtures/test_api_adherence.py +++ b/buildscripts/tests/resmokelib/testing/fixtures/test_api_adherence.py @@ -4,8 +4,6 @@ import unittest import ast import os -# pylint: disable=missing-docstring - DISALLOWED_ROOT = "buildscripts" ALLOWED_IMPORTS = [ "buildscripts.resmokelib.testing.fixtures.external", diff --git a/buildscripts/tests/resmokelib/testing/fixtures/test_builder.py b/buildscripts/tests/resmokelib/testing/fixtures/test_builder.py index 6101bb01497..29ac90572c9 100644 --- a/buildscripts/tests/resmokelib/testing/fixtures/test_builder.py +++ b/buildscripts/tests/resmokelib/testing/fixtures/test_builder.py @@ -1,5 +1,5 @@ """Unit tests for the resmokelib.testing.fixtures._builder module.""" -# pylint: disable=missing-class-docstring,protected-access,missing-function-docstring,invalid-name +# pylint: disable=protected-access,invalid-name import unittest import filecmp import os diff --git a/buildscripts/tests/resmokelib/testing/fixtures/test_fixturelib.py b/buildscripts/tests/resmokelib/testing/fixtures/test_fixturelib.py index 1fcc848dc90..b492e74ce2e 100644 --- a/buildscripts/tests/resmokelib/testing/fixtures/test_fixturelib.py +++ b/buildscripts/tests/resmokelib/testing/fixtures/test_fixturelib.py @@ -3,7 +3,6 @@ import copy import unittest -# pylint: disable=missing-docstring,protected-access from buildscripts.resmokelib.testing.fixtures.fixturelib import FixtureLib @@ -11,7 +10,7 @@ class TestMergeMongoOptionDicts(unittest.TestCase): def setUp(self) -> None: self.under_test = FixtureLib() - def test_merge_empty(self): # pylint: disable=no-self-use + def test_merge_empty(self): original = { "dbpath": "value0", self.under_test.SET_PARAMETERS_KEY: { "param1": "value1", @@ -24,7 +23,7 @@ class TestMergeMongoOptionDicts(unittest.TestCase): self.assertDictEqual(merged, original) - def test_merge_non_params(self): # pylint: disable=no-self-use + def test_merge_non_params(self): non_param1_key = "non_param1" non_param2_key = "non_param2" original = { @@ -45,7 +44,7 @@ class TestMergeMongoOptionDicts(unittest.TestCase): } self.assertEqual(original, expected) - def test_merge_params(self): # pylint: disable=no-self-use + def test_merge_params(self): original = { "dbpath": "value", self.under_test.SET_PARAMETERS_KEY: { "param1": "value", diff --git a/buildscripts/tests/resmokelib/testing/fixtures/test_interface.py b/buildscripts/tests/resmokelib/testing/fixtures/test_interface.py index 25483f05742..4a0862270c3 100644 --- a/buildscripts/tests/resmokelib/testing/fixtures/test_interface.py +++ b/buildscripts/tests/resmokelib/testing/fixtures/test_interface.py @@ -6,11 +6,9 @@ from buildscripts.resmokelib import errors from buildscripts.resmokelib.testing.fixtures import interface from buildscripts.resmokelib.testing.fixtures.fixturelib import FixtureLib -# pylint: disable=missing-docstring,protected-access - class TestFixture(unittest.TestCase): - def test_teardown_ok(self): # pylint: disable=no-self-use + def test_teardown_ok(self): raising_fixture = UnitTestFixture(should_raise=False) raising_fixture.teardown() diff --git a/buildscripts/tests/resmokelib/testing/hooks/test_combine_benchmark_results.py b/buildscripts/tests/resmokelib/testing/hooks/test_combine_benchmark_results.py index cf9afa0134c..0c233d99be3 100755 --- a/buildscripts/tests/resmokelib/testing/hooks/test_combine_benchmark_results.py +++ b/buildscripts/tests/resmokelib/testing/hooks/test_combine_benchmark_results.py @@ -8,7 +8,7 @@ import mock import buildscripts.resmokelib.testing.hooks.combine_benchmark_results as cbr -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access from buildscripts.resmokelib.errors import CedarReportError _BM_CONTEXT = { diff --git a/buildscripts/tests/resmokelib/testing/hooks/test_stepdown.py b/buildscripts/tests/resmokelib/testing/hooks/test_stepdown.py index 28e93b73910..a3948c16c9a 100644 --- a/buildscripts/tests/resmokelib/testing/hooks/test_stepdown.py +++ b/buildscripts/tests/resmokelib/testing/hooks/test_stepdown.py @@ -9,7 +9,7 @@ import mock from buildscripts.resmokelib import errors from buildscripts.resmokelib.testing.hooks import stepdown as _stepdown -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access def _get_threading_lock(test_case, MockCondition): # pylint: disable=invalid-name diff --git a/buildscripts/tests/resmokelib/testing/test_executor.py b/buildscripts/tests/resmokelib/testing/test_executor.py index 8d38d9c35bf..89b2037e89d 100644 --- a/buildscripts/tests/resmokelib/testing/test_executor.py +++ b/buildscripts/tests/resmokelib/testing/test_executor.py @@ -7,7 +7,7 @@ import mock from buildscripts.resmokelib.testing import executor from buildscripts.resmokelib.testing.suite import Suite -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access NS = "buildscripts.resmokelib.testing.executor" diff --git a/buildscripts/tests/resmokelib/testing/test_job.py b/buildscripts/tests/resmokelib/testing/test_job.py index 699f19bd133..a963b1146e2 100644 --- a/buildscripts/tests/resmokelib/testing/test_job.py +++ b/buildscripts/tests/resmokelib/testing/test_job.py @@ -13,7 +13,7 @@ from buildscripts.resmokelib.testing.fixtures import interface as _fixtures from buildscripts.resmokelib.testing.fixtures.fixturelib import FixtureLib from buildscripts.resmokelib.utils import queue as _queue -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access class TestJob(unittest.TestCase): @@ -191,8 +191,8 @@ class MockTime(object): return cur_time -class UnitJob(job.Job): # pylint: disable=too-many-instance-attributes - def __init__(self, suite_options): #pylint: disable=super-init-not-called +class UnitJob(job.Job): + def __init__(self, suite_options): super(UnitJob, self).__init__(0, logging.getLogger("job_unittest"), None, [], None, None, suite_options, logging.getLogger("job_unittest")) self.total_test_num = 0 diff --git a/buildscripts/tests/resmokelib/testing/test_queue_element.py b/buildscripts/tests/resmokelib/testing/test_queue_element.py index 89ce014dde0..33dfd0bf05b 100644 --- a/buildscripts/tests/resmokelib/testing/test_queue_element.py +++ b/buildscripts/tests/resmokelib/testing/test_queue_element.py @@ -5,8 +5,6 @@ import mock from buildscripts.resmokelib.testing import queue_element -# pylint: disable=missing-docstring,protected-access - class TestQueueElemFactory(unittest.TestCase): def test_without_time(self): diff --git a/buildscripts/tests/resmokelib/testing/test_suite.py b/buildscripts/tests/resmokelib/testing/test_suite.py index 130be722f16..685e0ecc5f4 100644 --- a/buildscripts/tests/resmokelib/testing/test_suite.py +++ b/buildscripts/tests/resmokelib/testing/test_suite.py @@ -5,7 +5,7 @@ from mock import MagicMock from buildscripts.resmokelib.testing import suite as under_test -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access from buildscripts.resmokelib.testing.testcases.interface import TestCase diff --git a/buildscripts/tests/resmokelib/testing/test_symbolizer_service.py b/buildscripts/tests/resmokelib/testing/test_symbolizer_service.py index 5dee3fb8f0c..805182442ed 100644 --- a/buildscripts/tests/resmokelib/testing/test_symbolizer_service.py +++ b/buildscripts/tests/resmokelib/testing/test_symbolizer_service.py @@ -1,5 +1,4 @@ """Unit tests for buildscripts/resmokelib/testing/symbolizer_service.py.""" -# pylint: disable=missing-docstring import os import unittest from pathlib import Path diff --git a/buildscripts/tests/resmokelib/testing/test_tags.py b/buildscripts/tests/resmokelib/testing/test_tags.py index 96f20762464..810d284f78c 100644 --- a/buildscripts/tests/resmokelib/testing/test_tags.py +++ b/buildscripts/tests/resmokelib/testing/test_tags.py @@ -5,8 +5,6 @@ import unittest import buildscripts.resmokelib.testing.tags as _tags -# pylint: disable=missing-docstring,protected-access - TEST_FILE_PATH = os.path.join(os.path.dirname(__file__), "tags.yml") diff --git a/buildscripts/tests/resmokelib/testing/testcases/test_pytest.py b/buildscripts/tests/resmokelib/testing/testcases/test_pytest.py index 4b218c41a77..0e5bb8302ce 100644 --- a/buildscripts/tests/resmokelib/testing/testcases/test_pytest.py +++ b/buildscripts/tests/resmokelib/testing/testcases/test_pytest.py @@ -7,7 +7,7 @@ from buildscripts.resmokelib.testing.testcases import pytest _IS_WINDOWS = sys.platform == "win32" -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access def get_filename(filename): diff --git a/buildscripts/tests/resmokelib/utils/test_archival.py b/buildscripts/tests/resmokelib/utils/test_archival.py index dca9a9aeee0..96820b9bc36 100644 --- a/buildscripts/tests/resmokelib/utils/test_archival.py +++ b/buildscripts/tests/resmokelib/utils/test_archival.py @@ -9,7 +9,7 @@ import unittest from buildscripts.resmokelib.utils import archival -# pylint: disable=missing-docstring,protected-access +# pylint: disable=protected-access _BUCKET = "mongodatafiles" diff --git a/buildscripts/tests/resmokelib/utils/test_evergreen_conn.py b/buildscripts/tests/resmokelib/utils/test_evergreen_conn.py index 7bddcc7e4ab..7fd4215bcc7 100644 --- a/buildscripts/tests/resmokelib/utils/test_evergreen_conn.py +++ b/buildscripts/tests/resmokelib/utils/test_evergreen_conn.py @@ -1,5 +1,4 @@ """Unit tests for buildscripts/resmokelib/utils/evergreen_conn.py.""" -# pylint: disable=missing-docstring,too-many-arguments import unittest from mock import patch diff --git a/buildscripts/tests/resmokelib/utils/test_history.py b/buildscripts/tests/resmokelib/utils/test_history.py index 619a8a56aad..19146db8f1a 100644 --- a/buildscripts/tests/resmokelib/utils/test_history.py +++ b/buildscripts/tests/resmokelib/utils/test_history.py @@ -5,8 +5,6 @@ import unittest from buildscripts.resmokelib.utils.history import HistoryDict, make_historic -# pylint: disable=missing-docstring - class TestHistory(unittest.TestCase): """Unit tests for the HistoryDict class.""" diff --git a/buildscripts/tests/resmokelib/utils/test_scheduler.py b/buildscripts/tests/resmokelib/utils/test_scheduler.py index 58ac32b3c54..d9af87e2f4b 100644 --- a/buildscripts/tests/resmokelib/utils/test_scheduler.py +++ b/buildscripts/tests/resmokelib/utils/test_scheduler.py @@ -5,8 +5,6 @@ import unittest from buildscripts.resmokelib.utils import scheduler as _scheduler -# pylint: disable=missing-docstring - def noop(): pass diff --git a/buildscripts/tests/test_burn_in_tests.py b/buildscripts/tests/test_burn_in_tests.py index 369131eff60..5c358b50953 100644 --- a/buildscripts/tests/test_burn_in_tests.py +++ b/buildscripts/tests/test_burn_in_tests.py @@ -18,7 +18,7 @@ from buildscripts.ciconfig.evergreen import parse_evergreen_file, VariantTask import buildscripts.resmokelib.parser as _parser _parser.set_run_options() -# pylint: disable=missing-docstring,protected-access,too-many-lines,no-self-use +# pylint: disable=protected-access def create_tests_by_task_mock(n_tasks, n_tests): diff --git a/buildscripts/tests/test_debugsymb_mapper.py b/buildscripts/tests/test_debugsymb_mapper.py index b1b063f5331..bb794c18fe9 100644 --- a/buildscripts/tests/test_debugsymb_mapper.py +++ b/buildscripts/tests/test_debugsymb_mapper.py @@ -1,5 +1,5 @@ """Unit tests for debugsymb_mapper.py.""" -# pylint: disable=missing-docstring + import unittest from unittest.mock import MagicMock diff --git a/buildscripts/tests/test_evergreen_activate_gen_tasks.py b/buildscripts/tests/test_evergreen_activate_gen_tasks.py index cc7e85661c0..47cc32cd9fc 100644 --- a/buildscripts/tests/test_evergreen_activate_gen_tasks.py +++ b/buildscripts/tests/test_evergreen_activate_gen_tasks.py @@ -1,4 +1,5 @@ """Unit tests for the generate_resmoke_suite script.""" +# pylint: disable=invalid-name import unittest from mock import MagicMock, mock @@ -6,9 +7,6 @@ from mock import MagicMock, mock from buildscripts import evergreen_activate_gen_tasks as under_test from evergreen import Build, EvergreenApi, Task, Version -# pylint: disable=missing-docstring,invalid-name,unused-argument,no-self-use,protected-access -# pylint: disable=too-many-locals,too-many-lines,too-many-public-methods,no-value-for-parameter - def build_mock_task(display_name, task_id): mock_task = MagicMock(spec_set=Task, display_name=display_name, task_id=task_id) diff --git a/buildscripts/tests/test_evergreen_resmoke_job_count.py b/buildscripts/tests/test_evergreen_resmoke_job_count.py index c99113c6471..06815340c6c 100644 --- a/buildscripts/tests/test_evergreen_resmoke_job_count.py +++ b/buildscripts/tests/test_evergreen_resmoke_job_count.py @@ -6,8 +6,6 @@ import psutil from buildscripts import evergreen_resmoke_job_count as under_test -# pylint: disable=missing-docstring,no-self-use - class DetermineJobsTest(unittest.TestCase): cpu_count = psutil.cpu_count() diff --git a/buildscripts/tests/test_evergreen_task_tags.py b/buildscripts/tests/test_evergreen_task_tags.py index 4499228a119..f9da42e80da 100644 --- a/buildscripts/tests/test_evergreen_task_tags.py +++ b/buildscripts/tests/test_evergreen_task_tags.py @@ -8,8 +8,6 @@ from mock import MagicMock from buildscripts import evergreen_task_tags as ett -# pylint: disable=missing-docstring,no-self-use - def gen_tag_set(prefix, size): return {prefix + " " + str(index) for index in range(size)} diff --git a/buildscripts/tests/test_evergreen_task_timeout.py b/buildscripts/tests/test_evergreen_task_timeout.py index b3e4e201d96..4e681e47f52 100644 --- a/buildscripts/tests/test_evergreen_task_timeout.py +++ b/buildscripts/tests/test_evergreen_task_timeout.py @@ -7,7 +7,7 @@ import buildscripts.evergreen_task_timeout as under_test from buildscripts.ciconfig.evergreen import EvergreenProjectConfig from buildscripts.timeouts.timeout_service import TimeoutService -# pylint: disable=missing-docstring,no-self-use,invalid-name,protected-access +# pylint: disable=invalid-name class TestTimeoutOverride(unittest.TestCase): diff --git a/buildscripts/tests/test_feature_flag_tags_check.py b/buildscripts/tests/test_feature_flag_tags_check.py index 4646c709f57..dc3b296daf4 100644 --- a/buildscripts/tests/test_feature_flag_tags_check.py +++ b/buildscripts/tests/test_feature_flag_tags_check.py @@ -1,5 +1,5 @@ """Unit tests for feature_flag_tags_check.py.""" -# pylint: disable=missing-docstring + import unittest from unittest.mock import patch diff --git a/buildscripts/tests/test_mongosymb.py b/buildscripts/tests/test_mongosymb.py index 188ea385c5f..5e06313cbd9 100644 --- a/buildscripts/tests/test_mongosymb.py +++ b/buildscripts/tests/test_mongosymb.py @@ -1,5 +1,4 @@ """Unit tests for buildscripts/mongosymb.py.""" -# pylint: disable=missing-docstring import unittest from buildscripts import mongosymb as under_test diff --git a/buildscripts/tests/test_powercycle_sentinel.py b/buildscripts/tests/test_powercycle_sentinel.py index 3f2774d9b54..f610ad2a547 100644 --- a/buildscripts/tests/test_powercycle_sentinel.py +++ b/buildscripts/tests/test_powercycle_sentinel.py @@ -1,5 +1,4 @@ """Unit tests for powercycle_sentinel.py.""" -# pylint: disable=missing-docstring import unittest from datetime import datetime, timezone, timedelta from unittest.mock import Mock diff --git a/buildscripts/tests/test_simple_report.py b/buildscripts/tests/test_simple_report.py index 456a9d9dc47..ea49718671b 100644 --- a/buildscripts/tests/test_simple_report.py +++ b/buildscripts/tests/test_simple_report.py @@ -1,4 +1,3 @@ -# pylint: disable=missing-function-docstring,missing-class-docstring """Simple_report test.""" import unittest import random diff --git a/buildscripts/tests/test_todo_check.py b/buildscripts/tests/test_todo_check.py index b158c3b18fb..d67d390c609 100644 --- a/buildscripts/tests/test_todo_check.py +++ b/buildscripts/tests/test_todo_check.py @@ -11,7 +11,7 @@ from typing import Iterable import buildscripts.todo_check as under_test -# pylint: disable=missing-docstring,invalid-name,unused-argument,no-self-use,protected-access +# pylint: disable=invalid-name def create_file_iterator(file_contents: str) -> Iterable[str]: diff --git a/buildscripts/tests/test_validate_commit_message.py b/buildscripts/tests/test_validate_commit_message.py index db341a5add1..da415c58c5f 100644 --- a/buildscripts/tests/test_validate_commit_message.py +++ b/buildscripts/tests/test_validate_commit_message.py @@ -8,8 +8,6 @@ import buildscripts.validate_commit_message as under_test from buildscripts.client.jiraclient import JiraClient, SecurityLevel from evergreen import EvergreenApi -# pylint: disable=missing-docstring,no-self-use - INVALID_MESSAGES = [ "", # You must provide a message "RevertEVG-1", # revert and ticket must be formatted diff --git a/buildscripts/tests/test_validate_mongocryptd.py b/buildscripts/tests/test_validate_mongocryptd.py index 8d7d365d802..3d82a25c890 100644 --- a/buildscripts/tests/test_validate_mongocryptd.py +++ b/buildscripts/tests/test_validate_mongocryptd.py @@ -8,8 +8,6 @@ from mock import MagicMock, patch from buildscripts import validate_mongocryptd as under_test -# pylint: disable=missing-docstring,no-self-use - NS = "buildscripts.validate_mongocryptd" diff --git a/buildscripts/tests/timeouts/test_timeout.py b/buildscripts/tests/timeouts/test_timeout.py index d5af57bf907..45332543084 100644 --- a/buildscripts/tests/timeouts/test_timeout.py +++ b/buildscripts/tests/timeouts/test_timeout.py @@ -3,7 +3,7 @@ import unittest from buildscripts.timeouts import timeout as under_test -# pylint: disable=missing-docstring,invalid-name,unused-argument,no-self-use,protected-access,no-value-for-parameter +# pylint: disable=invalid-name class CalculateTimeoutTest(unittest.TestCase): diff --git a/buildscripts/tests/timeouts/test_timeout_service.py b/buildscripts/tests/timeouts/test_timeout_service.py index d178f3b09db..22019ed0288 100644 --- a/buildscripts/tests/timeouts/test_timeout_service.py +++ b/buildscripts/tests/timeouts/test_timeout_service.py @@ -11,7 +11,7 @@ import buildscripts.timeouts.timeout_service as under_test from buildscripts.resmoke_proxy.resmoke_proxy import ResmokeProxyService from buildscripts.util.teststats import HistoricTaskData -# pylint: disable=missing-docstring,no-self-use,invalid-name,protected-access +# pylint: disable=invalid-name,protected-access def build_mock_service(evg_api=None, resmoke_proxy=None): diff --git a/buildscripts/tests/util/test_fileops.py b/buildscripts/tests/util/test_fileops.py index 69ace7caf79..cfd7f9dd498 100644 --- a/buildscripts/tests/util/test_fileops.py +++ b/buildscripts/tests/util/test_fileops.py @@ -4,8 +4,6 @@ from unittest.mock import patch import buildscripts.util.fileops as under_test -# pylint: disable=missing-docstring,protected-access,no-self-use - class TestWriteFileToDir(unittest.TestCase): @patch("os.path.exists") diff --git a/buildscripts/tests/util/test_read_config.py b/buildscripts/tests/util/test_read_config.py index 2789fbcb465..5371ab1e21a 100644 --- a/buildscripts/tests/util/test_read_config.py +++ b/buildscripts/tests/util/test_read_config.py @@ -5,8 +5,6 @@ import mock from buildscripts.util import read_config -# pylint: disable=missing-docstring,protected-access - class TestGetConfigValue(unittest.TestCase): def test_undefined_values_return_none(self): diff --git a/buildscripts/tests/util/test_taskname.py b/buildscripts/tests/util/test_taskname.py index 7f3296ca1aa..7af7eba1242 100644 --- a/buildscripts/tests/util/test_taskname.py +++ b/buildscripts/tests/util/test_taskname.py @@ -4,7 +4,7 @@ import unittest import buildscripts.util.taskname as under_test -# pylint: disable=missing-docstring,protected-access,invalid-name +# pylint: disable=invalid-name class TestNameTask(unittest.TestCase): diff --git a/buildscripts/tests/util/test_testname.py b/buildscripts/tests/util/test_testname.py index c37f754ba33..d4d7facb642 100644 --- a/buildscripts/tests/util/test_testname.py +++ b/buildscripts/tests/util/test_testname.py @@ -4,8 +4,6 @@ import unittest import buildscripts.util.testname as testname_utils -# pylint: disable=missing-docstring - class IsResmokeHookTest(unittest.TestCase): def test_is_a_test_hook_true(self): diff --git a/buildscripts/tests/util/test_teststats.py b/buildscripts/tests/util/test_teststats.py index ebba930d032..b81011ea174 100644 --- a/buildscripts/tests/util/test_teststats.py +++ b/buildscripts/tests/util/test_teststats.py @@ -7,8 +7,6 @@ from mock import Mock import buildscripts.util.teststats as under_test -# pylint: disable=missing-docstring - _DATE = datetime.datetime(2018, 7, 15) diff --git a/buildscripts/tests/util/test_time.py b/buildscripts/tests/util/test_time.py index a405176bc60..813c4e9684e 100644 --- a/buildscripts/tests/util/test_time.py +++ b/buildscripts/tests/util/test_time.py @@ -4,8 +4,6 @@ import unittest from buildscripts.util import time as time_utils -#pylint: disable=missing-docstring - class Ns2SecTest(unittest.TestCase): def test_ns_converted_to_seconds(self): diff --git a/buildscripts/timeouts/timeout.py b/buildscripts/timeouts/timeout.py index b75820de478..45160de80e4 100644 --- a/buildscripts/timeouts/timeout.py +++ b/buildscripts/timeouts/timeout.py @@ -31,7 +31,7 @@ def calculate_timeout(avg_runtime: float, scaling_factor: Optional[float] = None def round_to_minute(runtime): """Round the given seconds up to the nearest minute.""" distance_to_min = 60 - (runtime % 60) - return int(math.ceil(runtime + distance_to_min)) + return int(math.ceil(runtime + distance_to_min)) # pylint: disable=c-extension-no-member return max(MIN_TIMEOUT_SECONDS, round_to_minute(avg_runtime * scaling_factor)) diff --git a/buildscripts/toolchains.py b/buildscripts/toolchains.py index 7d5f94f1d32..b90a3bc3672 100755 --- a/buildscripts/toolchains.py +++ b/buildscripts/toolchains.py @@ -627,7 +627,6 @@ class DictChoiceAction(argparse._StoreAction): parser.print_help() parser.exit() - # pylint: disable=too-many-arguments def __init__(self, option_strings: List[str], dest: str, nargs: Optional[int] = None, const: Optional[Any] = None, default: Optional[Any] = None, type: Optional[type] = None, choices: Optional[Dict[str, str]] = None, @@ -652,7 +651,6 @@ class DictChoiceAction(argparse._StoreAction): class NicerArgumentParser(argparse.ArgumentParser): """An argument parser with nicer help output.""" - # pylint: disable=too-many-arguments def __init__(self, prog: Optional[str] = None, usage: Optional[str] = None, description: Optional[str] = None, epilog: Optional[str] = None, parents: Optional[List[argparse.ArgumentParser]] = None, prefix_chars: str = '-', diff --git a/buildscripts/util/runcommand.py b/buildscripts/util/runcommand.py index 39dde68516e..dc82aa1c670 100644 --- a/buildscripts/util/runcommand.py +++ b/buildscripts/util/runcommand.py @@ -12,8 +12,7 @@ from . import fileops class RunCommand(object): """Class to abstract executing a subprocess.""" - def __init__( # pylint: disable=too-many-arguments - self, string=None, output_file=None, append_file=False, propagate_signals=True): + def __init__(self, string=None, output_file=None, append_file=False, propagate_signals=True): """Initialize the RunCommand object.""" self._command = string if string else "" self.output_file = output_file diff --git a/buildscripts/util/taskname.py b/buildscripts/util/taskname.py index 784fc6d6555..996533537bf 100644 --- a/buildscripts/util/taskname.py +++ b/buildscripts/util/taskname.py @@ -23,7 +23,7 @@ def name_generated_task(parent_name, task_index=None, total_tasks=0, variant=Non if task_index is None: return f"{parent_name}_misc{suffix}" else: - index_width = int(math.ceil(math.log10(total_tasks))) + index_width = int(math.ceil(math.log10(total_tasks))) # pylint: disable=c-extension-no-member return f"{parent_name}_{str(task_index).zfill(index_width)}{suffix}" diff --git a/buildscripts/util/teststats.py b/buildscripts/util/teststats.py index a52fa3c79a4..526d760ac12 100644 --- a/buildscripts/util/teststats.py +++ b/buildscripts/util/teststats.py @@ -137,7 +137,6 @@ class HistoricTaskData(object): """Initialize the TestStats with raw results from the Evergreen API.""" self.historic_test_results = historic_test_results - # pylint: disable=too-many-arguments @classmethod def from_evg(cls, evg_api: EvergreenApi, project: str, start_date: datetime, end_date: datetime, task: str, variant: str) -> "HistoricTaskData": diff --git a/site_scons/site_tools/auto_install_binaries.py b/site_scons/site_tools/auto_install_binaries.py index 55488465d0e..7ec9810e2d2 100644 --- a/site_scons/site_tools/auto_install_binaries.py +++ b/site_scons/site_tools/auto_install_binaries.py @@ -564,7 +564,7 @@ def exists(_env): return True -def generate(env): # pylint: disable=too-many-statements +def generate(env): """Generate the auto install builders.""" env["AUTO_INSTALL_ENABLED"] = True diff --git a/site_scons/site_tools/ninja.py b/site_scons/site_tools/ninja.py index 82bd1b86262..a55205fc612 100644 --- a/site_scons/site_tools/ninja.py +++ b/site_scons/site_tools/ninja.py @@ -287,7 +287,6 @@ class SConsToNinjaTranslator: self.loaded_custom = False - # pylint: disable=too-many-return-statements def action_to_ninja_build(self, node, action=None): """Generate build arguments dictionary for node.""" if not self.loaded_custom: @@ -369,7 +368,6 @@ class SConsToNinjaTranslator: " you can write your own ninja build generator for" " this function using NinjaRegisterFunctionHandler".format(name)) - # pylint: disable=too-many-branches def handle_list_action(self, node, action): """TODO write this comment""" results = [ @@ -443,7 +441,6 @@ class SConsToNinjaTranslator: raise Exception("Unhandled list action with rule: " + results[0]["rule"]) -# pylint: disable=too-many-instance-attributes class NinjaState: """Maintains state of Ninja build system as it's translated from SCons.""" @@ -653,7 +650,6 @@ class NinjaState: return True return False - # pylint: disable=too-many-branches,too-many-locals def generate(self, ninja_file): """ Generate the build.ninja. @@ -1210,7 +1206,7 @@ def get_generic_shell_command(env, node, action, targets, sources, executor=None ) -def get_command(env, node, action): # pylint: disable=too-many-branches +def get_command(env, node, action): """Get the command to execute for node.""" if node.env: sub_env = node.env diff --git a/src/mongo/installer/compass/install_compass b/src/mongo/installer/compass/install_compass index 844d770fed2..c34f28fe451 100755 --- a/src/mongo/installer/compass/install_compass +++ b/src/mongo/installer/compass/install_compass @@ -255,7 +255,7 @@ def get_debian_release(): return match.group(1) -def is_supported_linux(): # pylint: disable=too-many-branches,too-many-return-statements +def is_supported_linux(): """Checks whether the Linux version is supported by the Compass package.""" # This isn't intended to be an exhaustive check of all compatible |
