Skip to content

[ruff] Adds an allowlist for unsafe-markup-use (RUF035)#15076

Merged
dhruvmanila merged 5 commits intoastral-sh:mainfrom
Daverball:feat/markup-whitelist-calls
Dec 20, 2024
Merged

[ruff] Adds an allowlist for unsafe-markup-use (RUF035)#15076
dhruvmanila merged 5 commits intoastral-sh:mainfrom
Daverball:feat/markup-whitelist-calls

Conversation

@Daverball
Copy link
Contributor

Closes: #14523

Summary

Adds a whitelist of calls allowed to be used within a markupsafe.Markup call.

Test Plan

cargo nextest run

Comment on lines +7 to +9
# indirect assignments are currently not supported
cleaned = clean(content)
Markup(cleaned) # RUF035
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I considered making this work. But then we should probably also make the same thing work with string/bytes literals. At which point I would have to change some of the examples, so they still make sense. So I held off for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine for now to limit this to only direct calls.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 20, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@dhruvmanila dhruvmanila added the configuration Related to settings and configuration label Dec 20, 2024
@MichaReiser MichaReiser changed the title [ruff] Adds a whitelist for unsafe-markup-use. [ruff] Adds an allowlist for unsafe-markup-use. Dec 20, 2024
@dhruvmanila dhruvmanila changed the title [ruff] Adds an allowlist for unsafe-markup-use. [ruff] Adds an allowlist for unsafe-markup-use (RUF035) Dec 20, 2024
@dhruvmanila dhruvmanila enabled auto-merge (squash) December 20, 2024 09:35
@dhruvmanila dhruvmanila merged commit 089a98e into astral-sh:main Dec 20, 2024
@Daverball Daverball deleted the feat/markup-whitelist-calls branch December 20, 2024 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration Related to settings and configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RUF035 (unsafe-markup-use) can be noisy and would benefit from a whitelist

2 participants