From 9a5b4376a2e3e2274b08079d07e71247b71ce7c8 Mon Sep 17 00:00:00 2001 From: Daniel Ciborowski Date: Wed, 19 Apr 2023 22:45:44 -0400 Subject: [PATCH 1/4] Update lsp_server.py --- bundled/tool/lsp_server.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bundled/tool/lsp_server.py b/bundled/tool/lsp_server.py index fe29afb7..06278399 100644 --- a/bundled/tool/lsp_server.py +++ b/bundled/tool/lsp_server.py @@ -353,6 +353,12 @@ def organize_imports( "repl": r"for \1, \2 in \3.items():", } ], + "W1510:subprocess-run-check": [ + { + "pattern": r"(?<=subprocess\.run\()([^,]*)(?=\))", + "repl": r"\1, check=False", + } + ], } From 68e4f5ab494cfa4f7f02fb9e2a57bf95be038b7b Mon Sep 17 00:00:00 2001 From: Daniel Ciborowski Date: Wed, 19 Apr 2023 22:50:36 -0400 Subject: [PATCH 2/4] Update test_code_actions.py --- src/test/python_tests/test_code_actions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/python_tests/test_code_actions.py b/src/test/python_tests/test_code_actions.py index b6348c86..69ff92d8 100644 --- a/src/test/python_tests/test_code_actions.py +++ b/src/test/python_tests/test_code_actions.py @@ -257,6 +257,16 @@ class Banana(object): print(f"{city} has population {population}.") """, """for city, population in data.items(): +""", + ), + ( + "W1510:subprocess-run-check", + """ +import subprocess + +proc = subprocess.run(["ls"]) +""", + """proc = subprocess.run(["ls"], check=False) """, ), ], From 45d5abc313dc46cd1a951afd91da3f3451518082 Mon Sep 17 00:00:00 2001 From: Daniel Ciborowski Date: Sat, 22 Apr 2023 01:37:14 -0400 Subject: [PATCH 3/4] Update test_code_actions.py --- src/test/python_tests/test_code_actions.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/python_tests/test_code_actions.py b/src/test/python_tests/test_code_actions.py index 69ff92d8..c559df1a 100644 --- a/src/test/python_tests/test_code_actions.py +++ b/src/test/python_tests/test_code_actions.py @@ -264,6 +264,27 @@ class Banana(object): """ import subprocess +proc = subprocess.run( + ["ls"], + cwd=".", + stdout=subprocess.PIPE, + stderr=subprocess.PIPE +) +""", + """proc = subprocess.run( + ["ls"], + cwd=".", + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + check=False +) +""", + ), + ( + "W1510:subprocess-run-check", + """ +import subprocess + proc = subprocess.run(["ls"]) """, """proc = subprocess.run(["ls"], check=False) From 13fbbf5f042e2e505c88dd643b4177c03e636e85 Mon Sep 17 00:00:00 2001 From: Daniel Ciborowski Date: Sun, 30 Apr 2023 18:03:23 -0400 Subject: [PATCH 4/4] Update src/test/python_tests/test_code_actions.py --- src/test/python_tests/test_code_actions.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/test/python_tests/test_code_actions.py b/src/test/python_tests/test_code_actions.py index c559df1a..a181c151 100644 --- a/src/test/python_tests/test_code_actions.py +++ b/src/test/python_tests/test_code_actions.py @@ -272,12 +272,6 @@ class Banana(object): ) """, """proc = subprocess.run( - ["ls"], - cwd=".", - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - check=False -) """, ), (