Revert adding toml and jupyter#45
Merged
charliermarsh merged 3 commits intoastral-sh:mainfrom Jul 10, 2023
hamdanal:patch-1
Merged
Revert adding toml and jupyter#45charliermarsh merged 3 commits intoastral-sh:mainfrom hamdanal:patch-1
charliermarsh merged 3 commits intoastral-sh:mainfrom
hamdanal:patch-1
Conversation
dhruvmanila
added a commit
to astral-sh/ruff
that referenced
this pull request
Jul 10, 2023
charliermarsh
added a commit
to astral-sh/ruff
that referenced
this pull request
Aug 28, 2023
## Summary This PR adds a higher-level enum (`SourceType`) around `PySourceType` to allow us to use the same detection path to handle TOML files. Right now, we have ad hoc `is_pyproject_toml` checks littered around, and some codepaths are omitting that logic altogether (like `add_noqa`). Instead, we should always be required to check the source type and handle TOML files as appropriate. This PR will also help with our pre-commit capabilities. If we add `toml` to pre-commit (to support `pyproject.toml`), pre-commit will start to pass _other_ files to Ruff (along with `poetry.lock` and `Pipfile` -- see [identify](https://github.com/pre-commit/identify/blob/b59996304fea80025d32abc3ac8f7212a9e7380d/identify/extensions.py#L355)). By detecting those files and handling those cases, we avoid attempting to parse them as Python files, which would lead to pre-commit errors. (We tried to add `toml` to pre-commit here (astral-sh/ruff-pre-commit#44), but had to revert here (astral-sh/ruff-pre-commit#45) as it led to the pre-commit hook attempting to parse `poetry.lock` files as Python files.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #44 (comment)