mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-25 20:58:25 +00:00
* Sonar: explicit imports, fn paths for closures, extract helpers for cognitive complexity Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * Fix imports * Fix serde imports * Fix engine imports * Fix clippy gate and a type error from the explicit-import change Remove the unused imports the review flagged (cf.rs, pivot.rs, tables.rs, cmd/sheet.rs) so clippy -D warnings passes, and point the backstage parent-folder lookup at Path::to_str, which the fn-path rewrite had broken. Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com> * Apply rustfmt to the explicit-import cleanup so the fmt gate passes * Share the per-directory font path expansion in theme.rs The candidate font lists repeated the same loop over the Linux font directories in every role. A single helper expands them in the same order, so the lookup order is unchanged and the duplicated blocks go away. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com> * Read the Windows fonts folder in one place in theme.rs Every script-font list repeated the same WINDIR lookup. A single helper returns the same path, so the duplicated lines go away without changing which font files are tried. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com> * Build the light and dark UI palettes from one table in theme.rs Tokens::light() and Tokens::dark() listed the same 40 colour fields in the same order, so every change had to be made twice. A single palette constructor takes the mode and picks each colour's value, so each field is written once and both modes keep their exact colours. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com> * Share the Noto CJK font list between the CJK script lists in theme.rs The Japanese, Simplified and Korean lists each repeated the same loop over the Linux CJK directories with a different locale file name. One helper builds that loop, and each list keeps its own face index, so the lookup order is unchanged. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com> * Share Linux Noto directory list across Thai and Hebrew font lookups Removes the duplicated directory arrays flagged by SonarCloud new-code duplication. * Reuse in_dirs for Thai and Hebrew Noto font candidates Removes the remaining duplicated per-directory loops flagged by SonarCloud. * Share one font-list builder for the Thai and Hebrew faces The two per-script functions repeated the same Windows, macOS, Linux and variable-font setup. A single script_fonts helper now builds both lists, keeping the candidate order unchanged, which clears the Sonar duplication gate. --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Codebuff <noreply@codebuff.com>