Skip to content

Resolve escape and possibly auto-fix unsafe-markup-use (S704) #16689

@ntBre

Description

@ntBre

Summary

As discussed in the stabilization PR (#16643), it would be nice to avoid flagging S704 on code like this:

    def dashboard_link(self) -> Markup:
        title = escape(self.dashboard_title or "<empty>")
        return Markup(title)

by resolving variables passed to Markup.

It could also be nice to autofix simple f-strings or format calls into Markup.format calls.

See #16643 (comment) and #16643 (comment) for more context and ideas.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions