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

Avoid use of assert outside of the tests #37718

Merged
merged 5 commits into from
Mar 11, 2024

Conversation

Taragolis
Copy link
Contributor

@Taragolis Taragolis commented Feb 26, 2024

Enable S101 for make sure that we follow https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#dont-use-asserts-outside-tests

This exact the same rule which use by bandit B101, however ruff have some significant benefit - it ignore this rule inside of TYPE_CHECKING which might use for make mypy happy and do not executed in runtime.

pre-commit run ruff --all-files
Run 'ruff' for extremely fast Python linting.............................Failed
- hook id: ruff
- exit code: 1

airflow/cli/commands/task_command.py:215:5: S101 Use of `assert` detected
airflow/models/skipmixin.py:200:9: S101 Use of `assert` detected
airflow/models/taskinstance.py:1028:5: S101 Use of `assert` detected
airflow/models/xcom_arg.py:409:9: S101 Use of `assert` detected
airflow/providers/alibaba/cloud/hooks/analyticdb_spark.py:330:9: S101 Use of `assert` detected
airflow/providers/alibaba/cloud/hooks/oss.py:140:9: S101 Use of `assert` detected
airflow/providers/fab/auth_manager/security_manager/override.py:731:13: S101 Use of `assert` detected
airflow/providers/fab/auth_manager/security_manager/override.py:2449:9: S101 Use of `assert` detected
airflow/providers/fab/auth_manager/security_manager/override.py:2469:9: S101 Use of `assert` detected
airflow/providers/microsoft/psrp/hooks/psrp.py:176:13: S101 Use of `assert` detected
airflow/providers/openlineage/extractors/base.py:81:9: S101 Use of `assert` detected
airflow/providers/yandex/secrets/lockbox.py:132:13: S101 Use of `assert` detected
airflow/serialization/pydantic/job.py:56:9: S101 Use of `assert` detected
dev/breeze/src/airflow_breeze/commands/minor_release_command.py:161:9: S101 Use of `assert` detected
dev/perf/dags/elastic_dag.py:44:5: S101 Use of `assert` detected
scripts/ci/pre_commit/pre_commit_sync_init_decorator.py:96:9: S101 Use of `assert` detected
scripts/in_container/run_migration_reference.py:110:9: S101 Use of `assert` detected
Found 17 errors.

^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@Taragolis Taragolis force-pushed the avoid-assert-out-of-tests branch 2 times, most recently from 1ab3acd to eee0897 Compare March 1, 2024 13:32
@Taragolis
Copy link
Contributor Author

Also fix Batch Executor Config

@potiuk potiuk merged commit c0b849a into apache:main Mar 11, 2024
84 of 85 checks passed
drajguru pushed a commit to drajguru/airflow that referenced this pull request Mar 14, 2024
@ephraimbuddy ephraimbuddy added the type:misc/internal Changelog: Misc changes that should appear in change log label Mar 14, 2024
howardyoo pushed a commit to howardyoo/airflow that referenced this pull request Mar 18, 2024
howardyoo pushed a commit to howardyoo/airflow that referenced this pull request Mar 31, 2024
utkarsharma2 pushed a commit to astronomer/airflow that referenced this pull request Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants