mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-16 15:25:25 +00:00
Replace row/column based Location
with byte-offsets. (#3931)
This commit is contained in:
parent
ee91598835
commit
cab65b25da
418 changed files with 6203 additions and 7040 deletions
|
@ -8,12 +8,13 @@ use ignore::Error;
|
|||
use log::{debug, error, warn};
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
use rayon::prelude::*;
|
||||
use ruff_text_size::{TextRange, TextSize};
|
||||
|
||||
use ruff::message::{Location, Message};
|
||||
use ruff::message::Message;
|
||||
use ruff::registry::Rule;
|
||||
use ruff::resolver::PyprojectDiscovery;
|
||||
use ruff::settings::{flags, AllSettings};
|
||||
use ruff::{fs, packaging, resolver, warn_user_once, IOError, Range};
|
||||
use ruff::{fs, packaging, resolver, warn_user_once, IOError};
|
||||
use ruff_diagnostics::Diagnostic;
|
||||
use ruff_python_ast::imports::ImportMap;
|
||||
use ruff_python_ast::source_code::SourceFileBuilder;
|
||||
|
@ -117,16 +118,14 @@ pub fn run(
|
|||
);
|
||||
let settings = resolver.resolve(path, pyproject_strategy);
|
||||
if settings.rules.enabled(Rule::IOError) {
|
||||
let file = SourceFileBuilder::new(&path.to_string_lossy()).finish();
|
||||
let file =
|
||||
SourceFileBuilder::new(path.to_string_lossy().as_ref(), "").finish();
|
||||
|
||||
Diagnostics::new(
|
||||
vec![Message::from_diagnostic(
|
||||
Diagnostic::new(
|
||||
IOError { message },
|
||||
Range::new(Location::default(), Location::default()),
|
||||
),
|
||||
Diagnostic::new(IOError { message }, TextRange::default()),
|
||||
file,
|
||||
1,
|
||||
TextSize::default(),
|
||||
)],
|
||||
ImportMap::default(),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue