Compare commits

..

3 Commits

Author SHA1 Message Date
Charlie Marsh
062c41b6f5 Bump version to 0.0.93 2022-10-31 09:20:39 -04:00
Charlie Marsh
78889efa37 Modify public API to return Check rather than Message (#524) 2022-10-31 09:20:14 -04:00
Charlie Marsh
97fc281779 Remove erroneous foo.py file 2022-10-30 19:19:49 -04:00
6 changed files with 8 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.92
rev: v0.0.93
hooks:
- id: ruff

2
Cargo.lock generated
View File

@@ -2190,7 +2190,7 @@ dependencies = [
[[package]]
name = "ruff"
version = "0.0.92"
version = "0.0.93"
dependencies = [
"anyhow",
"assert_cmd",

View File

@@ -1,6 +1,6 @@
[package]
name = "ruff"
version = "0.0.92"
version = "0.0.93"
edition = "2021"
[lib]

View File

@@ -89,7 +89,7 @@ Ruff also works with [pre-commit](https://pre-commit.com):
```yaml
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.92
rev: v0.0.93
hooks:
- id: ruff
```

5
foo.py
View File

@@ -1,5 +0,0 @@
def function_with_nesting():
"""Foo bar documentation."""
@overload
def nested_overloaded_func(a: int) -> str:
...

View File

@@ -10,12 +10,12 @@ use settings::pyproject;
use settings::Settings;
use crate::autofix::fixer::Mode;
use crate::checks::Check;
use crate::linter::{check_path, tokenize};
use crate::message::Message;
use crate::settings::configuration::Configuration;
mod ast;
mod autofix;
pub mod autofix;
pub mod cache;
pub mod check_ast;
mod check_lines;
@@ -48,7 +48,7 @@ pub mod source_code_locator;
pub mod visibility;
/// Run ruff over Python source code directly.
pub fn check(path: &Path, contents: &str) -> Result<Vec<Message>> {
pub fn check(path: &Path, contents: &str) -> Result<Vec<Check>> {
// Find the project root and pyproject.toml.
let project_root = pyproject::find_project_root(&[path.to_path_buf()]);
match &project_root {
@@ -80,17 +80,5 @@ pub fn check(path: &Path, contents: &str) -> Result<Vec<Message>> {
&Mode::None,
)?;
// Convert to messages.
let messages: Vec<Message> = checks
.into_iter()
.map(|check| Message {
kind: check.kind,
fixed: check.fix.map(|fix| fix.applied).unwrap_or_default(),
location: check.location,
end_location: check.end_location,
filename: path.to_string_lossy().to_string(),
})
.collect();
Ok(messages)
Ok(checks)
}