mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
Refactor SourceKind
to store file content (#6640)
This commit is contained in:
parent
2aeb27334d
commit
ea72d5feba
17 changed files with 206 additions and 179 deletions
|
@ -7,6 +7,7 @@ use criterion::{
|
|||
|
||||
use ruff::linter::lint_only;
|
||||
use ruff::settings::{flags, Settings};
|
||||
use ruff::source_kind::SourceKind;
|
||||
use ruff::RuleSelector;
|
||||
use ruff_benchmark::{TestCase, TestCaseSpeed, TestFile, TestFileDownloadError};
|
||||
use ruff_python_ast::PySourceType;
|
||||
|
@ -57,15 +58,15 @@ fn benchmark_linter(mut group: BenchmarkGroup<WallTime>, settings: &Settings) {
|
|||
BenchmarkId::from_parameter(case.name()),
|
||||
&case,
|
||||
|b, case| {
|
||||
let kind = SourceKind::Python(case.code().to_string());
|
||||
b.iter(|| {
|
||||
let path = case.path();
|
||||
let result = lint_only(
|
||||
case.code(),
|
||||
&path,
|
||||
None,
|
||||
settings,
|
||||
flags::Noqa::Enabled,
|
||||
None,
|
||||
&kind,
|
||||
PySourceType::from(path.as_path()),
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue