Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ repos:
- black==25.1.0

- repo: https://github.com/crate-ci/typos
rev: v1.29.7
rev: v1.30.0
hooks:
- id: typos

Expand All @@ -74,7 +74,7 @@ repos:
pass_filenames: false # This makes it a lot faster

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.6
rev: v0.9.9
hooks:
- id: ruff-format
- id: ruff
Expand All @@ -84,20 +84,20 @@ repos:

# Prettier
- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.5.1
rev: v3.5.2
hooks:
- id: prettier
types: [yaml]

# zizmor detects security vulnerabilities in GitHub Actions workflows.
# Additional configuration for the tool is found in `.github/zizmor.yml`
- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.3.1
rev: v1.4.1
hooks:
- id: zizmor

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.31.1
rev: 0.31.2
hooks:
- id: check-github-workflows

Expand Down
4 changes: 4 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ extend-ignore-re = [
# Line ignore with trailing "spellchecker:disable-line"
"(?Rm)^.*#\\s*spellchecker:disable-line$",
"LICENSEs",
# Various third party dependencies uses `typ` as struct field names (e.g., lsp_types::LogMessageParams)
"typ",
# TODO: Remove this once the `TYP` redirects are removed from `rule_redirects.rs`
"TYP",
Comment on lines +26 to +29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could change CFormatErrorType to use CFormatErrorKind and use kind field instead but I've avoided that for now as typ still needs to be ignored because it's used in third-party dependencies. TYP should be removed once the redirect is removed.

]

[default.extend-identifiers]
Expand Down
22 changes: 11 additions & 11 deletions crates/ruff_annotate_snippets/src/renderer/display_list.rs
Copy link
Member

@dhruvmanila dhruvmanila Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm going to wait before merging this PR as this is an upstream crate and I'm not sure what's the process of updating it is. I could upstream this change (rust-lang/annotate-snippets-rs#182). cc @BurntSushi

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'm going to merge this, I've opened a PR to update this upstream as well. Happy to make any changes in a follow-up as needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change is fine, but in general the idea is to minimize the diff between our code and upstream as much as possible. That way, if we want to bring in patches from upstream, it's less of a hassle.

I don't know how long this will last or if it's a viable long term strategy, but it's what has been guiding my changes to our vendored copy so far. e.g., There's a lot of other stuff I would want to change too and general code clean-up and what not, but specifically decided against it to keep the diff minimal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that makes sense, I'll keep that in mind. The upstream PR is merged, so this shouldn't result in any diff.

Original file line number Diff line number Diff line change
Expand Up @@ -1251,25 +1251,25 @@ fn fold_body(body: Vec<DisplayLine<'_>>) -> Vec<DisplayLine<'_>> {
const INNER_UNFOLD_SIZE: usize = INNER_CONTEXT * 2 + 1;

let mut lines = vec![];
let mut unhighlighed_lines = vec![];
let mut unhighlighted_lines = vec![];
for line in body {
match &line {
DisplayLine::Source { annotations, .. } => {
if annotations.is_empty() {
unhighlighed_lines.push(line);
unhighlighted_lines.push(line);
} else {
if lines.is_empty() {
// Ignore leading unhighlighed lines
unhighlighed_lines.clear();
// Ignore leading unhighlighted lines
unhighlighted_lines.clear();
}
match unhighlighed_lines.len() {
match unhighlighted_lines.len() {
0 => {}
n if n <= INNER_UNFOLD_SIZE => {
// Rather than render our cut indicator, don't fold
lines.append(&mut unhighlighed_lines);
lines.append(&mut unhighlighted_lines);
}
_ => {
lines.extend(unhighlighed_lines.drain(..INNER_CONTEXT));
lines.extend(unhighlighted_lines.drain(..INNER_CONTEXT));
let inline_marks = lines
.last()
.and_then(|line| {
Expand All @@ -1287,16 +1287,16 @@ fn fold_body(body: Vec<DisplayLine<'_>>) -> Vec<DisplayLine<'_>> {
lines.push(DisplayLine::Fold {
inline_marks: inline_marks.clone(),
});
unhighlighed_lines
.drain(..unhighlighed_lines.len().saturating_sub(INNER_CONTEXT));
lines.append(&mut unhighlighed_lines);
unhighlighted_lines
.drain(..unhighlighted_lines.len().saturating_sub(INNER_CONTEXT));
lines.append(&mut unhighlighted_lines);
}
}
lines.push(line);
}
}
_ => {
unhighlighed_lines.push(line);
unhighlighted_lines.push(line);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ pub(crate) fn jinja2_autoescape_false(checker: &Checker, call: &ast::ExprCall) {
if checker
.semantic()
.resolve_qualified_name(&call.func)
.is_some_and(|qualifieed_name| {
matches!(qualifieed_name.segments(), ["jinja2", "Environment"])
.is_some_and(|qualified_name| {
matches!(qualified_name.segments(), ["jinja2", "Environment"])
})
{
if let Some(keyword) = call.arguments.find_keyword("autoescape") {
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_linter/src/rules/flake8_todos/rules/todos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ pub(crate) fn todos(
has_issue_link = true;
}

// If the next_comment isn't a tag or an issue, it's worthles in the context of this
// If the next_comment isn't a tag or an issue, it's worthless in the context of this
// linter. We can increment here instead of waiting for the next iteration of the outer
// loop.
curr_range = next_range;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ fn strip_z_date(call: &ExprCall) -> Option<(&Expr, &Expr)> {
Some((value, func))
}

/// Returns `Some` if this is a subscribt with the form `date[:-1] + "-00"`.
/// Returns `Some` if this is a subscript with the form `date[:-1] + "-00"`.
fn slice_minus_1_date(subscript: &ExprSubscript) -> Option<&Expr> {
let ExprSubscript { value, slice, .. } = subscript;
let slice = slice.as_slice_expr()?;
Expand Down
Loading