mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 13:51:37 +00:00
Remove offsets hacks for docstring parsing logic (#440)
This commit is contained in:
parent
d9e659d817
commit
248a6cd50b
15 changed files with 115 additions and 137 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -2101,7 +2101,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustpython-ast"
|
name = "rustpython-ast"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/charliermarsh/RustPython.git?rev=778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f#778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f"
|
source = "git+https://github.com/charliermarsh/RustPython.git?rev=210db77e4274787028dc3ebc0b4841d1334c8c10#210db77e4274787028dc3ebc0b4841d1334c8c10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
"rustpython-common",
|
"rustpython-common",
|
||||||
|
@ -2111,7 +2111,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustpython-common"
|
name = "rustpython-common"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
source = "git+https://github.com/charliermarsh/RustPython.git?rev=778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f#778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f"
|
source = "git+https://github.com/charliermarsh/RustPython.git?rev=210db77e4274787028dc3ebc0b4841d1334c8c10#210db77e4274787028dc3ebc0b4841d1334c8c10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ascii",
|
"ascii",
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
|
@ -2134,7 +2134,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustpython-compiler-core"
|
name = "rustpython-compiler-core"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
source = "git+https://github.com/charliermarsh/RustPython.git?rev=778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f#778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f"
|
source = "git+https://github.com/charliermarsh/RustPython.git?rev=210db77e4274787028dc3ebc0b4841d1334c8c10#210db77e4274787028dc3ebc0b4841d1334c8c10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode",
|
"bincode",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
|
@ -2151,7 +2151,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustpython-parser"
|
name = "rustpython-parser"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
source = "git+https://github.com/charliermarsh/RustPython.git?rev=778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f#778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f"
|
source = "git+https://github.com/charliermarsh/RustPython.git?rev=210db77e4274787028dc3ebc0b4841d1334c8c10#210db77e4274787028dc3ebc0b4841d1334c8c10"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
|
|
@ -26,9 +26,9 @@ once_cell = { version = "1.13.1" }
|
||||||
path-absolutize = { version = "3.0.14", features = ["once_cell_cache", "use_unix_paths_on_wasm"] }
|
path-absolutize = { version = "3.0.14", features = ["once_cell_cache", "use_unix_paths_on_wasm"] }
|
||||||
rayon = { version = "1.5.3" }
|
rayon = { version = "1.5.3" }
|
||||||
regex = { version = "1.6.0" }
|
regex = { version = "1.6.0" }
|
||||||
rustpython-ast = { features = ["unparse"], git = "https://github.com/charliermarsh/RustPython.git", rev = "778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f" }
|
rustpython-ast = { features = ["unparse"], git = "https://github.com/charliermarsh/RustPython.git", rev = "210db77e4274787028dc3ebc0b4841d1334c8c10" }
|
||||||
rustpython-common = { git = "https://github.com/charliermarsh/RustPython.git", rev = "778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f" }
|
rustpython-common = { git = "https://github.com/charliermarsh/RustPython.git", rev = "210db77e4274787028dc3ebc0b4841d1334c8c10" }
|
||||||
rustpython-parser = { features = ["lalrpop"], git = "https://github.com/charliermarsh/RustPython.git", rev = "778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f" }
|
rustpython-parser = { features = ["lalrpop"], git = "https://github.com/charliermarsh/RustPython.git", rev = "210db77e4274787028dc3ebc0b4841d1334c8c10" }
|
||||||
serde = { version = "1.0.143", features = ["derive"] }
|
serde = { version = "1.0.143", features = ["derive"] }
|
||||||
serde_json = { version = "1.0.83" }
|
serde_json = { version = "1.0.83" }
|
||||||
strum = { version = "0.24.1", features = ["strum_macros"] }
|
strum = { version = "0.24.1", features = ["strum_macros"] }
|
||||||
|
|
2
resources/test/fixtures/F401_0.py
vendored
2
resources/test/fixtures/F401_0.py
vendored
|
@ -61,7 +61,7 @@ Y = TypeVar("Y", bound="Dict")
|
||||||
Z = TypeVar("Z", "List", "Set")
|
Z = TypeVar("Z", "List", "Set")
|
||||||
|
|
||||||
a = list["Fruit"]
|
a = list["Fruit"]
|
||||||
b = Union["Nut", None]
|
b = Union["""Nut""", None]
|
||||||
c = cast("Vegetable", b)
|
c = cast("Vegetable", b)
|
||||||
|
|
||||||
Field = lambda default=MISSING: field(default=default)
|
Field = lambda default=MISSING: field(default=default)
|
||||||
|
|
|
@ -3,7 +3,6 @@ use std::ops::Deref;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use log::error;
|
use log::error;
|
||||||
use rustpython_ast::Location;
|
|
||||||
use rustpython_parser::ast::{
|
use rustpython_parser::ast::{
|
||||||
Arg, Arguments, Constant, Excepthandler, ExcepthandlerKind, Expr, ExprContext, ExprKind,
|
Arg, Arguments, Constant, Excepthandler, ExcepthandlerKind, Expr, ExprContext, ExprKind,
|
||||||
KeywordData, Operator, Stmt, StmtKind, Suite,
|
KeywordData, Operator, Stmt, StmtKind, Suite,
|
||||||
|
@ -34,7 +33,6 @@ pub const GLOBAL_SCOPE_INDEX: usize = 0;
|
||||||
pub struct Checker<'a> {
|
pub struct Checker<'a> {
|
||||||
// Input data.
|
// Input data.
|
||||||
pub(crate) path: &'a Path,
|
pub(crate) path: &'a Path,
|
||||||
// TODO(charlie): Separate immutable from mutable state. (None of these should ever change.)
|
|
||||||
pub(crate) locator: SourceCodeLocator<'a>,
|
pub(crate) locator: SourceCodeLocator<'a>,
|
||||||
pub(crate) settings: &'a Settings,
|
pub(crate) settings: &'a Settings,
|
||||||
pub(crate) autofix: &'a fixer::Mode,
|
pub(crate) autofix: &'a fixer::Mode,
|
||||||
|
@ -1751,29 +1749,6 @@ impl<'a> Checker<'a> {
|
||||||
'b: 'a,
|
'b: 'a,
|
||||||
{
|
{
|
||||||
while let Some((range, expression)) = self.deferred_string_annotations.pop() {
|
while let Some((range, expression)) = self.deferred_string_annotations.pop() {
|
||||||
// HACK(charlie): We need to modify `range` such that it represents the range of the
|
|
||||||
// expression _within_ the string annotation (as opposed to the range of the string
|
|
||||||
// annotation itself). RustPython seems to return an off-by-one start column for every
|
|
||||||
// string value, so we check for double quotes (which are really triple quotes).
|
|
||||||
let contents = self.locator.slice_source_code_at(&range.location);
|
|
||||||
let range = if contents.starts_with("\"\"") || contents.starts_with("\'\'") {
|
|
||||||
Range {
|
|
||||||
location: Location::new(range.location.row(), range.location.column() + 2),
|
|
||||||
end_location: Location::new(
|
|
||||||
range.end_location.row(),
|
|
||||||
range.end_location.column() - 2,
|
|
||||||
),
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Range {
|
|
||||||
location: Location::new(range.location.row(), range.location.column()),
|
|
||||||
end_location: Location::new(
|
|
||||||
range.end_location.row(),
|
|
||||||
range.end_location.column() - 1,
|
|
||||||
),
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Ok(mut expr) = parser::parse_expression(expression, "<filename>") {
|
if let Ok(mut expr) = parser::parse_expression(expression, "<filename>") {
|
||||||
relocate_expr(&mut expr, range);
|
relocate_expr(&mut expr, range);
|
||||||
allocator.push(expr);
|
allocator.push(expr);
|
||||||
|
@ -2069,10 +2044,8 @@ impl<'a> Checker<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_builtin_shadowing(&mut self, name: &str, location: Range, is_attribute: bool) {
|
fn check_builtin_shadowing(&mut self, name: &str, location: Range, is_attribute: bool) {
|
||||||
let scope = self.current_scope();
|
|
||||||
|
|
||||||
// flake8-builtins
|
// flake8-builtins
|
||||||
if is_attribute && matches!(scope.kind, ScopeKind::Class) {
|
if is_attribute && matches!(self.current_scope().kind, ScopeKind::Class) {
|
||||||
if self.settings.enabled.contains(&CheckCode::A003) {
|
if self.settings.enabled.contains(&CheckCode::A003) {
|
||||||
if let Some(check) = checkers::builtin_shadowing(
|
if let Some(check) = checkers::builtin_shadowing(
|
||||||
name,
|
name,
|
||||||
|
@ -2094,6 +2067,7 @@ impl<'a> Checker<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn check_builtin_arg_shadowing(&mut self, name: &str, location: Range) {
|
fn check_builtin_arg_shadowing(&mut self, name: &str, location: Range) {
|
||||||
|
// flake8-builtins
|
||||||
if self.settings.enabled.contains(&CheckCode::A002) {
|
if self.settings.enabled.contains(&CheckCode::A002) {
|
||||||
if let Some(check) = checkers::builtin_shadowing(
|
if let Some(check) = checkers::builtin_shadowing(
|
||||||
name,
|
name,
|
||||||
|
|
|
@ -8,7 +8,6 @@ use crate::ast::types::Range;
|
||||||
use crate::check_ast::Checker;
|
use crate::check_ast::Checker;
|
||||||
use crate::checks::{Check, CheckCode, CheckKind};
|
use crate::checks::{Check, CheckCode, CheckKind};
|
||||||
use crate::docstrings::google::check_google_section;
|
use crate::docstrings::google::check_google_section;
|
||||||
use crate::docstrings::helpers;
|
|
||||||
use crate::docstrings::helpers::{indentation, leading_space};
|
use crate::docstrings::helpers::{indentation, leading_space};
|
||||||
use crate::docstrings::numpy::check_numpy_section;
|
use crate::docstrings::numpy::check_numpy_section;
|
||||||
use crate::docstrings::sections::section_contexts;
|
use crate::docstrings::sections::section_contexts;
|
||||||
|
@ -138,7 +137,7 @@ pub fn one_liner(checker: &mut Checker, definition: &Definition) {
|
||||||
if non_empty_line_count == 1 && line_count > 1 {
|
if non_empty_line_count == 1 && line_count > 1 {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::FitsOnOneLine,
|
CheckKind::FitsOnOneLine,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,7 +163,7 @@ pub fn blank_before_after_function(checker: &mut Checker, definition: &Definitio
|
||||||
{
|
{
|
||||||
let (before, _, after) = checker.locator.partition_source_code_at(
|
let (before, _, after) = checker.locator.partition_source_code_at(
|
||||||
&Range::from_located(parent),
|
&Range::from_located(parent),
|
||||||
&helpers::range_for(docstring),
|
&Range::from_located(docstring),
|
||||||
);
|
);
|
||||||
|
|
||||||
if checker.settings.enabled.contains(&CheckCode::D201) {
|
if checker.settings.enabled.contains(&CheckCode::D201) {
|
||||||
|
@ -177,7 +176,7 @@ pub fn blank_before_after_function(checker: &mut Checker, definition: &Definitio
|
||||||
if blank_lines_before != 0 {
|
if blank_lines_before != 0 {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NoBlankLineBeforeFunction(blank_lines_before),
|
CheckKind::NoBlankLineBeforeFunction(blank_lines_before),
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +201,7 @@ pub fn blank_before_after_function(checker: &mut Checker, definition: &Definitio
|
||||||
{
|
{
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NoBlankLineAfterFunction(blank_lines_after),
|
CheckKind::NoBlankLineAfterFunction(blank_lines_after),
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +223,7 @@ pub fn blank_before_after_class(checker: &mut Checker, definition: &Definition)
|
||||||
{
|
{
|
||||||
let (before, _, after) = checker.locator.partition_source_code_at(
|
let (before, _, after) = checker.locator.partition_source_code_at(
|
||||||
&Range::from_located(parent),
|
&Range::from_located(parent),
|
||||||
&helpers::range_for(docstring),
|
&Range::from_located(docstring),
|
||||||
);
|
);
|
||||||
|
|
||||||
if checker.settings.enabled.contains(&CheckCode::D203)
|
if checker.settings.enabled.contains(&CheckCode::D203)
|
||||||
|
@ -241,7 +240,7 @@ pub fn blank_before_after_class(checker: &mut Checker, definition: &Definition)
|
||||||
{
|
{
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NoBlankLineBeforeClass(blank_lines_before),
|
CheckKind::NoBlankLineBeforeClass(blank_lines_before),
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if blank_lines_before != 1
|
if blank_lines_before != 1
|
||||||
|
@ -249,7 +248,7 @@ pub fn blank_before_after_class(checker: &mut Checker, definition: &Definition)
|
||||||
{
|
{
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::OneBlankLineBeforeClass(blank_lines_before),
|
CheckKind::OneBlankLineBeforeClass(blank_lines_before),
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -267,7 +266,7 @@ pub fn blank_before_after_class(checker: &mut Checker, definition: &Definition)
|
||||||
if !all_blank_after && blank_lines_after != 1 {
|
if !all_blank_after && blank_lines_after != 1 {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::OneBlankLineAfterClass(blank_lines_after),
|
CheckKind::OneBlankLineAfterClass(blank_lines_after),
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -297,7 +296,7 @@ pub fn blank_after_summary(checker: &mut Checker, definition: &Definition) {
|
||||||
if lines_count > 1 && blanks_count != 1 {
|
if lines_count > 1 && blanks_count != 1 {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NoBlankLineAfterSummary,
|
CheckKind::NoBlankLineAfterSummary,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,7 +326,7 @@ pub fn indent(checker: &mut Checker, definition: &Definition) {
|
||||||
if checker.settings.enabled.contains(&CheckCode::D206) {
|
if checker.settings.enabled.contains(&CheckCode::D206) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::IndentWithSpaces,
|
CheckKind::IndentWithSpaces,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
has_seen_tab = true;
|
has_seen_tab = true;
|
||||||
|
@ -352,7 +351,7 @@ pub fn indent(checker: &mut Checker, definition: &Definition) {
|
||||||
if checker.settings.enabled.contains(&CheckCode::D206) {
|
if checker.settings.enabled.contains(&CheckCode::D206) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::IndentWithSpaces,
|
CheckKind::IndentWithSpaces,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
has_seen_tab = true;
|
has_seen_tab = true;
|
||||||
|
@ -364,7 +363,7 @@ pub fn indent(checker: &mut Checker, definition: &Definition) {
|
||||||
if checker.settings.enabled.contains(&CheckCode::D208) {
|
if checker.settings.enabled.contains(&CheckCode::D208) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NoOverIndentation,
|
CheckKind::NoOverIndentation,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
has_seen_over_indent = true;
|
has_seen_over_indent = true;
|
||||||
|
@ -376,7 +375,7 @@ pub fn indent(checker: &mut Checker, definition: &Definition) {
|
||||||
if checker.settings.enabled.contains(&CheckCode::D207) {
|
if checker.settings.enabled.contains(&CheckCode::D207) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NoUnderIndentation,
|
CheckKind::NoUnderIndentation,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
has_seen_under_indent = true;
|
has_seen_under_indent = true;
|
||||||
|
@ -403,13 +402,13 @@ pub fn newline_after_last_paragraph(checker: &mut Checker, definition: &Definiti
|
||||||
if line_count > 1 {
|
if line_count > 1 {
|
||||||
let content = checker
|
let content = checker
|
||||||
.locator
|
.locator
|
||||||
.slice_source_code_range(&helpers::range_for(docstring));
|
.slice_source_code_range(&Range::from_located(docstring));
|
||||||
if let Some(line) = content.lines().last() {
|
if let Some(line) = content.lines().last() {
|
||||||
let line = line.trim();
|
let line = line.trim();
|
||||||
if line != "\"\"\"" && line != "'''" {
|
if line != "\"\"\"" && line != "'''" {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NewLineAfterLastParagraph,
|
CheckKind::NewLineAfterLastParagraph,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -436,7 +435,7 @@ pub fn no_surrounding_whitespace(checker: &mut Checker, definition: &Definition)
|
||||||
if line.starts_with(' ') || (matches!(lines.next(), None) && line.ends_with(' ')) {
|
if line.starts_with(' ') || (matches!(lines.next(), None) && line.ends_with(' ')) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NoSurroundingWhitespace,
|
CheckKind::NoSurroundingWhitespace,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -455,21 +454,29 @@ pub fn multi_line_summary_start(checker: &mut Checker, definition: &Definition)
|
||||||
if string.lines().nth(1).is_some() {
|
if string.lines().nth(1).is_some() {
|
||||||
let content = checker
|
let content = checker
|
||||||
.locator
|
.locator
|
||||||
.slice_source_code_range(&helpers::range_for(docstring));
|
.slice_source_code_range(&Range::from_located(docstring));
|
||||||
if let Some(first_line) = content.lines().next() {
|
if let Some(first_line) = content.lines().next() {
|
||||||
let first_line = first_line.trim();
|
let first_line = first_line.trim().to_lowercase();
|
||||||
if first_line == "\"\"\"" || first_line == "'''" {
|
let starts_with_triple = first_line == "\"\"\""
|
||||||
|
|| first_line == "'''"
|
||||||
|
|| first_line == "u\"\"\""
|
||||||
|
|| first_line == "u'''"
|
||||||
|
|| first_line == "r\"\"\""
|
||||||
|
|| first_line == "r'''"
|
||||||
|
|| first_line == "ur\"\"\""
|
||||||
|
|| first_line == "ur'''";
|
||||||
|
if starts_with_triple {
|
||||||
if checker.settings.enabled.contains(&CheckCode::D212) {
|
if checker.settings.enabled.contains(&CheckCode::D212) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::MultiLineSummaryFirstLine,
|
CheckKind::MultiLineSummaryFirstLine,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if checker.settings.enabled.contains(&CheckCode::D213) {
|
if checker.settings.enabled.contains(&CheckCode::D213) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::MultiLineSummarySecondLine,
|
CheckKind::MultiLineSummarySecondLine,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -489,19 +496,26 @@ pub fn triple_quotes(checker: &mut Checker, definition: &Definition) {
|
||||||
{
|
{
|
||||||
let content = checker
|
let content = checker
|
||||||
.locator
|
.locator
|
||||||
.slice_source_code_range(&helpers::range_for(docstring));
|
.slice_source_code_range(&Range::from_located(docstring));
|
||||||
if string.contains("\"\"\"") {
|
if let Some(first_line) = content.lines().next() {
|
||||||
if !content.starts_with("'''") {
|
let first_line = first_line.trim().to_lowercase();
|
||||||
|
let starts_with_triple = if string.contains("\"\"\"") {
|
||||||
|
first_line.starts_with("'''")
|
||||||
|
|| first_line.starts_with("u'''")
|
||||||
|
|| first_line.starts_with("r'''")
|
||||||
|
|| first_line.starts_with("ur'''")
|
||||||
|
} else {
|
||||||
|
first_line.starts_with("\"\"\"")
|
||||||
|
|| first_line.starts_with("u\"\"\"")
|
||||||
|
|| first_line.starts_with("r\"\"\"")
|
||||||
|
|| first_line.starts_with("ur\"\"\"")
|
||||||
|
};
|
||||||
|
if !starts_with_triple {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::UsesTripleQuotes,
|
CheckKind::UsesTripleQuotes,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
} else if !content.starts_with("\"\"\"") {
|
|
||||||
checker.add_check(Check::new(
|
|
||||||
CheckKind::UsesTripleQuotes,
|
|
||||||
helpers::range_for(docstring),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -519,7 +533,7 @@ pub fn ends_with_period(checker: &mut Checker, definition: &Definition) {
|
||||||
if !string.ends_with('.') {
|
if !string.ends_with('.') {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::EndsInPeriod,
|
CheckKind::EndsInPeriod,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -544,7 +558,7 @@ pub fn no_signature(checker: &mut Checker, definition: &Definition) {
|
||||||
if first_line.contains(&format!("{name}(")) {
|
if first_line.contains(&format!("{name}(")) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NoSignature,
|
CheckKind::NoSignature,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -579,7 +593,7 @@ pub fn capitalized(checker: &mut Checker, definition: &Definition) {
|
||||||
if !first_char.is_uppercase() {
|
if !first_char.is_uppercase() {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::FirstLineCapitalized,
|
CheckKind::FirstLineCapitalized,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,7 +623,7 @@ pub fn starts_with_this(checker: &mut Checker, definition: &Definition) {
|
||||||
{
|
{
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NoThisPrefix,
|
CheckKind::NoThisPrefix,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -629,7 +643,7 @@ pub fn ends_with_punctuation(checker: &mut Checker, definition: &Definition) {
|
||||||
if !(string.ends_with('.') || string.ends_with('!') || string.ends_with('?')) {
|
if !(string.ends_with('.') || string.ends_with('!') || string.ends_with('?')) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::EndsInPunctuation,
|
CheckKind::EndsInPunctuation,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -666,7 +680,7 @@ pub fn not_empty(checker: &mut Checker, definition: &Definition) -> bool {
|
||||||
if checker.settings.enabled.contains(&CheckCode::D419) {
|
if checker.settings.enabled.contains(&CheckCode::D419) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NonEmpty,
|
CheckKind::NonEmpty,
|
||||||
helpers::range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
|
|
||||||
|
use crate::ast::types::Range;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
use crate::check_ast::Checker;
|
use crate::check_ast::Checker;
|
||||||
use crate::checks::{Check, CheckCode, CheckKind};
|
use crate::checks::{Check, CheckCode, CheckKind};
|
||||||
use crate::docstrings::helpers::range_for;
|
|
||||||
use crate::docstrings::sections;
|
use crate::docstrings::sections;
|
||||||
use crate::docstrings::sections::SectionContext;
|
use crate::docstrings::sections::SectionContext;
|
||||||
use crate::docstrings::styles::SectionStyle;
|
use crate::docstrings::styles::SectionStyle;
|
||||||
|
@ -136,7 +136,7 @@ pub(crate) fn check_google_section(
|
||||||
.expect("Sections are only available for docstrings.");
|
.expect("Sections are only available for docstrings.");
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::SectionNameEndsInColon(context.section_name.to_string()),
|
CheckKind::SectionNameEndsInColon(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,18 +20,9 @@ pub fn leading_space(line: &str) -> String {
|
||||||
|
|
||||||
/// Extract the leading indentation from a docstring.
|
/// Extract the leading indentation from a docstring.
|
||||||
pub fn indentation<'a>(checker: &'a mut Checker, docstring: &Expr) -> &'a str {
|
pub fn indentation<'a>(checker: &'a mut Checker, docstring: &Expr) -> &'a str {
|
||||||
let range = range_for(docstring);
|
let range = Range::from_located(docstring);
|
||||||
checker.locator.slice_source_code_range(&Range {
|
checker.locator.slice_source_code_range(&Range {
|
||||||
location: Location::new(range.location.row(), 1),
|
location: Location::new(range.location.row(), 1),
|
||||||
end_location: Location::new(range.location.row(), range.location.column()),
|
end_location: Location::new(range.location.row(), range.location.column()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extract the source code range for a docstring.
|
|
||||||
pub fn range_for(docstring: &Expr) -> Range {
|
|
||||||
// RustPython currently omits the first quotation mark in a string, so offset the location.
|
|
||||||
Range {
|
|
||||||
location: Location::new(docstring.location.row(), docstring.location.column() - 1),
|
|
||||||
end_location: docstring.end_location,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
|
|
||||||
|
use crate::ast::types::Range;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
use crate::check_ast::Checker;
|
use crate::check_ast::Checker;
|
||||||
use crate::checks::{Check, CheckCode, CheckKind};
|
use crate::checks::{Check, CheckCode, CheckKind};
|
||||||
use crate::docstrings::helpers::range_for;
|
|
||||||
use crate::docstrings::sections::SectionContext;
|
use crate::docstrings::sections::SectionContext;
|
||||||
use crate::docstrings::styles::SectionStyle;
|
use crate::docstrings::styles::SectionStyle;
|
||||||
use crate::docstrings::types::Definition;
|
use crate::docstrings::types::Definition;
|
||||||
|
@ -100,7 +100,7 @@ pub(crate) fn check_numpy_section(
|
||||||
.expect("Sections are only available for docstrings.");
|
.expect("Sections are only available for docstrings.");
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NewLineAfterSectionName(context.section_name.to_string()),
|
CheckKind::NewLineAfterSectionName(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ use crate::ast::types::Range;
|
||||||
use crate::check_ast::Checker;
|
use crate::check_ast::Checker;
|
||||||
use crate::checks::{Check, CheckCode, CheckKind};
|
use crate::checks::{Check, CheckCode, CheckKind};
|
||||||
use crate::docstrings::helpers;
|
use crate::docstrings::helpers;
|
||||||
use crate::docstrings::helpers::range_for;
|
|
||||||
use crate::docstrings::styles::SectionStyle;
|
use crate::docstrings::styles::SectionStyle;
|
||||||
use crate::docstrings::types::{Definition, DefinitionKind};
|
use crate::docstrings::types::{Definition, DefinitionKind};
|
||||||
use crate::visibility::is_static;
|
use crate::visibility::is_static;
|
||||||
|
@ -132,13 +131,13 @@ fn check_blanks_and_section_underline(
|
||||||
if checker.settings.enabled.contains(&CheckCode::D407) {
|
if checker.settings.enabled.contains(&CheckCode::D407) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::DashedUnderlineAfterSection(context.section_name.to_string()),
|
CheckKind::DashedUnderlineAfterSection(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if checker.settings.enabled.contains(&CheckCode::D414) {
|
if checker.settings.enabled.contains(&CheckCode::D414) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NonEmptySection(context.section_name.to_string()),
|
CheckKind::NonEmptySection(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -153,7 +152,7 @@ fn check_blanks_and_section_underline(
|
||||||
if checker.settings.enabled.contains(&CheckCode::D407) {
|
if checker.settings.enabled.contains(&CheckCode::D407) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::DashedUnderlineAfterSection(context.section_name.to_string()),
|
CheckKind::DashedUnderlineAfterSection(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if blank_lines_after_header > 0 {
|
if blank_lines_after_header > 0 {
|
||||||
|
@ -162,7 +161,7 @@ fn check_blanks_and_section_underline(
|
||||||
CheckKind::NoBlankLinesBetweenHeaderAndContent(
|
CheckKind::NoBlankLinesBetweenHeaderAndContent(
|
||||||
context.section_name.to_string(),
|
context.section_name.to_string(),
|
||||||
),
|
),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,7 +170,7 @@ fn check_blanks_and_section_underline(
|
||||||
if checker.settings.enabled.contains(&CheckCode::D408) {
|
if checker.settings.enabled.contains(&CheckCode::D408) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::SectionUnderlineAfterName(context.section_name.to_string()),
|
CheckKind::SectionUnderlineAfterName(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,7 +187,7 @@ fn check_blanks_and_section_underline(
|
||||||
CheckKind::SectionUnderlineMatchesSectionLength(
|
CheckKind::SectionUnderlineMatchesSectionLength(
|
||||||
context.section_name.to_string(),
|
context.section_name.to_string(),
|
||||||
),
|
),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -199,7 +198,7 @@ fn check_blanks_and_section_underline(
|
||||||
{
|
{
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::SectionUnderlineNotOverIndented(context.section_name.to_string()),
|
CheckKind::SectionUnderlineNotOverIndented(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +213,7 @@ fn check_blanks_and_section_underline(
|
||||||
if checker.settings.enabled.contains(&CheckCode::D414) {
|
if checker.settings.enabled.contains(&CheckCode::D414) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NonEmptySection(context.section_name.to_string()),
|
CheckKind::NonEmptySection(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -223,7 +222,7 @@ fn check_blanks_and_section_underline(
|
||||||
CheckKind::NoBlankLinesBetweenHeaderAndContent(
|
CheckKind::NoBlankLinesBetweenHeaderAndContent(
|
||||||
context.section_name.to_string(),
|
context.section_name.to_string(),
|
||||||
),
|
),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -232,7 +231,7 @@ fn check_blanks_and_section_underline(
|
||||||
if checker.settings.enabled.contains(&CheckCode::D414) {
|
if checker.settings.enabled.contains(&CheckCode::D414) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::NonEmptySection(context.section_name.to_string()),
|
CheckKind::NonEmptySection(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,7 +258,7 @@ pub(crate) fn check_common_section(
|
||||||
{
|
{
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::CapitalizeSectionName(context.section_name.to_string()),
|
CheckKind::CapitalizeSectionName(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -270,7 +269,7 @@ pub(crate) fn check_common_section(
|
||||||
{
|
{
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::SectionNotOverIndented(context.section_name.to_string()),
|
CheckKind::SectionNotOverIndented(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,14 +284,14 @@ pub(crate) fn check_common_section(
|
||||||
if checker.settings.enabled.contains(&CheckCode::D413) {
|
if checker.settings.enabled.contains(&CheckCode::D413) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::BlankLineAfterLastSection(context.section_name.to_string()),
|
CheckKind::BlankLineAfterLastSection(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if checker.settings.enabled.contains(&CheckCode::D410) {
|
if checker.settings.enabled.contains(&CheckCode::D410) {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::BlankLineAfterSection(context.section_name.to_string()),
|
CheckKind::BlankLineAfterSection(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -302,7 +301,7 @@ pub(crate) fn check_common_section(
|
||||||
if !context.previous_line.is_empty() {
|
if !context.previous_line.is_empty() {
|
||||||
checker.add_check(Check::new(
|
checker.add_check(Check::new(
|
||||||
CheckKind::BlankLineBeforeSection(context.section_name.to_string()),
|
CheckKind::BlankLineBeforeSection(context.section_name.to_string()),
|
||||||
range_for(docstring),
|
Range::from_located(docstring),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ expression: checks
|
||||||
- kind: UsesTripleQuotes
|
- kind: UsesTripleQuotes
|
||||||
location:
|
location:
|
||||||
row: 302
|
row: 302
|
||||||
column: 6
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 302
|
row: 302
|
||||||
column: 20
|
column: 20
|
||||||
|
@ -13,7 +13,7 @@ expression: checks
|
||||||
- kind: UsesTripleQuotes
|
- kind: UsesTripleQuotes
|
||||||
location:
|
location:
|
||||||
row: 307
|
row: 307
|
||||||
column: 6
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 307
|
row: 307
|
||||||
column: 20
|
column: 20
|
||||||
|
@ -21,7 +21,7 @@ expression: checks
|
||||||
- kind: UsesTripleQuotes
|
- kind: UsesTripleQuotes
|
||||||
location:
|
location:
|
||||||
row: 312
|
row: 312
|
||||||
column: 6
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 312
|
row: 312
|
||||||
column: 16
|
column: 16
|
||||||
|
@ -29,7 +29,7 @@ expression: checks
|
||||||
- kind: UsesTripleQuotes
|
- kind: UsesTripleQuotes
|
||||||
location:
|
location:
|
||||||
row: 317
|
row: 317
|
||||||
column: 6
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 317
|
row: 317
|
||||||
column: 16
|
column: 16
|
||||||
|
@ -37,7 +37,7 @@ expression: checks
|
||||||
- kind: UsesTripleQuotes
|
- kind: UsesTripleQuotes
|
||||||
location:
|
location:
|
||||||
row: 323
|
row: 323
|
||||||
column: 6
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 323
|
row: 323
|
||||||
column: 17
|
column: 17
|
||||||
|
|
|
@ -5,7 +5,7 @@ expression: checks
|
||||||
- kind: FStringMissingPlaceholders
|
- kind: FStringMissingPlaceholders
|
||||||
location:
|
location:
|
||||||
row: 4
|
row: 4
|
||||||
column: 7
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 4
|
row: 4
|
||||||
column: 11
|
column: 11
|
||||||
|
@ -13,7 +13,7 @@ expression: checks
|
||||||
- kind: FStringMissingPlaceholders
|
- kind: FStringMissingPlaceholders
|
||||||
location:
|
location:
|
||||||
row: 5
|
row: 5
|
||||||
column: 7
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 5
|
row: 5
|
||||||
column: 11
|
column: 11
|
||||||
|
@ -21,7 +21,7 @@ expression: checks
|
||||||
- kind: FStringMissingPlaceholders
|
- kind: FStringMissingPlaceholders
|
||||||
location:
|
location:
|
||||||
row: 7
|
row: 7
|
||||||
column: 7
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 7
|
row: 7
|
||||||
column: 11
|
column: 11
|
||||||
|
|
|
@ -5,7 +5,7 @@ expression: checks
|
||||||
- kind: MultiValueRepeatedKeyLiteral
|
- kind: MultiValueRepeatedKeyLiteral
|
||||||
location:
|
location:
|
||||||
row: 3
|
row: 3
|
||||||
column: 6
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 3
|
row: 3
|
||||||
column: 8
|
column: 8
|
||||||
|
@ -21,7 +21,7 @@ expression: checks
|
||||||
- kind: MultiValueRepeatedKeyLiteral
|
- kind: MultiValueRepeatedKeyLiteral
|
||||||
location:
|
location:
|
||||||
row: 11
|
row: 11
|
||||||
column: 7
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 11
|
row: 11
|
||||||
column: 11
|
column: 11
|
||||||
|
|
|
@ -6,9 +6,9 @@ expression: checks
|
||||||
ForwardAnnotationSyntaxError: ///
|
ForwardAnnotationSyntaxError: ///
|
||||||
location:
|
location:
|
||||||
row: 9
|
row: 9
|
||||||
column: 13
|
column: 12
|
||||||
end_location:
|
end_location:
|
||||||
row: 9
|
row: 9
|
||||||
column: 16
|
column: 17
|
||||||
fix: ~
|
fix: ~
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,10 @@ expression: checks
|
||||||
UndefinedName: Bar
|
UndefinedName: Bar
|
||||||
location:
|
location:
|
||||||
row: 58
|
row: 58
|
||||||
column: 5
|
column: 4
|
||||||
end_location:
|
end_location:
|
||||||
row: 58
|
row: 58
|
||||||
column: 8
|
column: 9
|
||||||
fix: ~
|
fix: ~
|
||||||
- kind:
|
- kind:
|
||||||
UndefinedName: TOMATO
|
UndefinedName: TOMATO
|
||||||
|
@ -60,7 +60,7 @@ expression: checks
|
||||||
UndefinedName: B
|
UndefinedName: B
|
||||||
location:
|
location:
|
||||||
row: 87
|
row: 87
|
||||||
column: 7
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 87
|
row: 87
|
||||||
column: 11
|
column: 11
|
||||||
|
@ -69,7 +69,7 @@ expression: checks
|
||||||
UndefinedName: B
|
UndefinedName: B
|
||||||
location:
|
location:
|
||||||
row: 89
|
row: 89
|
||||||
column: 7
|
column: 5
|
||||||
end_location:
|
end_location:
|
||||||
row: 89
|
row: 89
|
||||||
column: 9
|
column: 9
|
||||||
|
@ -78,27 +78,27 @@ expression: checks
|
||||||
UndefinedName: PEP593Test123
|
UndefinedName: PEP593Test123
|
||||||
location:
|
location:
|
||||||
row: 114
|
row: 114
|
||||||
column: 10
|
column: 9
|
||||||
end_location:
|
end_location:
|
||||||
row: 114
|
row: 114
|
||||||
column: 23
|
column: 24
|
||||||
fix: ~
|
fix: ~
|
||||||
- kind:
|
- kind:
|
||||||
UndefinedName: foo
|
UndefinedName: foo
|
||||||
location:
|
location:
|
||||||
row: 122
|
row: 122
|
||||||
column: 15
|
column: 14
|
||||||
end_location:
|
end_location:
|
||||||
row: 122
|
row: 122
|
||||||
column: 18
|
column: 19
|
||||||
fix: ~
|
fix: ~
|
||||||
- kind:
|
- kind:
|
||||||
UndefinedName: bar
|
UndefinedName: bar
|
||||||
location:
|
location:
|
||||||
row: 122
|
row: 122
|
||||||
column: 22
|
column: 21
|
||||||
end_location:
|
end_location:
|
||||||
row: 122
|
row: 122
|
||||||
column: 25
|
column: 26
|
||||||
fix: ~
|
fix: ~
|
||||||
|
|
||||||
|
|
|
@ -85,49 +85,49 @@ expression: checks
|
||||||
- kind: UsePEP604Annotation
|
- kind: UsePEP604Annotation
|
||||||
location:
|
location:
|
||||||
row: 32
|
row: 32
|
||||||
column: 11
|
column: 10
|
||||||
end_location:
|
end_location:
|
||||||
row: 32
|
row: 32
|
||||||
column: 47
|
column: 48
|
||||||
fix:
|
fix:
|
||||||
content: "str | int | Union[float, bytes]"
|
content: "str | int | Union[float, bytes]"
|
||||||
location:
|
location:
|
||||||
row: 32
|
row: 32
|
||||||
column: 11
|
column: 10
|
||||||
end_location:
|
end_location:
|
||||||
row: 32
|
row: 32
|
||||||
column: 47
|
column: 48
|
||||||
applied: false
|
applied: false
|
||||||
- kind: UsePEP604Annotation
|
- kind: UsePEP604Annotation
|
||||||
location:
|
location:
|
||||||
row: 32
|
row: 32
|
||||||
column: 11
|
column: 10
|
||||||
end_location:
|
end_location:
|
||||||
row: 32
|
row: 32
|
||||||
column: 47
|
column: 48
|
||||||
fix:
|
fix:
|
||||||
content: float | bytes
|
content: float | bytes
|
||||||
location:
|
location:
|
||||||
row: 32
|
row: 32
|
||||||
column: 11
|
column: 10
|
||||||
end_location:
|
end_location:
|
||||||
row: 32
|
row: 32
|
||||||
column: 47
|
column: 48
|
||||||
applied: false
|
applied: false
|
||||||
- kind: UsePEP604Annotation
|
- kind: UsePEP604Annotation
|
||||||
location:
|
location:
|
||||||
row: 39
|
row: 39
|
||||||
column: 11
|
column: 10
|
||||||
end_location:
|
end_location:
|
||||||
row: 39
|
row: 39
|
||||||
column: 33
|
column: 34
|
||||||
fix:
|
fix:
|
||||||
content: str | int
|
content: str | int
|
||||||
location:
|
location:
|
||||||
row: 39
|
row: 39
|
||||||
column: 11
|
column: 10
|
||||||
end_location:
|
end_location:
|
||||||
row: 39
|
row: 39
|
||||||
column: 33
|
column: 34
|
||||||
applied: false
|
applied: false
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue