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

Option to not sort array contents #37

Closed
jonyscathe opened this issue Jan 3, 2023 · 2 comments
Closed

Option to not sort array contents #37

jonyscathe opened this issue Jan 3, 2023 · 2 comments

Comments

@jonyscathe
Copy link

No description provided.

@jonyscathe
Copy link
Author

Would be very useful to be able to not sort array contents as in some applications that order is important.

For example, with pytest:

[tool.pytest.ini_options]
filterwarnings = [
  'error',
  'default::UserWarning',
]

will treat all warnings as errors, except for UserWarnings which it will just treat as warnings.

But after sorting:

[tool.pytest.ini_options]
filterwarnings = [
  'default::UserWarning',
  'error',
]

will treat all warnings as errors.

This is because when a warning matches more than one option in the list, the action for the last matching option is performed.

@jonyscathe jonyscathe changed the title Option to not sort array contects Option to not sort array contents Jan 3, 2023
@jonyscathe
Copy link
Author

Missed that I had --all set in my pre-commit-config, remove that and don't turn on sort_inline_arrays and I get the behaviour I want.

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

No branches or pull requests

1 participant