Skip to content

Avoid raising S310 on string literals #8040

@ZeeD

Description

@ZeeD

s310literal.py

from urllib.request import urlopen

urlopen("http://www.example.com")

command:

$ ruff check --select S310 s310literal.py
s310literal.py:3:1: S310 Audit URL open for permitted schemes. Allowing use of `file:` or custom schemes is often unexpected.
Found 1 error.

ruff rule S310 suggest

To mitigate this risk, audit all uses of URL open functions and ensure that
only permitted schemes are used (e.g., allowing http: and https: and
disallowing file: and ftp:).

but in this case there is nothing to check...

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions