summaryrefslogtreecommitdiff
path: root/pylint
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2023-03-14 19:44:38 +0100
committerGitHub <noreply@github.com>2023-03-14 19:44:38 +0100
commit1eef2273aee4c5a2e287f7470d6da3a3ae7d0760 (patch)
treecb29286317426645a9e42eb04f66d4cdf31afeb3 /pylint
parent0d463f6e2127b81e2d13c482871f82b4c991f7bd (diff)
downloadpylint-git-1eef2273aee4c5a2e287f7470d6da3a3ae7d0760.tar.gz
[ruff] Add RUF specific rules and autofix (#8449)
Diffstat (limited to 'pylint')
-rw-r--r--pylint/checkers/base/basic_checker.py2
-rw-r--r--pylint/checkers/stdlib.py2
-rw-r--r--pylint/checkers/typecheck.py2
-rw-r--r--pylint/checkers/utils.py2
-rw-r--r--pylint/checkers/variables.py4
-rw-r--r--pylint/config/find_default_config_files.py2
-rw-r--r--pylint/lint/expand_modules.py2
-rw-r--r--pylint/lint/parallel.py2
-rw-r--r--pylint/lint/pylinter.py3
-rw-r--r--pylint/reporters/ureports/nodes.py2
10 files changed, 12 insertions, 11 deletions
diff --git a/pylint/checkers/base/basic_checker.py b/pylint/checkers/base/basic_checker.py
index 08d582b7f..252266109 100644
--- a/pylint/checkers/base/basic_checker.py
+++ b/pylint/checkers/base/basic_checker.py
@@ -329,7 +329,7 @@ class BasicChecker(_BasicChecker):
nodes.Subscript,
)
inferred = None
- emit = isinstance(test, (nodes.Const,) + structs + const_nodes)
+ emit = isinstance(test, (nodes.Const, *structs, *const_nodes))
maybe_generator_call = None
if not isinstance(test, except_nodes):
inferred = utils.safe_infer(test)
diff --git a/pylint/checkers/stdlib.py b/pylint/checkers/stdlib.py
index 96b273c74..82b4188a6 100644
--- a/pylint/checkers/stdlib.py
+++ b/pylint/checkers/stdlib.py
@@ -25,7 +25,7 @@ if TYPE_CHECKING:
DeprecationDict = Dict[Tuple[int, int, int], Set[str]]
OPEN_FILES_MODE = ("open", "file")
-OPEN_FILES_FUNCS = OPEN_FILES_MODE + ("read_text", "write_text")
+OPEN_FILES_FUNCS = (*OPEN_FILES_MODE, "read_text", "write_text")
UNITTEST_CASE = "unittest.case"
THREADING_THREAD = "threading.Thread"
COPY_COPY = "copy.copy"
diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py
index 8e00384d7..254ad78f9 100644
--- a/pylint/checkers/typecheck.py
+++ b/pylint/checkers/typecheck.py
@@ -157,7 +157,7 @@ def _(node: nodes.ClassDef | bases.Instance) -> Iterable[str]:
def _string_distance(seq1: str, seq2: str) -> int:
seq2_length = len(seq2)
- row = list(range(1, seq2_length + 1)) + [0]
+ row = [*list(range(1, seq2_length + 1)), 0]
for seq1_index, seq1_char in enumerate(seq1):
last_row = row
row = [0] * seq2_length + [seq1_index + 1]
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py
index 0104ff532..c99c90457 100644
--- a/pylint/checkers/utils.py
+++ b/pylint/checkers/utils.py
@@ -358,7 +358,7 @@ def is_defined_before(var_node: nodes.Name) -> bool:
if defnode is None:
continue
defnode_scope = defnode.scope()
- if isinstance(defnode_scope, COMP_NODE_TYPES + (nodes.Lambda,)):
+ if isinstance(defnode_scope, (*COMP_NODE_TYPES, nodes.Lambda)):
# Avoid the case where var_node_scope is a nested function
# FunctionDef is a Lambda until https://github.com/PyCQA/astroid/issues/291
if isinstance(defnode_scope, nodes.FunctionDef):
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py
index 25ca3bc7c..e240e7f7c 100644
--- a/pylint/checkers/variables.py
+++ b/pylint/checkers/variables.py
@@ -2234,7 +2234,7 @@ class VariablesChecker(BaseChecker):
return any(
VariablesChecker._maybe_used_and_assigned_at_once(elt)
for elt in defstmt.value.elts
- if isinstance(elt, NODES_WITH_VALUE_ATTR + (nodes.IfExp, nodes.Match))
+ if isinstance(elt, (*NODES_WITH_VALUE_ATTR, nodes.IfExp, nodes.Match))
)
value = defstmt.value
if isinstance(value, nodes.IfExp):
@@ -2876,7 +2876,7 @@ class VariablesChecker(BaseChecker):
@staticmethod
def _nodes_to_unpack(node: nodes.NodeNG) -> list[nodes.NodeNG] | None:
"""Return the list of values of the `Assign` node."""
- if isinstance(node, (nodes.Tuple, nodes.List) + DICT_TYPES):
+ if isinstance(node, (nodes.Tuple, nodes.List, *DICT_TYPES)):
return node.itered() # type: ignore[no-any-return]
if isinstance(node, astroid.Instance) and any(
ancestor.qname() == "typing.NamedTuple" for ancestor in node.ancestors()
diff --git a/pylint/config/find_default_config_files.py b/pylint/config/find_default_config_files.py
index 15c0d35bc..32429096d 100644
--- a/pylint/config/find_default_config_files.py
+++ b/pylint/config/find_default_config_files.py
@@ -16,7 +16,7 @@ else:
import tomli as tomllib
RC_NAMES = (Path("pylintrc"), Path(".pylintrc"))
-CONFIG_NAMES = RC_NAMES + (Path("pyproject.toml"), Path("setup.cfg"))
+CONFIG_NAMES = (*RC_NAMES, Path("pyproject.toml"), Path("setup.cfg"))
def _toml_has_config(path: Path | str) -> bool:
diff --git a/pylint/lint/expand_modules.py b/pylint/lint/expand_modules.py
index 6ee96e4bd..73d7c45f8 100644
--- a/pylint/lint/expand_modules.py
+++ b/pylint/lint/expand_modules.py
@@ -88,7 +88,7 @@ def expand_modules(
):
continue
module_package_path = discover_package_path(something, source_roots)
- additional_search_path = [".", module_package_path] + path
+ additional_search_path = [".", module_package_path, *path]
if os.path.exists(something):
# this is a file or a directory
try:
diff --git a/pylint/lint/parallel.py b/pylint/lint/parallel.py
index a5e1a4665..80b86b5e8 100644
--- a/pylint/lint/parallel.py
+++ b/pylint/lint/parallel.py
@@ -165,4 +165,4 @@ def check_parallel(
linter.msg_status |= msg_status
_merge_mapreduce_data(linter, all_mapreduce_data)
- linter.stats = merge_stats([linter.stats] + all_stats)
+ linter.stats = merge_stats([linter.stats, *all_stats])
diff --git a/pylint/lint/pylinter.py b/pylint/lint/pylinter.py
index cec815ae5..90f7cd75c 100644
--- a/pylint/lint/pylinter.py
+++ b/pylint/lint/pylinter.py
@@ -311,7 +311,8 @@ class PyLinter(
self.options: Options = options + _make_linter_options(self)
for opt_group in option_groups:
self.option_groups_descs[opt_group[0]] = opt_group[1]
- self._option_groups: tuple[tuple[str, str], ...] = option_groups + (
+ self._option_groups: tuple[tuple[str, str], ...] = (
+ *option_groups,
("Messages control", "Options controlling analysis messages"),
("Reports", "Options related to output formatting and reporting"),
)
diff --git a/pylint/reporters/ureports/nodes.py b/pylint/reporters/ureports/nodes.py
index 8b6bf32c6..a09ca8922 100644
--- a/pylint/reporters/ureports/nodes.py
+++ b/pylint/reporters/ureports/nodes.py
@@ -72,7 +72,7 @@ class BaseLayout(VNode):
assert self.parent is not self
if self.parent is None:
return []
- return [self.parent] + self.parent.parents()
+ return [self.parent, *self.parent.parents()]
def add_text(self, text: str) -> None:
"""Shortcut to add text data."""