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] Move unsafe-markup-use from RUF035 to S704 #15957

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Daverball
Copy link
Contributor

Summary

RUF035 has been backported into bandit as S704 in this PR

This moves the rule and its corresponding setting to the flake8-bandit category

Test Plan

cargo nextest run

@MichaReiser MichaReiser added this to the v0.10 milestone Feb 5, 2025
@MichaReiser MichaReiser added the breaking Breaking API change label Feb 5, 2025
@Daverball

This comment was marked as resolved.

@MichaReiser
Copy link
Member

Thanks, this has to wait for the next minor release because it's breaking (selecting RUF will no longer select RUF035 and selecting S now selects S704)

Copy link
Contributor

github-actions bot commented Feb 5, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+46 -25 violations, +0 -0 fixes in 4 projects; 51 projects unchanged)

apache/airflow (+17 -17 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL

- airflow/www/app.py:94:25: RUF035 Unsafe use of `markupsafe.Markup` detected
+ airflow/www/app.py:94:25: S704 Unsafe use of `markupsafe.Markup` detected
- airflow/www/utils.py:388:12: RUF035 Unsafe use of `markupsafe.Markup` detected
+ airflow/www/utils.py:388:12: S704 Unsafe use of `markupsafe.Markup` detected
- airflow/www/utils.py:584:16: RUF035 Unsafe use of `markupsafe.Markup` detected
+ airflow/www/utils.py:584:16: S704 Unsafe use of `markupsafe.Markup` detected
- airflow/www/utils.py:592:20: RUF035 Unsafe use of `markupsafe.Markup` detected
+ airflow/www/utils.py:592:20: S704 Unsafe use of `markupsafe.Markup` detected
- airflow/www/utils.py:601:20: RUF035 Unsafe use of `markupsafe.Markup` detected
+ airflow/www/utils.py:601:20: S704 Unsafe use of `markupsafe.Markup` detected
- airflow/www/utils.py:605:16: RUF035 Unsafe use of `markupsafe.Markup` detected
+ airflow/www/utils.py:605:16: S704 Unsafe use of `markupsafe.Markup` detected
- airflow/www/utils.py:616:15: RUF035 Unsafe use of `markupsafe.Markup` detected
+ airflow/www/utils.py:616:15: S704 Unsafe use of `markupsafe.Markup` detected
- airflow/www/utils.py:619:15: RUF035 Unsafe use of `markupsafe.Markup` detected
+ airflow/www/utils.py:619:15: S704 Unsafe use of `markupsafe.Markup` detected
- airflow/www/utils.py:629:12: RUF035 Unsafe use of `markupsafe.Markup` detected
+ airflow/www/utils.py:629:12: S704 Unsafe use of `markupsafe.Markup` detected
- airflow/www/utils.py:932:24: RUF035 Unsafe use of `markupsafe.Markup` detected
+ airflow/www/utils.py:932:24: S704 Unsafe use of `markupsafe.Markup` detected
- airflow/www/views.py:1093:21: RUF035 Unsafe use of `markupsafe.Markup` detected
+ airflow/www/views.py:1093:21: S704 Unsafe use of `markupsafe.Markup` detected
- airflow/www/views.py:1112:24: RUF035 Unsafe use of `markupsafe.Markup` detected
... 6 additional changes omitted for rule RUF035
... 11 additional changes omitted for project

apache/superset (+7 -7 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL

- superset/connectors/sqla/models.py:1308:16: RUF035 Unsafe use of `markupsafe.Markup` detected
+ superset/connectors/sqla/models.py:1308:16: S704 Unsafe use of `markupsafe.Markup` detected
- superset/models/dashboard.py:225:16: RUF035 Unsafe use of `markupsafe.Markup` detected
+ superset/models/dashboard.py:225:16: S704 Unsafe use of `markupsafe.Markup` detected
- superset/models/helpers.py:538:16: RUF035 Unsafe use of `markupsafe.Markup` detected
+ superset/models/helpers.py:538:16: S704 Unsafe use of `markupsafe.Markup` detected
- superset/models/helpers.py:567:16: RUF035 Unsafe use of `markupsafe.Markup` detected
+ superset/models/helpers.py:567:16: S704 Unsafe use of `markupsafe.Markup` detected
- superset/models/slice.py:338:16: RUF035 Unsafe use of `markupsafe.Markup` detected
+ superset/models/slice.py:338:16: S704 Unsafe use of `markupsafe.Markup` detected
... 4 additional changes omitted for project

freedomofpress/securedrop (+21 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview

+ securedrop/journalist_app/account.py:100:20: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/account.py:87:20: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/admin.py:224:32: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/admin.py:279:20: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/admin.py:295:20: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/col.py:103:17: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/col.py:75:13: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/main.py:169:17: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/main.py:192:21: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/main.py:203:21: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/utils.py:267:9: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/utils.py:337:13: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/utils.py:366:13: S704 Unsafe use of `markupsafe.Markup` detected
+ securedrop/journalist_app/utils.py:380:13: S704 Unsafe use of `markupsafe.Markup` detected
... 7 additional changes omitted for project

zulip/zulip (+1 -1 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --no-fix --output-format concise --preview --select ALL

- zerver/views/documentation.py:291:35: RUF035 Unsafe use of `markupsafe.Markup` detected
+ zerver/views/documentation.py:291:35: S704 Unsafe use of `markupsafe.Markup` detected

Changes by rule (2 rules affected)

code total + violation - violation + fix - fix
S704 46 46 0 0 0
RUF035 25 0 25 0 0

@MichaReiser
Copy link
Member

@MichaReiser Can you think of a clever way to default the settings in their new section to the value in their deprecated section?

Clever, no :) But what I'd do is to lift the Flake8Options::into_settings into Configuration::into_settings because that's where you have access to both the Ruff and Flake8 options. Or you change the Flake8Options::into_settings to take a second argument that's an Option<&RuffOptions>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking API change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants