Repository Analysis

oldj/SwitchHosts

Switch hosts quickly!

2.7 Likely human-written View on GitHub
2.7
Adjusted Score
2.7
Raw Score
100%
Time Factor
2026-05-30
Last Push
26,728
Stars
TypeScript
Language
39,259
Lines of Code
207
Files
83
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 0HIGH 0MEDIUM 7LOW 76

Pattern Findings

83 matches across 5 categories. Click a row to expand file-level details.

Over-Commented Block51 hits · 51 pts
SeverityFileLineSnippet
LOW.github/workflows/release.yml1# SwitchHosts v5 (Tauri) release workflow.
LOW.github/workflows/release.yml21# Tauri updater signing:
LOW.github/workflows/release.yml421
LOWsrc-tauri/Cargo.toml21tauri-plugin-log = "2"
LOWsrc-tauri/tests/window_config.rs1//! Structural canaries for window setup that have no behavioural
LOWsrc-tauri/src/http_api.rs1//! Local HTTP API server.
LOWsrc-tauri/src/http_api.rs21//! - `stop()` aborts the join handle and clears the slot.
LOWsrc-tauri/src/import_export.rs1//! Manual import / export of v3, v4, and v5 backup JSON files.
LOWsrc-tauri/src/import_export.rs161 }
LOWsrc-tauri/src/lib.rs201 })
LOWsrc-tauri/src/tray.rs1//! System tray for the v5 main app.
LOWsrc-tauri/src/tray.rs41
LOWsrc-tauri/src/tray.rs501/// On any Retina mac the cursor coords are ~2× too large, so the
LOWsrc-tauri/src/tray.rs621// Tauri's `Focused(false)` event is unreliable as a click-outside signal
LOWsrc-tauri/src/commands.rs1//! Tauri commands.
LOWsrc-tauri/src/commands.rs261
LOWsrc-tauri/src/commands.rs1101// TopBar/ImportFromUrl keeps working without changes:
LOWsrc-tauri/src/commands.rs1401 Ok(builder)
LOWsrc-tauri/src/app_menu.rs1//! Application menu — the macOS menu bar / Windows+Linux window menu.
LOWsrc-tauri/src/refresh.rs1//! Remote `hosts` refresh, both renderer-driven and time-driven.
LOWsrc-tauri/src/lifecycle.rs1//! Window lifecycle plumbing for the v5 main window.
LOWsrc-tauri/src/lifecycle.rs181
LOWsrc-tauri/src/find.rs1//! Find / replace window plumbing.
LOWsrc-tauri/src/find.rs181 // string search by default. Mirrors the
LOWsrc-tauri/src/hosts_apply/elevation.rs1//! Privileged write to the system hosts file.
LOWsrc-tauri/src/hosts_apply/elevation.rs21//! with a process-lifetime cached `AuthorizationRef` (single prompt)
LOWsrc-tauri/src/hosts_apply/elevation.rs61}
LOWsrc-tauri/src/hosts_apply/elevation.rs381#[cfg(target_os = "macos")]
LOWsrc-tauri/src/hosts_apply/elevation.rs441 code.map(|c| c.to_string()).unwrap_or_else(|| "?".into()),
LOWsrc-tauri/src/hosts_apply/elevation.rs461// resolve to a path containing literal `%`. Going through cmd
LOWsrc-tauri/src/hosts_apply/elevation.rs541 // ourselves. The thread is short-lived (one elevated write +
LOWsrc-tauri/src/hosts_apply/error.rs1//! Apply-time error type.
LOWsrc-tauri/src/hosts_apply/error.rs21 #[allow(dead_code)]
LOWsrc-tauri/src/hosts_apply/write.rs1//! System hosts write orchestration.
LOWsrc-tauri/src/hosts_apply/aggregate.rs1//! Selected-content aggregation.
LOWsrc-tauri/src/hosts_apply/mod.rs1//! Hosts apply pipeline.
LOWsrc-tauri/src/hosts_apply/history.rs1//! Apply history persistence: `internal/histories/system-hosts.json`.
LOWsrc-tauri/src/hosts_apply/cmd_runner.rs1//! Run the user-configured `cmd_after_hosts_apply` script after every
LOWsrc-tauri/src/storage/manifest.rs1//! `~/.SwitchHosts/manifest.json` reader, writer, and tree operations.
LOWsrc-tauri/src/storage/manifest.rs61 /// `internal/state.json`. The returned `Manifest.root` is in the
LOWsrc-tauri/src/storage/entries.rs1//! `~/.SwitchHosts/entries/<id>.hosts` reader and writer.
LOWsrc-tauri/src/storage/mod.rs21
LOWsrc-tauri/src/storage/mod.rs41 /// pipeline. Tauri runs `#[tauri::command] async fn`s concurrently
LOWsrc-tauri/src/storage/state.rs1//! `~/.SwitchHosts/internal/state.json` reader and writer.
LOWsrc-tauri/src/storage/state.rs41pub struct TreeState {
LOWsrc-tauri/src/storage/tree_format.rs1//! Two-way translation between the renderer's `IHostsListObject` shape
LOWsrc-tauri/src/storage/tree_format.rs21//! { id, type, title, on, isSys?, contentFile?,
LOWsrc-tauri/src/storage/tree_format.rs241
LOWsrc-tauri/src/migration/mod.rs1//! First-startup PotDb → v5 migration.
LOWsrc-tauri/src/migration/potdb.rs1//! Read legacy Electron PotDb data directly from disk.
LOWsrc-tauri/src/migration/potdb.rs21//! history/
Decorative Section Separators7 hits · 21 pts
SeverityFileLineSnippet
MEDIUM.github/workflows/release.yml9# ── Required GitHub Secrets ──────────────────────────────────────────
MEDIUM.github/workflows/release.yml25# ── First-time setup ────────────────────────────────────────────────
MEDIUM.github/workflows/release.yml41# ─────────────────────────────────────────────────────────────────────
MEDIUM.github/workflows/release.yml155 # ── macOS ──────────────────────────────────────────────
MEDIUM.github/workflows/release.yml165 # ── Linux ──────────────────────────────────────────────
MEDIUM.github/workflows/release.yml328 # ── Finalize release after all platform builds complete ───────────
MEDIUM.github/workflows/release.yml728 # ── Generate latest.json after release assets are finalized ───────
Hyper-Verbose Identifiers14 hits · 16 pts
SeverityFileLineSnippet
LOWe2e/preferences.spec.ts13async function expectVerticalCentersAligned(label: Locator, control: Locator) {
LOWsrc/renderer/core/notify.ts37export function getFriendlyUpdateErrorMessage(
LOWsrc/renderer/core/notify.ts137export function updateSuccessNotification(id: string, { title, message }: AppNotificationOptions) {
LOWsrc/renderer/components/Pref/configSync.ts7export function mergeConfigUpdateIntoDraft(
LOWsrc/renderer/components/Pref/languageOptions.ts27export function normalizeLanguageOptionValue(
LOWsrc/renderer/components/Pref/languageOptions.ts38export function resolveLanguageSelectValue(
LOWsrc/renderer/pages/find.tsx122export function sanitizeFindResultColumnWidths(widths?: number[] | null): ResultColumnWidths | null {
LOWsrc/renderer/pages/find.tsx132export function getDefaultFindResultFixedColumnWidths(
LOWsrc/renderer/pages/find.tsx148export function getFindResultColumnWidths(
LOWsrc/renderer/pages/find.tsx162function normalizeFindResultColumnMaxWidth(maxColumnWidth?: number) {
LOWsrc/renderer/pages/find.tsx168function normalizeFindResultColumnWidth(width: number) {
LOWsrc/renderer/pages/find.tsx172function getFindResultDragColumnMaxWidth(currentWidth: number, maxColumnWidth: number) {
LOWsrc/renderer/pages/find.tsx176function clampFindResultColumnWidthForDrag(
LOWsrc/renderer/pages/find.tsx187export function resizeFindResultFixedColumnWidths(
Verbosity Indicators10 hits · 15 pts
SeverityFileLineSnippet
LOWsrc-tauri/src/commands.rs216 // Step 1: under a short cfg lock, derive the proposed `next` value
LOWsrc-tauri/src/commands.rs231 // Step 2: apply the OS-side change first, then persist to disk. If
LOWsrc-tauri/src/commands.rs248 // Step 3: re-acquire the lock briefly to publish the new value.
LOWsrc-tauri/src/commands.rs682 // Step 1: previous content, only if not redundant.
LOWsrc-tauri/src/commands.rs697 // Step 2: new content.
LOWsrc-tauri/src/refresh.rs92 // Step 1: snapshot the node from the current manifest. No lock —
LOWsrc-tauri/src/refresh.rs109 // Step 2: fetch the new content. May take seconds; lockless.
LOWsrc-tauri/src/refresh.rs112 // Step 3: compare with the entries file (always LF on disk). The
LOWsrc-tauri/src/refresh.rs131 // Step 4: re-acquire the manifest under the store lock and stamp
LOWsrc-tauri/src/refresh.rs155 // Step 5: tell the UI. Both events match the Electron broadcast
Redundant / Tautological Comments1 hit · 2 pts
SeverityFileLineSnippet
LOW.github/workflows/release.yml40# Set APPLE_TEAM_ID to J5J6USUX2F.