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

Added ignoring deprecated rules for --select=ALL #10497

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

Conversation

WindowGenerator
Copy link
Contributor

Summary

#10342: Added ignoring deprecated rules for --select=ALL

Test Plan

Changed integration tests with --select=ALL option

@zanieb zanieb self-assigned this Mar 20, 2024
@WindowGenerator WindowGenerator changed the title #10342: Added ignoring deprecated rules for --select=ALL Added ignoring deprecated rules for --select=ALL Mar 20, 2024
Comment on lines 189 to 194
/// Return all matching rules, regardless of rule group filters like preview and deprecated.
pub fn all_rules(&self) -> impl Iterator<Item = Rule> + '_ {
match self {
RuleSelector::All => RuleSelectorIter::All(Rule::iter()),

RuleSelector::All => {
RuleSelectorIter::All(Rule::iter().filter(|rule| !rule.is_deprecated()))
}
Copy link
Member

@zanieb zanieb Mar 20, 2024

Choose a reason for hiding this comment

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

Per the comment prefacing this function, we should not do this filtering here. Perhaps in rules() instead?

Copy link
Member

Choose a reason for hiding this comment

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

Hey @WindowGenerator just want to check in again as we get closer to 0.4.0, did you want to work on this still?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @zanieb!
Yes, I will do it before the end of the weekend.

Copy link
Member

Choose a reason for hiding this comment

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

Not a rush! Thanks for the reply.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zanieb Hi!
Code was changed, you can check it.

Copy link

github-actions bot commented Mar 20, 2024

ruff-ecosystem results

Linter (stable)

ℹ️ ecosystem check detected linter changes. (+1 -35120 violations, +0 -0 fixes in 3 projects; 41 projects unchanged)

apache/airflow (+1 -24265 violations, +0 -0 fixes)

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

- airflow/api/auth/backend/kerberos_auth.py:69:18: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:28:18: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:34:21: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:46:20: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:53:18: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:60:19: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:64:21: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:74:21: ANN101 Missing type annotation for `self` in method
- airflow/api/client/api_client.py:81:21: ANN101 Missing type annotation for `self` in method
- airflow/api/client/json_client.py:101:19: ANN101 Missing type annotation for `self` in method
- airflow/api/client/json_client.py:112:21: ANN101 Missing type annotation for `self` in method
- airflow/api/client/json_client.py:133:21: ANN101 Missing type annotation for `self` in method
... 23731 additional changes omitted for rule ANN101
- airflow/callbacks/callback_requests.py:57:19: ANN102 Missing type annotation for `cls` in classmethod
- airflow/callbacks/callback_requests.py:95:19: ANN102 Missing type annotation for `cls` in classmethod
- airflow/cli/commands/standalone_command.py:51:20: ANN102 Missing type annotation for `cls` in classmethod
- airflow/dag_processing/manager.py:497:9: ANN102 Missing type annotation for `cls` in classmethod
- airflow/dag_processing/processor.py:421:21: ANN102 Missing type annotation for `cls` in classmethod
- airflow/dag_processing/processor.py:796:21: ANN102 Missing type annotation for `cls` in classmethod
- airflow/exceptions.py:245:15: ANN102 Missing type annotation for `cls` in classmethod
- airflow/executors/base_executor.py:512:21: ANN102 Missing type annotation for `cls` in classmethod
- airflow/executors/executor_loader.py:158:28: ANN102 Missing type annotation for `cls` in classmethod
- airflow/executors/executor_loader.py:166:35: ANN102 Missing type annotation for `cls` in classmethod
- airflow/executors/executor_loader.py:175:30: ANN102 Missing type annotation for `cls` in classmethod
- airflow/executors/executor_loader.py:182:24: ANN102 Missing type annotation for `cls` in classmethod
... 511 additional changes omitted for rule ANN102
+ airflow/utils/pydantic.py:60:13: D107 Missing docstring in `__init__`
- airflow/utils/pydantic.py:60:13: D107 Missing docstring in `__init__`
... 24240 additional changes omitted for project

bokeh/bokeh (+0 -4088 violations, +0 -0 fixes)

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

- examples/output/apis/autoload_static.py:32:20: ANN101 Missing type annotation for `self` in method
- examples/output/apis/autoload_static.py:34:13: ANN101 Missing type annotation for `self` in method
- examples/output/apis/autoload_static.py:41:20: ANN101 Missing type annotation for `self` in method
- examples/output/apis/autoload_static.py:43:13: ANN101 Missing type annotation for `self` in method
- examples/server/api/tornado_embed.py:15:13: ANN101 Missing type annotation for `self` in method
- examples/server/app/server_auth/auth.py:27:13: ANN101 Missing type annotation for `self` in method
... 4003 additional changes omitted for rule ANN101
- src/bokeh/client/session.py:524:28: ANN102 Missing type annotation for `cls` in classmethod
- src/bokeh/colors/color.py:115:18: ANN102 Missing type annotation for `cls` in classmethod
- src/bokeh/colors/color.py:132:18: ANN102 Missing type annotation for `cls` in classmethod
- src/bokeh/colors/color.py:245:18: ANN102 Missing type annotation for `cls` in classmethod
... 4078 additional changes omitted for project

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

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

- analytics/lib/counts.py:105:9: ANN101 Missing type annotation for `self` in method
- analytics/lib/counts.py:112:26: ANN101 Missing type annotation for `self` in method
- analytics/lib/counts.py:49:24: ANN101 Missing type annotation for `self` in method
- analytics/lib/counts.py:55:9: ANN101 Missing type annotation for `self` in method
- analytics/lib/counts.py:73:18: ANN101 Missing type annotation for `self` in method
- analytics/lib/counts.py:76:30: ANN101 Missing type annotation for `self` in method
... 6712 additional changes omitted for rule ANN101
- corporate/models.py:187:45: ANN102 Missing type annotation for `cls` in classmethod
- zerver/lib/narrow.py:90:22: ANN102 Missing type annotation for `cls` in classmethod
- zerver/lib/notes.py:40:19: ANN102 Missing type annotation for `cls` in classmethod
- zerver/lib/notes.py:48:19: ANN102 Missing type annotation for `cls` in classmethod
... 6757 additional changes omitted for project

Changes by rule (3 rules affected)

code total + violation - violation + fix - fix
ANN101 34467 0 34467 0 0
ANN102 652 0 652 0 0
D107 2 1 1 0 0

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser
Copy link
Member

Is this a breaking change because we remove rules from a selector?

@zanieb
Copy link
Member

zanieb commented Mar 20, 2024

@MichaReiser that's a good call... maybe. It'd be easy to hold off merging until v0.4.0 which seems reasonable.

@MichaReiser
Copy link
Member

It might be fine, at least from our versioning policy.

The change is reasonable to me but it might be worth documenting that all selects all not deprecated rules to make it clear to users that they might "loose" rules even when upgrading to a new patch version

@zanieb zanieb added this to the v0.4.0 milestone Apr 12, 2024
@WindowGenerator WindowGenerator force-pushed the deny-deprecated-rules-in-seleect-all-option branch 2 times, most recently from fb70a9a to 5577cb0 Compare April 14, 2024 12:54
@dhruvmanila dhruvmanila modified the milestones: v0.4.0, v0.5.0 Apr 18, 2024
@Alexdelia
Copy link

hi, this changed was planned for version v0.4.0, but moved to v0.5.0

what is the reason behind this choice?

@zanieb
Copy link
Member

zanieb commented Apr 24, 2024

Hey @Alexdelia, we ended up releasing the parser in 0.4.0 and focused on delivery of that. We routinely move things to later milestones when they aren't high priority for the given release.

Comment on lines 227 to 228
// Deprecated rules are excluded in preview mode unless explicitly selected
|| (rule.is_deprecated() && (!preview_enabled || self.is_exact()))
// Ignore deprecated rules for All option
|| (rule.is_deprecated() && (!preview_enabled || self.is_exact()) && !matches!(self, RuleSelector::All { .. }))
Copy link
Member

Choose a reason for hiding this comment

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

Can you combine this comment with the one above? e.g.

Deprecated rules are excluded from ALL in stable require exact selection in preview

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did it!

@WindowGenerator WindowGenerator force-pushed the deny-deprecated-rules-in-seleect-all-option branch from 5577cb0 to bb3f038 Compare May 1, 2024 15:51
@WindowGenerator WindowGenerator force-pushed the deny-deprecated-rules-in-seleect-all-option branch from bb3f038 to eeb9c3b Compare May 1, 2024 15:52
@zanieb zanieb added the breaking Breaking API change label May 1, 2024
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.

None yet

5 participants