Use backticks for code in red-knot messages (#13599)

## Summary

...and remove periods from messages that don't span more than a single
sentence.

This is more consistent with how we present user-facing messages in uv
(which has a defined style guide).
This commit is contained in:
Charlie Marsh 2024-10-01 23:14:28 -04:00 committed by GitHub
parent ef45185dbc
commit c3b40da0d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 156 additions and 156 deletions

View file

@ -226,8 +226,8 @@ print("hello world")
assert_eq!(
source_map.markers(),
&[
SourceMarker::new(10.into(), 10.into(),),
SourceMarker::new(10.into(), 21.into(),),
SourceMarker::new(10.into(), 10.into()),
SourceMarker::new(10.into(), 21.into()),
]
);
}
@ -263,8 +263,8 @@ class A(Bar):
assert_eq!(
source_map.markers(),
&[
SourceMarker::new(8.into(), 8.into(),),
SourceMarker::new(14.into(), 11.into(),),
SourceMarker::new(8.into(), 8.into()),
SourceMarker::new(14.into(), 11.into()),
]
);
}
@ -335,8 +335,8 @@ class A(object):
&[
SourceMarker::new(8.into(), 8.into()),
SourceMarker::new(16.into(), 8.into()),
SourceMarker::new(22.into(), 14.into(),),
SourceMarker::new(30.into(), 14.into(),),
SourceMarker::new(22.into(), 14.into()),
SourceMarker::new(30.into(), 14.into()),
]
);
}
@ -371,8 +371,8 @@ class A:
assert_eq!(
source_map.markers(),
&[
SourceMarker::new(7.into(), 7.into(),),
SourceMarker::new(15.into(), 7.into(),),
SourceMarker::new(7.into(), 7.into()),
SourceMarker::new(15.into(), 7.into()),
]
);
}

View file

@ -116,7 +116,7 @@ mod tests {
assert!(!comment_contains_code(
"# pylint: disable=redefined-outer-name",
&[]
),);
));
assert!(!comment_contains_code(
"# Issue #999: This is not code",
&[]
@ -190,11 +190,11 @@ mod tests {
assert!(comment_contains_code(
"# user_content_type, _ = TimelineEvent.objects.using(db_alias).get_or_create(",
&[]
),);
));
assert!(comment_contains_code(
"# (user_content_type, _) = TimelineEvent.objects.using(db_alias).get_or_create(",
&[]
),);
));
assert!(comment_contains_code(
"# ( user_content_type , _ )= TimelineEvent.objects.using(db_alias).get_or_create(",
&[]

View file

@ -181,7 +181,7 @@ impl AlwaysFixableViolation for MissingTrailingComma {
/// import json
///
///
/// foo = (json.dumps({"bar": 1}),)
/// foo = (json.dumps({"bar": 1}))
/// ```
#[violation]
pub struct TrailingCommaOnBareTuple;