Remove offsets hacks for docstring parsing logic (#440)

This commit is contained in:
Charlie Marsh 2022-10-16 13:43:30 -04:00 committed by GitHub
parent d9e659d817
commit 248a6cd50b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 115 additions and 137 deletions

8
Cargo.lock generated
View file

@ -2101,7 +2101,7 @@ dependencies = [
[[package]]
name = "rustpython-ast"
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 = [
"num-bigint",
"rustpython-common",
@ -2111,7 +2111,7 @@ dependencies = [
[[package]]
name = "rustpython-common"
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 = [
"ascii",
"cfg-if 1.0.0",
@ -2134,7 +2134,7 @@ dependencies = [
[[package]]
name = "rustpython-compiler-core"
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 = [
"bincode",
"bitflags",
@ -2151,7 +2151,7 @@ dependencies = [
[[package]]
name = "rustpython-parser"
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 = [
"ahash",
"anyhow",

View file

@ -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"] }
rayon = { version = "1.5.3" }
regex = { version = "1.6.0" }
rustpython-ast = { features = ["unparse"], git = "https://github.com/charliermarsh/RustPython.git", rev = "778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f" }
rustpython-common = { git = "https://github.com/charliermarsh/RustPython.git", rev = "778ae2aeb521d0438d2a91bd11238bb5c2bf9d4f" }
rustpython-parser = { features = ["lalrpop"], 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 = "210db77e4274787028dc3ebc0b4841d1334c8c10" }
rustpython-parser = { features = ["lalrpop"], git = "https://github.com/charliermarsh/RustPython.git", rev = "210db77e4274787028dc3ebc0b4841d1334c8c10" }
serde = { version = "1.0.143", features = ["derive"] }
serde_json = { version = "1.0.83" }
strum = { version = "0.24.1", features = ["strum_macros"] }

View file

@ -61,7 +61,7 @@ Y = TypeVar("Y", bound="Dict")
Z = TypeVar("Z", "List", "Set")
a = list["Fruit"]
b = Union["Nut", None]
b = Union["""Nut""", None]
c = cast("Vegetable", b)
Field = lambda default=MISSING: field(default=default)

View file

@ -3,7 +3,6 @@ use std::ops::Deref;
use std::path::Path;
use log::error;
use rustpython_ast::Location;
use rustpython_parser::ast::{
Arg, Arguments, Constant, Excepthandler, ExcepthandlerKind, Expr, ExprContext, ExprKind,
KeywordData, Operator, Stmt, StmtKind, Suite,
@ -34,7 +33,6 @@ pub const GLOBAL_SCOPE_INDEX: usize = 0;
pub struct Checker<'a> {
// Input data.
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) settings: &'a Settings,
pub(crate) autofix: &'a fixer::Mode,
@ -1751,29 +1749,6 @@ impl<'a> Checker<'a> {
'b: 'a,
{
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>") {
relocate_expr(&mut expr, range);
allocator.push(expr);
@ -2069,10 +2044,8 @@ impl<'a> Checker<'a> {
}
fn check_builtin_shadowing(&mut self, name: &str, location: Range, is_attribute: bool) {
let scope = self.current_scope();
// 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 let Some(check) = checkers::builtin_shadowing(
name,
@ -2094,6 +2067,7 @@ impl<'a> Checker<'a> {
}
fn check_builtin_arg_shadowing(&mut self, name: &str, location: Range) {
// flake8-builtins
if self.settings.enabled.contains(&CheckCode::A002) {
if let Some(check) = checkers::builtin_shadowing(
name,

View file

@ -8,7 +8,6 @@ use crate::ast::types::Range;
use crate::check_ast::Checker;
use crate::checks::{Check, CheckCode, CheckKind};
use crate::docstrings::google::check_google_section;
use crate::docstrings::helpers;
use crate::docstrings::helpers::{indentation, leading_space};
use crate::docstrings::numpy::check_numpy_section;
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 {
checker.add_check(Check::new(
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(
&Range::from_located(parent),
&helpers::range_for(docstring),
&Range::from_located(docstring),
);
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 {
checker.add_check(Check::new(
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(
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(
&Range::from_located(parent),
&helpers::range_for(docstring),
&Range::from_located(docstring),
);
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(
CheckKind::NoBlankLineBeforeClass(blank_lines_before),
helpers::range_for(docstring),
Range::from_located(docstring),
));
}
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(
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 {
checker.add_check(Check::new(
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 {
checker.add_check(Check::new(
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) {
checker.add_check(Check::new(
CheckKind::IndentWithSpaces,
helpers::range_for(docstring),
Range::from_located(docstring),
));
}
has_seen_tab = true;
@ -352,7 +351,7 @@ pub fn indent(checker: &mut Checker, definition: &Definition) {
if checker.settings.enabled.contains(&CheckCode::D206) {
checker.add_check(Check::new(
CheckKind::IndentWithSpaces,
helpers::range_for(docstring),
Range::from_located(docstring),
));
}
has_seen_tab = true;
@ -364,7 +363,7 @@ pub fn indent(checker: &mut Checker, definition: &Definition) {
if checker.settings.enabled.contains(&CheckCode::D208) {
checker.add_check(Check::new(
CheckKind::NoOverIndentation,
helpers::range_for(docstring),
Range::from_located(docstring),
));
}
has_seen_over_indent = true;
@ -376,7 +375,7 @@ pub fn indent(checker: &mut Checker, definition: &Definition) {
if checker.settings.enabled.contains(&CheckCode::D207) {
checker.add_check(Check::new(
CheckKind::NoUnderIndentation,
helpers::range_for(docstring),
Range::from_located(docstring),
));
}
has_seen_under_indent = true;
@ -403,13 +402,13 @@ pub fn newline_after_last_paragraph(checker: &mut Checker, definition: &Definiti
if line_count > 1 {
let content = checker
.locator
.slice_source_code_range(&helpers::range_for(docstring));
.slice_source_code_range(&Range::from_located(docstring));
if let Some(line) = content.lines().last() {
let line = line.trim();
if line != "\"\"\"" && line != "'''" {
checker.add_check(Check::new(
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(' ')) {
checker.add_check(Check::new(
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() {
let content = checker
.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() {
let first_line = first_line.trim();
if first_line == "\"\"\"" || first_line == "'''" {
let first_line = first_line.trim().to_lowercase();
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) {
checker.add_check(Check::new(
CheckKind::MultiLineSummaryFirstLine,
helpers::range_for(docstring),
Range::from_located(docstring),
));
}
} else {
if checker.settings.enabled.contains(&CheckCode::D213) {
checker.add_check(Check::new(
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
.locator
.slice_source_code_range(&helpers::range_for(docstring));
if string.contains("\"\"\"") {
if !content.starts_with("'''") {
.slice_source_code_range(&Range::from_located(docstring));
if let Some(first_line) = content.lines().next() {
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(
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('.') {
checker.add_check(Check::new(
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}(")) {
checker.add_check(Check::new(
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() {
checker.add_check(Check::new(
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(
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('?')) {
checker.add_check(Check::new(
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) {
checker.add_check(Check::new(
CheckKind::NonEmpty,
helpers::range_for(docstring),
Range::from_located(docstring),
));
}
return false;

View file

@ -2,12 +2,12 @@
use std::collections::BTreeSet;
use crate::ast::types::Range;
use once_cell::sync::Lazy;
use regex::Regex;
use crate::check_ast::Checker;
use crate::checks::{Check, CheckCode, CheckKind};
use crate::docstrings::helpers::range_for;
use crate::docstrings::sections;
use crate::docstrings::sections::SectionContext;
use crate::docstrings::styles::SectionStyle;
@ -136,7 +136,7 @@ pub(crate) fn check_google_section(
.expect("Sections are only available for docstrings.");
checker.add_check(Check::new(
CheckKind::SectionNameEndsInColon(context.section_name.to_string()),
range_for(docstring),
Range::from_located(docstring),
))
}
}

View file

@ -20,18 +20,9 @@ pub fn leading_space(line: &str) -> String {
/// Extract the leading indentation from a docstring.
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 {
location: Location::new(range.location.row(), 1),
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,
}
}

View file

@ -2,11 +2,11 @@
use std::collections::BTreeSet;
use crate::ast::types::Range;
use once_cell::sync::Lazy;
use crate::check_ast::Checker;
use crate::checks::{Check, CheckCode, CheckKind};
use crate::docstrings::helpers::range_for;
use crate::docstrings::sections::SectionContext;
use crate::docstrings::styles::SectionStyle;
use crate::docstrings::types::Definition;
@ -100,7 +100,7 @@ pub(crate) fn check_numpy_section(
.expect("Sections are only available for docstrings.");
checker.add_check(Check::new(
CheckKind::NewLineAfterSectionName(context.section_name.to_string()),
range_for(docstring),
Range::from_located(docstring),
))
}
}

View file

@ -8,7 +8,6 @@ use crate::ast::types::Range;
use crate::check_ast::Checker;
use crate::checks::{Check, CheckCode, CheckKind};
use crate::docstrings::helpers;
use crate::docstrings::helpers::range_for;
use crate::docstrings::styles::SectionStyle;
use crate::docstrings::types::{Definition, DefinitionKind};
use crate::visibility::is_static;
@ -132,13 +131,13 @@ fn check_blanks_and_section_underline(
if checker.settings.enabled.contains(&CheckCode::D407) {
checker.add_check(Check::new(
CheckKind::DashedUnderlineAfterSection(context.section_name.to_string()),
range_for(docstring),
Range::from_located(docstring),
));
}
if checker.settings.enabled.contains(&CheckCode::D414) {
checker.add_check(Check::new(
CheckKind::NonEmptySection(context.section_name.to_string()),
range_for(docstring),
Range::from_located(docstring),
));
}
return;
@ -153,7 +152,7 @@ fn check_blanks_and_section_underline(
if checker.settings.enabled.contains(&CheckCode::D407) {
checker.add_check(Check::new(
CheckKind::DashedUnderlineAfterSection(context.section_name.to_string()),
range_for(docstring),
Range::from_located(docstring),
));
}
if blank_lines_after_header > 0 {
@ -162,7 +161,7 @@ fn check_blanks_and_section_underline(
CheckKind::NoBlankLinesBetweenHeaderAndContent(
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) {
checker.add_check(Check::new(
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(
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(
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) {
checker.add_check(Check::new(
CheckKind::NonEmptySection(context.section_name.to_string()),
range_for(docstring),
Range::from_located(docstring),
));
}
} else {
@ -223,7 +222,7 @@ fn check_blanks_and_section_underline(
CheckKind::NoBlankLinesBetweenHeaderAndContent(
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) {
checker.add_check(Check::new(
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(
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(
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) {
checker.add_check(Check::new(
CheckKind::BlankLineAfterLastSection(context.section_name.to_string()),
range_for(docstring),
Range::from_located(docstring),
))
}
} else {
if checker.settings.enabled.contains(&CheckCode::D410) {
checker.add_check(Check::new(
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() {
checker.add_check(Check::new(
CheckKind::BlankLineBeforeSection(context.section_name.to_string()),
range_for(docstring),
Range::from_located(docstring),
))
}
}

View file

@ -5,7 +5,7 @@ expression: checks
- kind: UsesTripleQuotes
location:
row: 302
column: 6
column: 5
end_location:
row: 302
column: 20
@ -13,7 +13,7 @@ expression: checks
- kind: UsesTripleQuotes
location:
row: 307
column: 6
column: 5
end_location:
row: 307
column: 20
@ -21,7 +21,7 @@ expression: checks
- kind: UsesTripleQuotes
location:
row: 312
column: 6
column: 5
end_location:
row: 312
column: 16
@ -29,7 +29,7 @@ expression: checks
- kind: UsesTripleQuotes
location:
row: 317
column: 6
column: 5
end_location:
row: 317
column: 16
@ -37,7 +37,7 @@ expression: checks
- kind: UsesTripleQuotes
location:
row: 323
column: 6
column: 5
end_location:
row: 323
column: 17

View file

@ -5,7 +5,7 @@ expression: checks
- kind: FStringMissingPlaceholders
location:
row: 4
column: 7
column: 5
end_location:
row: 4
column: 11
@ -13,7 +13,7 @@ expression: checks
- kind: FStringMissingPlaceholders
location:
row: 5
column: 7
column: 5
end_location:
row: 5
column: 11
@ -21,7 +21,7 @@ expression: checks
- kind: FStringMissingPlaceholders
location:
row: 7
column: 7
column: 5
end_location:
row: 7
column: 11

View file

@ -5,7 +5,7 @@ expression: checks
- kind: MultiValueRepeatedKeyLiteral
location:
row: 3
column: 6
column: 5
end_location:
row: 3
column: 8
@ -21,7 +21,7 @@ expression: checks
- kind: MultiValueRepeatedKeyLiteral
location:
row: 11
column: 7
column: 5
end_location:
row: 11
column: 11

View file

@ -6,9 +6,9 @@ expression: checks
ForwardAnnotationSyntaxError: ///
location:
row: 9
column: 13
column: 12
end_location:
row: 9
column: 16
column: 17
fix: ~

View file

@ -42,10 +42,10 @@ expression: checks
UndefinedName: Bar
location:
row: 58
column: 5
column: 4
end_location:
row: 58
column: 8
column: 9
fix: ~
- kind:
UndefinedName: TOMATO
@ -60,7 +60,7 @@ expression: checks
UndefinedName: B
location:
row: 87
column: 7
column: 5
end_location:
row: 87
column: 11
@ -69,7 +69,7 @@ expression: checks
UndefinedName: B
location:
row: 89
column: 7
column: 5
end_location:
row: 89
column: 9
@ -78,27 +78,27 @@ expression: checks
UndefinedName: PEP593Test123
location:
row: 114
column: 10
column: 9
end_location:
row: 114
column: 23
column: 24
fix: ~
- kind:
UndefinedName: foo
location:
row: 122
column: 15
column: 14
end_location:
row: 122
column: 18
column: 19
fix: ~
- kind:
UndefinedName: bar
location:
row: 122
column: 22
column: 21
end_location:
row: 122
column: 25
column: 26
fix: ~

View file

@ -85,49 +85,49 @@ expression: checks
- kind: UsePEP604Annotation
location:
row: 32
column: 11
column: 10
end_location:
row: 32
column: 47
column: 48
fix:
content: "str | int | Union[float, bytes]"
location:
row: 32
column: 11
column: 10
end_location:
row: 32
column: 47
column: 48
applied: false
- kind: UsePEP604Annotation
location:
row: 32
column: 11
column: 10
end_location:
row: 32
column: 47
column: 48
fix:
content: float | bytes
location:
row: 32
column: 11
column: 10
end_location:
row: 32
column: 47
column: 48
applied: false
- kind: UsePEP604Annotation
location:
row: 39
column: 11
column: 10
end_location:
row: 39
column: 33
column: 34
fix:
content: str | int
location:
row: 39
column: 11
column: 10
end_location:
row: 39
column: 33
column: 34
applied: false