mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-07 21:25:08 +00:00
Rename Red Knot (#17820)
This commit is contained in:
parent
e6a798b962
commit
b51c4f82ea
1564 changed files with 1598 additions and 1578 deletions
|
@ -17,8 +17,6 @@ libfuzzer = ["libfuzzer-sys/link_libfuzzer"]
|
|||
cargo-fuzz = true
|
||||
|
||||
[dependencies]
|
||||
red_knot_python_semantic = { path = "../crates/red_knot_python_semantic" }
|
||||
red_knot_vendored = { path = "../crates/red_knot_vendored" }
|
||||
ruff_db = { path = "../crates/ruff_db" }
|
||||
ruff_linter = { path = "../crates/ruff_linter" }
|
||||
ruff_python_ast = { path = "../crates/ruff_python_ast" }
|
||||
|
@ -28,6 +26,9 @@ ruff_source_file = { path = "../crates/ruff_source_file" }
|
|||
ruff_python_formatter = { path = "../crates/ruff_python_formatter" }
|
||||
ruff_text_size = { path = "../crates/ruff_text_size" }
|
||||
|
||||
ty_python_semantic = { path = "../crates/ty_python_semantic" }
|
||||
ty_vendored = { path = "../crates/ty_vendored" }
|
||||
|
||||
libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer", default-features = false }
|
||||
salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "42f15835c0005c4b37aaf5bc1a15e3e1b3df14b7" }
|
||||
similar = { version = "2.5.0" }
|
||||
|
@ -38,8 +39,8 @@ tracing = { version = "0.1.40" }
|
|||
members = ["."]
|
||||
|
||||
[[bin]]
|
||||
name = "red_knot_check_invalid_syntax"
|
||||
path = "fuzz_targets/red_knot_check_invalid_syntax.rs"
|
||||
name = "ty_check_invalid_syntax"
|
||||
path = "fuzz_targets/ty_check_invalid_syntax.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "ruff_parse_simple"
|
||||
|
|
|
@ -74,9 +74,9 @@ Each fuzzer harness in [`fuzz_targets`](fuzz_targets) targets a different aspect
|
|||
them in different ways. While there is implementation-specific documentation in the source code
|
||||
itself, each harness is briefly described below.
|
||||
|
||||
### `red_knot_check_invalid_syntax`
|
||||
### `ty_check_invalid_syntax`
|
||||
|
||||
This fuzz harness checks that the type checker (Red Knot) does not panic when checking a source
|
||||
This fuzz harness checks that the type checker (ty) does not panic when checking a source
|
||||
file with invalid syntax. This rejects any corpus entries that is already valid Python code.
|
||||
Currently, this is limited to syntax errors that's produced by Ruff's Python parser which means
|
||||
that it does not cover all possible syntax errors (<https://github.com/astral-sh/ruff/issues/11934>).
|
||||
|
|
|
@ -7,12 +7,6 @@ use std::sync::{Arc, Mutex, OnceLock};
|
|||
|
||||
use libfuzzer_sys::{fuzz_target, Corpus};
|
||||
|
||||
use red_knot_python_semantic::lint::LintRegistry;
|
||||
use red_knot_python_semantic::types::check_types;
|
||||
use red_knot_python_semantic::{
|
||||
default_lint_registry, lint::RuleSelection, Db as SemanticDb, Program, ProgramSettings,
|
||||
PythonPlatform, SearchPathSettings,
|
||||
};
|
||||
use ruff_db::files::{system_path_to_file, File, Files};
|
||||
use ruff_db::system::{
|
||||
DbWithTestSystem, DbWithWritableSystem as _, System, SystemPathBuf, TestSystem,
|
||||
|
@ -21,6 +15,12 @@ use ruff_db::vendored::VendoredFileSystem;
|
|||
use ruff_db::{Db as SourceDb, Upcast};
|
||||
use ruff_python_ast::PythonVersion;
|
||||
use ruff_python_parser::{parse_unchecked, Mode, ParseOptions};
|
||||
use ty_python_semantic::lint::LintRegistry;
|
||||
use ty_python_semantic::types::check_types;
|
||||
use ty_python_semantic::{
|
||||
default_lint_registry, lint::RuleSelection, Db as SemanticDb, Program, ProgramSettings,
|
||||
PythonPlatform, SearchPathSettings,
|
||||
};
|
||||
|
||||
/// Database that can be used for testing.
|
||||
///
|
||||
|
@ -41,7 +41,7 @@ impl TestDb {
|
|||
Self {
|
||||
storage: salsa::Storage::default(),
|
||||
system: TestSystem::default(),
|
||||
vendored: red_knot_vendored::file_system().clone(),
|
||||
vendored: ty_vendored::file_system().clone(),
|
||||
events: Arc::default(),
|
||||
files: Files::default(),
|
||||
rule_selection: RuleSelection::from_registry(default_lint_registry()).into(),
|
|
@ -23,7 +23,7 @@ if [ ! -d corpus/ruff_fix_validity ]; then
|
|||
|
||||
# Build a smaller corpus in addition to the (optional) larger corpus
|
||||
curl -L 'https://github.com/python/cpython/archive/refs/tags/v3.13.0.tar.gz' | tar xz
|
||||
cp -r "../../../crates/red_knot_project/resources/test/corpus" "red_knot_project"
|
||||
cp -r "../../../crates/ty_project/resources/test/corpus" "ty_project"
|
||||
cp -r "../../../crates/ruff_linter/resources/test/fixtures" "ruff_linter"
|
||||
cp -r "../../../crates/ruff_python_formatter/resources/test/fixtures" "ruff_python_formatter"
|
||||
cp -r "../../../crates/ruff_python_parser/resources" "ruff_python_parser"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue