mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:43 +00:00
Add initial wasm32-wasi support (#416)
This commit is contained in:
parent
7741a713e2
commit
bb466bc8d3
6 changed files with 149 additions and 29 deletions
|
@ -4,6 +4,7 @@ use std::io::Write;
|
|||
use std::path::Path;
|
||||
|
||||
use anyhow::Result;
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
use log::debug;
|
||||
use rustpython_parser::lexer::LexResult;
|
||||
use rustpython_parser::{lexer, parser};
|
||||
|
@ -122,6 +123,7 @@ pub fn lint_stdin(
|
|||
.collect())
|
||||
}
|
||||
|
||||
#[cfg_attr(target_family = "wasm", allow(unused_variables))]
|
||||
pub fn lint_path(
|
||||
path: &Path,
|
||||
settings: &Settings,
|
||||
|
@ -131,6 +133,7 @@ pub fn lint_path(
|
|||
let metadata = path.metadata()?;
|
||||
|
||||
// Check the cache.
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
if let Some(messages) = cache::get(path, &metadata, settings, autofix, mode) {
|
||||
debug!("Cache hit for: {}", path.to_string_lossy());
|
||||
return Ok(messages);
|
||||
|
@ -166,6 +169,7 @@ pub fn lint_path(
|
|||
filename: path.to_string_lossy().to_string(),
|
||||
})
|
||||
.collect();
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
cache::set(path, &metadata, settings, autofix, &messages, mode);
|
||||
|
||||
Ok(messages)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue