mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 21:05:08 +00:00

## Summary This PR renames the `--custom-typeshed-dir`, `target-version`, and `--current-directory` cli options to `--typeshed`, `--python-version`, and `--project` as discussed in the CLI proposal document. I added aliases for `--target-version` (for Ruff compat) and `--custom-typeshed-dir` (for Alex) ## Test Plan Long help ``` An extremely fast Python type checker. Usage: red_knot [OPTIONS] [COMMAND] Commands: server Start the language server help Print this message or the help of the given subcommand(s) Options: --project <PROJECT> Run the command within the given project directory. All `pyproject.toml` files will be discovered by walking up the directory tree from the project root, as will the project's virtual environment (`.venv`). Other command-line arguments (such as relative paths) will be resolved relative to the current working directory."#, --venv-path <PATH> Path to the virtual environment the project uses. If provided, red-knot will use the `site-packages` directory of this virtual environment to resolve type information for the project's third-party dependencies. --typeshed-path <PATH> Custom directory to use for stdlib typeshed stubs --extra-search-path <PATH> Additional path to use as a module-resolution source (can be passed multiple times) --python-version <VERSION> Python version to assume when resolving types [possible values: 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13] -v, --verbose... Use verbose output (or `-vv` and `-vvv` for more verbose output) -W, --watch Run in watch mode by re-running whenever files change -h, --help Print help (see a summary with '-h') -V, --version Print version ``` Short help ``` An extremely fast Python type checker. Usage: red_knot [OPTIONS] [COMMAND] Commands: server Start the language server help Print this message or the help of the given subcommand(s) Options: --project <PROJECT> Run the command within the given project directory --venv-path <PATH> Path to the virtual environment the project uses --typeshed-path <PATH> Custom directory to use for stdlib typeshed stubs --extra-search-path <PATH> Additional path to use as a module-resolution source (can be passed multiple times) --python-version <VERSION> Python version to assume when resolving types [possible values: 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13] -v, --verbose... Use verbose output (or `-vv` and `-vvv` for more verbose output) -W, --watch Run in watch mode by re-running whenever files change -h, --help Print help (see more with '--help') -V, --version Print version ``` --------- Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
24 lines
643 B
Rust
24 lines
643 B
Rust
#![cfg(target_arch = "wasm32")]
|
|
|
|
use wasm_bindgen_test::wasm_bindgen_test;
|
|
|
|
use red_knot_wasm::{PythonVersion, Settings, Workspace};
|
|
|
|
#[wasm_bindgen_test]
|
|
fn check() {
|
|
let settings = Settings {
|
|
python_version: PythonVersion::Py312,
|
|
};
|
|
let mut workspace = Workspace::new("/", &settings).expect("Workspace to be created");
|
|
|
|
workspace
|
|
.open_file("test.py", "import random22\n")
|
|
.expect("File to be opened");
|
|
|
|
let result = workspace.check().expect("Check to succeed");
|
|
|
|
assert_eq!(
|
|
result,
|
|
vec!["error[lint:unresolved-import] /test.py:1:8 Cannot resolve import `random22`"]
|
|
);
|
|
}
|