ruff/crates/ruff_cli
Felix Williams 7391f74cbc
Add hidden `--extension` to override inference of source type from file extension (#8373)
## Summary

This PR addresses the incompatibility with `jupyterlab-lsp` +
`python-lsp-ruff` arising from the inference of source type from file
extension, raised in #6847.

In particular it follows the suggestion in
https://github.com/astral-sh/ruff/issues/6847#issuecomment-1765724679 to
specify a mapping from file extension to source type.

The source types are

- python
- pyi
- ipynb

Usage:

```sh
ruff check --no-cache --stdin-filename Untitled.ipynb --extension ipynb:python
```

Unlike the original suggestion, `:` instead of `=` is used to associate
file extensions to language since that is what is used with
`--per-file-ignores` which is an existing option that accepts a mapping.

## Test Plan

2 tests added to `integration_test.rs` to ensure the override works as
expected

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
2023-11-08 08:02:40 +05:30
..
resources/test/fixtures Formatter parentheses support for `IpyEscapeCommand` (#8207) 2023-10-25 14:01:50 +00:00
src Add hidden `--extension` to override inference of source type from file extension (#8373) 2023-11-08 08:02:40 +05:30
tests Add hidden `--extension` to override inference of source type from file extension (#8373) 2023-11-08 08:02:40 +05:30
Cargo.toml Bump version to v0.1.4 (#8477) 2023-11-03 14:52:56 -04:00
build.rs Add `ruff version` with long version display (#8034) 2023-10-20 14:07:41 -05:00