Skip to content
Open
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
4 changes: 3 additions & 1 deletion bins/bounty-cli/src/tui/leaderboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ struct App {
error: Option<String>,
}

const ICON_SIZE: u16 = 14;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Local ICON_SIZE is unused and creates another source of truth.

Right now this constant is not used in leaderboard.rs, so it doesn’t enforce the sizing fix and can drift from other modules. Prefer consuming one shared definition (or remove this local constant).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bins/bounty-cli/src/tui/leaderboard.rs` at line 26, The local constant
ICON_SIZE in leaderboard.rs is unused and duplicates the canonical size; either
remove this declaration or replace its usage by importing the shared ICON_SIZE
definition from the central module that defines it (so leaderboard.rs consumes
the single source of truth). Locate the const ICON_SIZE in leaderboard.rs and
either delete that line or change code to refer to the shared symbol (e.g., use
the module path or pub use that exports ICON_SIZE) ensuring all sizing in
leaderboard rendering uses the shared constant instead of a local one.


fn parse_entries(data: &Value) -> Vec<LeaderboardEntry> {
let body = data.get("body").unwrap_or(data);
let arr = match body.as_array() {
Expand Down Expand Up @@ -178,4 +180,4 @@ pub async fn run(rpc_url: &str) -> Result<()> {

super::restore_terminal(&mut terminal)?;
Ok(())
}
}
6 changes: 6 additions & 0 deletions bins/bounty-cli/src/tui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ use crossterm::{
use ratatui::prelude::*;
use std::io;

const ICON_SIZE: u16 = 14;

pub fn setup_terminal() -> Result<Terminal<CrosstermBackend<io::Stdout>>> {
enable_raw_mode()?;
let mut stdout = io::stdout();
Expand All @@ -25,3 +27,7 @@ pub fn restore_terminal(terminal: &mut Terminal<CrosstermBackend<io::Stdout>>) -
terminal.show_cursor()?;
Ok(())
}

pub fn get_icon_size() -> u16 {
ICON_SIZE
}
4 changes: 3 additions & 1 deletion bins/bounty-cli/src/tui/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ fn parse_stats(data: &Value) -> StatsData {
}
}

const ICON_SIZE: u16 = 14;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

ICON_SIZE is added but unused in this module.

This constant isn’t consumed anywhere in stats.rs, so it currently adds dead code and doesn’t help enforce icon-size consistency. Either wire it into an actual rendering path or remove it from this file.

Suggested minimal cleanup
-const ICON_SIZE: u16 = 14;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const ICON_SIZE: u16 = 14;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@bins/bounty-cli/src/tui/stats.rs` at line 49, The ICON_SIZE constant was
added to stats.rs but is unused; either remove the dead constant or apply it
where icons are drawn — locate the declaration "const ICON_SIZE: u16 = 14;" and
either delete that line, or replace any hard-coded icon size values in the
module's rendering functions (e.g., render_stats, draw_icon, or any draw/render
methods that position or size icons) to reference ICON_SIZE so the value is
actually consumed and enforces icon-size consistency.


fn stat_block<'a>(label: &'a str, value: u64, color: Color) -> Paragraph<'a> {
let text = vec![
Line::from(Span::styled(
Expand Down Expand Up @@ -152,4 +154,4 @@ pub async fn run(rpc_url: &str) -> Result<()> {

super::restore_terminal(&mut terminal)?;
Ok(())
}
}