Skip to content
Merged
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
26 changes: 18 additions & 8 deletions crates/rustern-core/src/pipeline/exit_watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,24 @@ fn event_level_rank(level: &LogLevel) -> u8 {
LogLevel::Info => 2,
LogLevel::Warn => 3,
LogLevel::Error => 4,
LogLevel::Other(s) => match s.to_ascii_lowercase().as_str() {
"error" | "err" | "fatal" => 4,
"warn" | "warning" => 3,
"info" => 2,
"debug" => 1,
"trace" => 0,
_ => 2,
},
LogLevel::Other(s) => {
if s.eq_ignore_ascii_case("error")
|| s.eq_ignore_ascii_case("err")
|| s.eq_ignore_ascii_case("fatal")
{
4
} else if s.eq_ignore_ascii_case("warn") || s.eq_ignore_ascii_case("warning") {
3
} else if s.eq_ignore_ascii_case("info") {
2
} else if s.eq_ignore_ascii_case("debug") {
1
} else if s.eq_ignore_ascii_case("trace") {
0
} else {
2
}
Comment on lines +51 to +66

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

エイリアス判定ロジックの重複(level_classify.rs::classify_str と同一パターン)

このif/elseチェーンは level_classify.rsclassify_str とエイリアス集合・判定順序が完全に一致している。将来エイリアスを追加/変更する際、片方のみ更新して不整合を起こすリスクがある。共通ヘルパー(例: fn level_alias_rank(s: &str) -> Option<u8> あるいは共通の分類関数)に抽出することを検討する余地あり。ただし本PRの目的(アロケーション削減)を超える範囲のリファクタとなるため、別PRでの対応を推奨。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/rustern-core/src/pipeline/exit_watch.rs` around lines 51 - 66,
`exit_watch.rs` contains the same alias-to-rank if/else chain as
`level_classify.rs::classify_str`, so update the logic to share a single helper
or common classification function instead of duplicating the alias list and
priority order. Use the existing `classify_str`-style symbols as the source of
truth and have `exit_watch` call that shared path, or if this refactor is out of
scope for this PR, leave a clear follow-up rather than introducing another copy.

}
}
}

Expand Down