mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 14:21:53 +00:00

## Summary `RUF035` has been backported into bandit as `S704` in this [PR](https://github.com/PyCQA/bandit/pull/1225) This moves the rule and its corresponding setting to the `flake8-bandit` category ## Test Plan `cargo nextest run` --------- Co-authored-by: Micha Reiser <micha@reiser.io>
18 lines
718 B
Python
18 lines
718 B
Python
import flask
|
|
from markupsafe import Markup, escape
|
|
|
|
content = "<script>alert('Hello, world!')</script>"
|
|
Markup(f"unsafe {content}") # S704
|
|
flask.Markup("unsafe {}".format(content)) # S704
|
|
Markup("safe {}").format(content)
|
|
flask.Markup(b"safe {}", encoding='utf-8').format(content)
|
|
escape(content)
|
|
Markup(content) # S704
|
|
flask.Markup("unsafe %s" % content) # S704
|
|
Markup(object="safe")
|
|
Markup(object="unsafe {}".format(content)) # Not currently detected
|
|
|
|
# NOTE: We may be able to get rid of these false positives with red-knot
|
|
# if it includes comprehensive constant expression detection/evaluation.
|
|
Markup("*" * 8) # S704 (false positive)
|
|
flask.Markup("hello {}".format("world")) # S704 (false positive)
|