Skip to content

Commit 8837a2d

Browse files
auto-revert-processorEvergreen Agent
authored andcommitted
Revert "SERVER-76796 Enable more lint warnings and fix them"
This reverts commit 7e0887b.
1 parent ae78f9a commit 8837a2d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+93
-79
lines changed

.pylintrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ variable-rgx=[a-z_][a-z0-9_]{1,50}$
1313

1414
[MESSAGES CONTROL]
1515
# C0103 - invalid-name - Fix variable names to match convention
16+
# C0200 - consider-using-enumerate - Prefer enumerate() when you need index and value from an iterable
17+
# C0201 - consider-iterating-dictionary
1618
# C0206 - consider-using-dict-items - Need to explicitly specify .keys() or .items() in a dictionary iteration
1719
# C0207 - use-maxsplit-arg - Use maxsplit arg in split() calls
1820
# C0209 - consider-using-f-string - Need to convert most format strings (using both % and .format) to f""-style strings
1921
# C0301 - line-too-long - some of the type annotations are longer then 100 columns
2022
# C0325 - superfluous-parens - Superfluous parens, easy to fix
2123
# C0330 - bad-continuation - ignore conflicts produced by yapf formatting
24+
# C1803 - use-implicit-booleaness-not-comparison
2225
# C2801 - unnecessary-dunder-call - Prefer a builtin call instead of a dunder method
2326
# C3001 - unnecessary-lambda-assignment - Prefer def over lambda
2427

@@ -33,10 +36,12 @@ variable-rgx=[a-z_][a-z0-9_]{1,50}$
3336

3437
# R0204 - redefined-variable-type
3538
# R0205 - useless-object-inheritance - See PM-1380
39+
# R0402 - consider-using-from-import - Use better convention for module import
3640
# R0801 - duplicate-code - See PM-1380
3741
# R0903 - too-few-public-methods - pylint does not always know best
3842
# R1705 - no-else-return - sometimes an unnecessary else helps readability
3943
# R1710 - inconsistent-return-statements
44+
# R1714 - consider-using-in - Use 'x in [...]' instead
4045
# R1720 - no-else-raise - See PM-1380
4146
# R1728 - consider-using-generator - Use a generator instead of creating an in-memory list
4247
# R1730 - consider-using-min-builtin - Lots of situations where min() can be used to eliminate an if block
@@ -59,6 +64,7 @@ variable-rgx=[a-z_][a-z0-9_]{1,50}$
5964
# W0621 - redefined-outer-name - Overriding variable name
6065
# W0640 - cell-var-from-loop
6166
# W0719 - broad-exception-raised - Should use a more precise exception than `Exception`
67+
# W1406 - redundant-u-string-prefix
6268
# W1505 - deprecated-method - See PM-1380
6369
# W1514 - unspecified-encoding - Need to add 'encoding="utf-8"' to most open() operations
6470
# W3101 - missing-timeout - Add an explicit timeout to some sync functions
@@ -70,8 +76,12 @@ disable=
7076
broad-exception-raised,
7177
cell-var-from-loop,
7278
consider-using-dict-items,
79+
consider-using-enumerate,
7380
consider-using-f-string,
81+
consider-using-from-import,
7482
consider-using-generator,
83+
consider-using-in,
84+
consider-iterating-dictionary,
7585
consider-using-max-builtin,
7686
consider-using-min-builtin,
7787
consider-using-with,
@@ -103,6 +113,7 @@ disable=
103113
no-name-in-module,
104114
protected-access,
105115
raise-missing-from,
116+
redundant-u-string-prefix,
106117
redefined-outer-name,
107118
subprocess-run-check,
108119
super-init-not-called,
@@ -129,8 +140,10 @@ disable=
129140
unused-argument,
130141
use-dict-literal,
131142
use-list-literal,
143+
use-implicit-booleaness-not-comparison,
132144
used-before-assignment,
133145
useless-object-inheritance,
146+
useless-suppression,
134147
wrong-import-order
135148
enable=useless-suppression
136149

buildscripts/blackduck_hub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,7 @@ def run(self, logger: ReportLogger, report_file: Optional[str], vulnerabilties_o
11841184
# We filter ourself our of the list of components.
11851185
self.black_duck_components = [
11861186
comp for comp in self.black_duck_components
1187-
if not (comp.name in ["MongoDB", "WiredTiger"])
1187+
if not (comp.name == "MongoDB" or comp.name == "WiredTiger")
11881188
]
11891189

11901190
# Remove duplicate Black Duck components. We only care about the component with highest version number

buildscripts/ciconfig/evergreen.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import yaml
1717

18-
from buildscripts.util import runcommand
18+
import buildscripts.util.runcommand as runcommand
1919

2020
ENTERPRISE_MODULE_NAME = "enterprise"
2121
ASAN_SIGNATURE = "detect_leaks=1"

buildscripts/gdb/optimizer_printers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -892,10 +892,10 @@ def get_dynamic_type(self):
892892
# from the _tag member variable.
893893
poly_type = self.val.type.template_argument(self.tag)
894894
dynamic_type = "mongo::optimizer::algebra::ControlBlockVTable<" + poly_type.name
895-
for i, val in enumerate(self.type_set):
895+
for i in range(len(self.type_set)):
896896
if i < len(self.type_set):
897897
dynamic_type += ", "
898-
dynamic_type += self.type_namespace + val
898+
dynamic_type += self.type_namespace + self.type_set[i]
899899
dynamic_type += ">::ConcreteType"
900900
return dynamic_type
901901

buildscripts/idl/gen_all_feature_flag_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
sys.path.append(os.path.normpath(os.path.join(os.path.abspath(__file__), '../../..')))
4242

4343
# pylint: disable=wrong-import-position
44-
from buildscripts.idl import lib
44+
import buildscripts.idl.lib as lib
4545
from buildscripts.idl.idl import parser
4646

4747

buildscripts/idl/idl/binder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,7 @@ def _bind_expression(expr, allow_literal_string=True):
925925
node.export = True
926926

927927
# bool
928-
if expr.literal in ["true", "false"]:
928+
if (expr.literal == "true") or (expr.literal == "false"):
929929
node.expr = expr.literal
930930
return node
931931

buildscripts/idl/idl/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def is_scalar_bool_node(self, node, node_name):
358358
if not self._is_node_type(node, node_name, "scalar"):
359359
return False
360360

361-
if not node.value in ["true", "false"]:
361+
if not (node.value == "true" or node.value == "false"):
362362
self._add_node_error(
363363
node, ERROR_ID_IS_NODE_VALID_BOOL,
364364
"Illegal bool value for '%s', expected either 'true' or 'false'." % node_name)

buildscripts/libdeps/graph_visualizer_web_stack/flask/flask_backend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def add_link_to_graph_data(source, target, data):
218218
if "transitive_edges" in req_body.keys() and req_body["transitive_edges"] is True:
219219
for node in selected_nodes:
220220
for libdep in dependency_graph[str(node)]:
221-
if str(libdep) in nodes:
221+
if str(libdep) in nodes.keys():
222222
add_link_to_graph_data(node, libdep,
223223
dependents_graph[libdep][str(node)])
224224

buildscripts/linter/mongolint.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ def _check_newlines(self):
111111
def _check_and_strip_comments(self):
112112
in_multi_line_comment = False
113113

114-
for linenum, clean_line in enumerate(self.raw_lines):
114+
for linenum in range(len(self.raw_lines)):
115+
clean_line = self.raw_lines[linenum]
116+
115117
# Users can write NOLINT different ways
116118
# // NOLINT
117119
# // Some explanation NOLINT

buildscripts/powercycle_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
1010

1111
# pylint: disable=wrong-import-position
12-
from buildscripts.powercycle_setup import cli
12+
import buildscripts.powercycle_setup.cli as cli
1313

1414
cli.main(sys.argv)

0 commit comments

Comments
 (0)