Content-Length: 242660 | pFad | http://github.com/astral-sh/ruff/pull/16770

70 [`flake8-bandit`] Allow raw strings in `suspicious-mark-safe-usage` (`S308`) #16702 by mfontanaar · Pull Request #16770 · astral-sh/ruff · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[flake8-bandit] Allow raw strings in suspicious-mark-safe-usage (S308) #16702 #16770

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mfontanaar
Copy link

@mfontanaar mfontanaar commented Mar 15, 2025

Summary

Stop flagging each invocation of django.utils.safestring.mark_safe (also available at, django.utils.html.mark_safe) as an error.

Instead, allow string literals as valid uses for mark_safe.

Also, update the documentation, pointing at django.utils.html.format_html for dynamic content generation use cases.

Closes #16702

Test Plan

I verified several possible uses, but string literals, are still flagged.

Stop flagging each invocation of `django.utils.safestring.mark_safe`
(also available at, `django.utils.html.mark_safe`) as an error.

Instead, allow literal strings as valid uses for `mark_safe`.

Also, update the documentation, pointing at
`django.utils.html.format_html` for dynamic content generation use
cases.

I verified several possible uses, but string literals, are still
flagged.
@ntBre ntBre added the rule Implementing or modifying a lint rule label Mar 15, 2025
@mfontanaar mfontanaar changed the title [flake8-bandit] Allow raw strings in suspicious-mark-safe-usage (S308) #16702 [flake8-bandit] Allow raw strings in suspicious-mark-safe-usage (S308) #16702 Mar 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[S308] mark_safe for HTML constants
2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/astral-sh/ruff/pull/16770

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy