Skip to content

Commit a22cbab

Browse files
dbradfEvergreen Agent
authored and
Evergreen Agent
committed
SERVER-54861: Update pylint to 2.7.2
1 parent fae0542 commit a22cbab

24 files changed

+32
-33
lines changed

.pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ variable-rgx=[a-z_][a-z0-9_]{1,50}$
3131
# R0801 - duplicate-code - See PM-1380
3232
# E0611 - no-name-in-module
3333

34-
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
34+
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
3535

3636
[IMPORTS]
3737
known-third-party=boto3,botocore,psutil,yaml,xmlrunner

buildscripts/blackduck_hub.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ def _generate_report_upgrade(mgr: ReportManager, comp: Component, mcomp: ThirdPa
927927
version information for this component at {BLACKDUCK_PROJECT_URL}. Click on the down arrow on the
928928
far right of the component, choose edit and specify the new version."""
929929
else:
930-
component_explanation = f"""This commponent was automatically detected by Black Duck. Black Duck should automatically detect
930+
component_explanation = """This commponent was automatically detected by Black Duck. Black Duck should automatically detect
931931
the new version after the library is updated and the daily scanner task runs again."""
932932

933933
mgr.write_report(

buildscripts/clang_format.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,8 @@ def __init__(self, path, cache_dir):
192192
self.path = os.path.join(ospath, program)
193193
if os.path.exists(self.path) and self._validate_version():
194194
break
195-
else:
196-
self.path = None
197-
continue
198-
break
195+
self.path = None
196+
continue
199197
else:
200198
continue
201199
break

buildscripts/errorcodes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def parse_source_files(callback, src_root):
5959
with open(source_file, 'r', encoding='utf-8') as fh:
6060
text = fh.read()
6161

62-
if not any([zz in text for zz in quick]):
62+
if not any(zz in text for zz in quick):
6363
continue
6464

6565
matchiters = [p.finditer(text) for p in patterns]

buildscripts/evergreen_gen_multiversion_tests.py

-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ def get_backports_required_last_lts_hash(task_path_suffix: str):
9393
"""Parse the last-lts shell binary to get the commit hash."""
9494
last_lts_shell_exec = os.path.join(task_path_suffix, LAST_LTS_MONGO_BINARY)
9595
shell_version = check_output([last_lts_shell_exec, "--version"]).decode('utf-8')
96-
last_lts_commit_hash = ""
9796
for line in shell_version.splitlines():
9897
if "gitVersion" in line:
9998
version_line = line.split(':')[1]

buildscripts/evergreen_task_tags.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ def is_task_tagged(task, tags, filters):
101101
:param filters: List of tags that should not belong to the task.
102102
:return: True if task matches the query.
103103
"""
104-
if all([tag in task.tags for tag in tags]):
105-
if not filters or not any([tag in task.tags for tag in filters]):
104+
if all(tag in task.tags for tag in tags):
105+
if not filters or not any(tag in task.tags for tag in filters):
106106
return True
107107

108108
return False

buildscripts/idl/check_versioned_api_commands_have_idl_definitions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# Permit imports from "buildscripts".
4343
sys.path.append(os.path.normpath(os.path.join(os.path.abspath(__file__), '../../..')))
4444

45-
# pylint: disable=wrong-import-position
45+
# pylint: disable=wrong-import-position,wrong-import-order
4646
from buildscripts.resmokelib import configure_resmoke
4747
from buildscripts.resmokelib.logging import loggers
4848
from buildscripts.resmokelib.testing.fixtures import interface

buildscripts/idl/idl/binder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,7 @@ def _validate_enum_int(ctxt, idl_enum):
10551055
min_value = min(int_values_set)
10561056
max_value = max(int_values_set)
10571057

1058-
valid_int = {x for x in range(min_value, max_value + 1)}
1058+
valid_int = set(range(min_value, max_value + 1))
10591059

10601060
if valid_int != int_values_set:
10611061
ctxt.add_enum_non_continuous_range_error(idl_enum, idl_enum.name)

buildscripts/idl/idl/errors.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -682,13 +682,13 @@ def add_bad_field_non_const_getter_in_immutable_struct_error(self, location, str
682682
" struct '%s' is marked as immutable.") % (field_name, struct_name, struct_name))
683683

684684
def add_useless_variant_error(self, location):
685-
# type: (common.SourceLocation,) -> None
685+
# type: (common.SourceLocation) -> None
686686
"""Add an error about a variant with 0 or 1 variant types."""
687687
self._add_error(location, ERROR_ID_USELESS_VARIANT,
688688
("Cannot declare a variant with only 0 or 1 variant types"))
689689

690690
def add_variant_comparison_error(self, location):
691-
# type: (common.SourceLocation,) -> None
691+
# type: (common.SourceLocation) -> None
692692
"""Add an error about a struct with generate_comparison_operators and a variant field."""
693693
self._add_error(location, ERROR_ID_VARIANT_COMPARISON,
694694
("generate_comparison_operators is not supported with variant types"))

buildscripts/idl/idl/generator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ def get_bson_deserializer_static_common(self, struct, static_method_info, method
17451745
self._writer.write_line(
17461746
'%s object(localNS);' % (common.title_case(struct.cpp_name)))
17471747
else:
1748-
assert "Missing case"
1748+
assert False, "Missing case"
17491749
else:
17501750
self._writer.write_line('%s object;' % common.title_case(struct.cpp_name))
17511751

buildscripts/idl/tests/test_parser.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1446,7 +1446,7 @@ def test_unstable_negative(self):
14461446
# type: () -> None
14471447
"""Negative unstable-field test cases."""
14481448
self.assert_parse_fail(
1449-
textwrap.dedent(f"""
1449+
textwrap.dedent("""
14501450
commands:
14511451
foo:
14521452
description: foo
@@ -1464,7 +1464,7 @@ def test_same_command_name_positive(self):
14641464
# type: () -> None
14651465
"""Positive same command_name with different api_version test cases."""
14661466
self.assert_parse(
1467-
textwrap.dedent(f"""
1467+
textwrap.dedent("""
14681468
commands:
14691469
foo:
14701470
description: foo
@@ -1692,7 +1692,7 @@ def test_command_alias(self):
16921692

16931693
# The 'command_name' and 'command_alias' fields cannot have same value.
16941694
self.assert_parse_fail(
1695-
textwrap.dedent(f"""
1695+
textwrap.dedent("""
16961696
commands:
16971697
foo:
16981698
description: foo

buildscripts/idl/tests/testcase.py

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def open(self, imported_file_name):
6464
class IDLTestcase(unittest.TestCase):
6565
"""IDL Test case base class."""
6666

67+
# pylint: disable=inconsistent-return-statements
6768
def _parse(self, doc_str, resolver):
6869
# type: (str, idl.parser.ImportResolverBase) -> idl.syntax.IDLParsedSpec
6970
"""Parse a document and throw a unittest failure if it fails to parse as a valid YAML document."""

buildscripts/libdeps/libdeps/analyzer.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,9 @@ def run(self):
399399

400400
valid_depender_nodes = []
401401
for depender_node in set(self.graph[self.nodes[0]]):
402-
if all([
402+
if all(
403403
bool(excludes_node not in set(self.graph.rgraph[depender_node]))
404-
for excludes_node in self.nodes[1:]
405-
]):
404+
for excludes_node in self.nodes[1:]):
406405
valid_depender_nodes.append(depender_node)
407406
return valid_depender_nodes
408407

@@ -590,7 +589,7 @@ def serialize(self, dictionary):
590589
def print(self):
591590
"""Print the result data."""
592591

593-
import json
592+
import json # pylint: disable=import-outside-toplevel
594593
results = self.libdeps_graph_analysis.get_results()
595594
print(json.dumps(self.serialize(results)))
596595

buildscripts/libdeps/libdeps/graph.py

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131

3232
import networkx
3333

34+
# pylint: disable=invalid-name
35+
3436

3537
class CountTypes(Enum):
3638
"""Enums for the different types of counts to perform on a graph."""

buildscripts/linter/pylint.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class PyLintLinter(base.LinterBase):
1313
def __init__(self):
1414
# type: () -> None
1515
"""Create a pylint linter."""
16-
super(PyLintLinter, self).__init__("pylint", "2.3.1")
16+
super(PyLintLinter, self).__init__("pylint", "2.7.2")
1717

1818
def get_lint_version_cmd_args(self):
1919
# type: () -> List[str]

buildscripts/packager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ def make_rpm(distro, build_os, arch, spec, srcdir): # pylint: disable=too-many-
806806
"-D",
807807
f"dist .{distro.release_dist(build_os)}",
808808
"-D",
809-
f"_use_internal_dependency_generator 0",
809+
"_use_internal_dependency_generator 0",
810810
"-D",
811811
f"dynamic_version {spec.pversion(distro)}",
812812
"-D",

buildscripts/resmokelib/hang_analyzer/dumper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def _find_debugger(self, debugger):
110110
cdb = spawn.find_executable(debugger)
111111
if cdb is not None:
112112
return cdb
113-
from win32com.shell import shell, shellcon
113+
from win32com.shell import shell, shellcon # pylint: disable=import-outside-toplevel
114114

115115
# Cygwin via sshd does not expose the normal environment variables
116116
# Use the shell api to get the variable instead

buildscripts/resmokelib/hang_analyzer/extractor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def extract_debug_symbols(root_logger):
3131

3232

3333
def _extract_tar(path, root_logger):
34-
import shutil
34+
import shutil # pylint: disable=import-outside-toplevel
3535
# The file name is always .tgz but it's "secretly" a zip file on Windows :(
3636
compressed_format = 'zip' if sys.platform == "win32" else 'gztar'
3737
shutil.unpack_archive(path, format=compressed_format)

buildscripts/resmokelib/powercycle/lib/remote_operations.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _call(self, cmd):
7676
shell=self.use_shell)
7777
buff_stdout, _ = process.communicate()
7878
buff = buff_stdout.decode("utf-8", "replace")
79-
print(f"Result of command:")
79+
print("Result of command:")
8080
print(textwrap.indent(buff, "[result body] "))
8181
return process.poll(), buff
8282

buildscripts/resmokelib/powercycle/powercycle.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,7 @@ def install_tarball(tarball, root_dir):
481481
fi ;
482482
done ;
483483
popd ;
484-
""".format( # pylint: disable=bad-continuation
485-
tarball=tarball, tmp_dir=tmp_dir, root_dir=root_dir)
484+
""".format(tarball=tarball, tmp_dir=tmp_dir, root_dir=root_dir)
486485
ret, output = execute_cmd(cmds, use_file=True)
487486
shutil.rmtree(tmp_dir)
488487
else:

buildscripts/resmokelib/powercycle/setup/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ def execute(self) -> None: # pylint: disable=too-many-instance-attributes, too-
2525
remote_dir = powercycle_constants.REMOTE_DIR
2626
db_path = powercycle_constants.DB_PATH
2727

28-
set_permission_stmt = f"chmod -R 777"
28+
set_permission_stmt = "chmod -R 777"
2929
if self.is_windows():
30-
set_permission_stmt = f"setfacl -s user::rwx,group::rwx,other::rwx"
30+
set_permission_stmt = "setfacl -s user::rwx,group::rwx,other::rwx"
3131
cmds = f"{self.sudo} mkdir -p {remote_dir}; {self.sudo} chown -R {user_group} {remote_dir}; {set_permission_stmt} {remote_dir}; ls -ld {remote_dir}"
3232
cmds = f"{cmds}; {self.sudo} mkdir -p {db_path}; {self.sudo} chown -R {user_group} {db_path}; {set_permission_stmt} {db_path}; ls -ld {db_path}"
3333

buildscripts/resmokelib/run/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ def _shuffle_tests(self, suite):
269269
suite.test_kind, suite.get_display_name(), config.RANDOM_SEED)
270270
random.shuffle(suite.tests)
271271

272+
# pylint: disable=inconsistent-return-statements
272273
def _get_suites(self):
273274
"""Return the list of suites for this resmoke invocation."""
274275
try:

buildscripts/tests/test_burn_in_tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def test_get_resmoke_repeat_options_num(self):
181181
repeat_config = under_test.RepeatConfig(repeat_tests_num=5)
182182
repeat_options = repeat_config.generate_resmoke_options()
183183

184-
self.assertEqual(repeat_options.strip(), f"--repeatSuites=5")
184+
self.assertEqual(repeat_options.strip(), "--repeatSuites=5")
185185

186186
def test_get_resmoke_repeat_options_secs(self):
187187
repeat_config = under_test.RepeatConfig(repeat_tests_secs=5)

etc/pip/components/lint.req

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
GitPython ~= 3.1.7
44
mypy ~= 0.800; python_version > "3.5"
55
pydocstyle == 2.1.1
6-
pylint == 2.3.1
6+
pylint == 2.7.2
77
structlog ~= 19.2.0
88
typing
99
yamllint == 1.15.0

0 commit comments

Comments
 (0)