mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:43 +00:00
Don't raise D208
when last line is non-empty (#13372)
Co-authored-by: Micha Reiser <micha@reiser.io>
This commit is contained in:
parent
ae39ce56c0
commit
e83388dcea
4 changed files with 253 additions and 29 deletions
|
@ -46,3 +46,42 @@ pub mod upstream_categories;
|
|||
pub mod test;
|
||||
|
||||
pub const RUFF_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::path::Path;
|
||||
|
||||
use ruff_python_ast::PySourceType;
|
||||
|
||||
use crate::codes::Rule;
|
||||
use crate::settings::LinterSettings;
|
||||
use crate::source_kind::SourceKind;
|
||||
use crate::test::{print_messages, test_contents};
|
||||
|
||||
/// Test for ad-hoc debugging.
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn linter_quick_test() {
|
||||
let code = r#"class Platform:
|
||||
""" Remove sampler
|
||||
Args:
|
||||
Returns:
|
||||
"""
|
||||
"#;
|
||||
let source_type = PySourceType::Python;
|
||||
let rule = Rule::OverIndentation;
|
||||
|
||||
let source_kind = SourceKind::from_source_code(code.to_string(), source_type)
|
||||
.expect("Source code should be valid")
|
||||
.expect("Notebook to contain python code");
|
||||
|
||||
let (diagnostics, fixed) = test_contents(
|
||||
&source_kind,
|
||||
Path::new("ruff_linter/rules/quick_test"),
|
||||
&LinterSettings::for_rule(rule),
|
||||
);
|
||||
|
||||
assert_eq!(print_messages(&diagnostics), "");
|
||||
assert_eq!(fixed.source_code(), code);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue