diff --git a/precli/rules/python/stdlib/smtplib_unverified_context.py b/precli/rules/python/stdlib/smtplib_unverified_context.py index 4f6f1d74..87ef43d0 100644 --- a/precli/rules/python/stdlib/smtplib_unverified_context.py +++ b/precli/rules/python/stdlib/smtplib_unverified_context.py @@ -135,10 +135,7 @@ def analyze_call(self, context: dict, call: Call) -> Result | None: ]: return - if call.name_qualified == "smtplib.SMTP_SSL": - ssl_context = call.get_argument(name="context") - else: - ssl_context = call.get_argument(position=0, name="context") + ssl_context = call.get_argument(name="context") if ssl_context.value is not None: return diff --git a/tests/unit/rules/python/stdlib/smtplib/examples/smtplib_smtp_starttls_context_none.py b/tests/unit/rules/python/stdlib/smtplib/examples/smtplib_smtp_starttls_context_none.py index 271888a1..d1a6d292 100644 --- a/tests/unit/rules/python/stdlib/smtplib/examples/smtplib_smtp_starttls_context_none.py +++ b/tests/unit/rules/python/stdlib/smtplib/examples/smtplib_smtp_starttls_context_none.py @@ -1,8 +1,8 @@ # level: WARNING # start_line: 31 # end_line: 31 -# start_column: 16 -# end_column: 20 +# start_column: 24 +# end_column: 28 import smtplib @@ -28,7 +28,7 @@ def prompt(prompt): print("Message length is", len(msg)) server = smtplib.SMTP("localhost", timeout=5) -server.starttls(None) +server.starttls(context=None) server.login("user", "password") server.set_debuglevel(1) server.sendmail(fromaddr, toaddrs, msg)