Skip to content

Commit 19eb93d

Browse files
committed
Fix remaining RustPython Ruff CI failures
Assisted-by: Codex:GPT-5
1 parent d86a710 commit 19eb93d

6 files changed

Lines changed: 56 additions & 6 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ jobs:
483483
runs-on: ${{ matrix.platform }}
484484
needs: determine_changes
485485
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && (needs.determine_changes.outputs.code == 'true' || github.ref == 'refs/heads/main') }}
486-
timeout-minutes: 20
486+
timeout-minutes: ${{ github.repository == 'astral-sh/ruff' && 20 || 40 }}
487487
env:
488488
# Line-tables-only debug info: faster builds, backtraces still work.
489489
CARGO_PROFILE_DEV_DEBUG: line-tables-only
@@ -690,7 +690,7 @@ jobs:
690690
needs.determine_changes.outputs.linter == 'true' ||
691691
needs.determine_changes.outputs.formatter == 'true'
692692
)
693-
timeout-minutes: 20
693+
timeout-minutes: ${{ github.repository == 'astral-sh/ruff' && 20 || 40 }}
694694
env:
695695
# Line-tables-only debug info: faster builds, backtraces still work.
696696
CARGO_PROFILE_DEV_DEBUG: line-tables-only
@@ -808,7 +808,7 @@ jobs:
808808
- determine_changes
809809
# Only runs on pull requests, since that is the only we way we can find the base version for comparison.
810810
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-test') && github.event_name == 'pull_request' && (needs.determine_changes.outputs.ty == 'true' || needs.determine_changes.outputs.py-fuzzer == 'true') }}
811-
timeout-minutes: ${{ github.repository == 'astral-sh/ruff' && 10 || 20 }}
811+
timeout-minutes: ${{ github.repository == 'astral-sh/ruff' && 10 || 30 }}
812812
steps:
813813
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
814814
with:

.github/workflows/ty-ecosystem-analyzer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
matrix:
5353
revision: [base, pr]
5454
runs-on: ${{ github.repository == 'astral-sh/ruff' && 'depot-ubuntu-22.04-32' || 'ubuntu-latest' }}
55-
timeout-minutes: 5
55+
timeout-minutes: ${{ github.repository == 'astral-sh/ruff' && 5 || 10 }}
5656
steps:
5757
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5858
with:

crates/ruff_python_formatter/generate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def to_camel_case(node: str) -> str:
102102
code = f"""
103103
use ruff_formatter::write;
104104
use ruff_python_ast::{node};
105-
use crate::verbatim_text;
105+
use crate::verbatim::verbatim_text;
106106
use crate::prelude::*;
107107
108108
#[derive(Default)]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use crate::prelude::*;
2+
use crate::verbatim::verbatim_text;
3+
use ruff_formatter::write;
4+
use ruff_python_ast::ExprConstant;
5+
6+
#[derive(Default)]
7+
pub struct FormatExprConstant;
8+
9+
impl FormatNodeRule<ExprConstant> for FormatExprConstant {
10+
fn fmt_fields(&self, item: &ExprConstant, f: &mut PyFormatter) -> FormatResult<()> {
11+
write!(f, [verbatim_text(item)])
12+
}
13+
}

crates/ruff_python_formatter/src/expression/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ pub(crate) mod expr_boolean_literal;
3030
pub(crate) mod expr_bytes_literal;
3131
pub(crate) mod expr_call;
3232
pub(crate) mod expr_compare;
33+
pub(crate) mod expr_constant;
3334
pub(crate) mod expr_dict;
3435
pub(crate) mod expr_dict_comp;
3536
pub(crate) mod expr_ellipsis_literal;
@@ -110,7 +111,7 @@ impl FormatRule<Expr, PyFormatContext<'_>> for FormatExpr {
110111
Expr::Tuple(expr) => expr.format().fmt(f),
111112
Expr::Slice(expr) => expr.format().fmt(f),
112113
Expr::IpyEscapeCommand(expr) => expr.format().fmt(f),
113-
Expr::Constant(_) => unreachable!("RustPython-only AST node"),
114+
Expr::Constant(expr) => expr.format().fmt(f),
114115
});
115116
let parenthesize = match parentheses {
116117
Parentheses::Preserve => f.context().is_expression_parenthesized(expression.into()),

crates/ruff_python_formatter/src/generated.rs

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)