SkillSpector icon indicating copy to clipboard operation
SkillSpector copied to clipboard

[Refactor] mcp: centralize RISK_THRESHOLD constant and deduplicate cleanup helper

Open CharmingGroot opened this issue 5 months ago • 0 comments

Follow-up from @rng1995's review on #36: https://github.com/NVIDIA/SkillSpector/pull/36#pullrequestreview-4539956136

"The cleanup block duplicates the private _cleanup_result helper … RISK_THRESHOLD = 50 is duplicated from the CLI's inline 50"

Two small code-quality issues surfaced during review of #36:

  1. RISK_THRESHOLD = 50 is duplicated between cli.py (inline) and mcp_server.py (module constant). If the threshold changes, both must be updated in sync.
  2. The temp-dir cleanup finally block in mcp_server.py reimplements what _cleanup_result() in cli.py already does. The two can drift independently.

Proposed Fix

  1. Extract RISK_THRESHOLD to a shared module (e.g. skillspector/constants.py) and import it in both files.
  2. Move _cleanup_result to a shared utility module and import it in both places.

CharmingGroot avatar Jun 24 '26 07:06 CharmingGroot