Skip to content

Warn before loading custom deadcode plugins - #1034

Merged
egiurleo merged 1 commit into
mainfrom
deadcode-custom-plugins-warning
Oct 16, 2026
Merged

egiurleo merged 1 commit into
mainfrom
deadcode-custom-plugins-warning

Conversation

@egiurleo

@egiurleo egiurleo commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

spoom deadcode automatically requires every .spoom/deadcode/plugins/*.rb file in the analyzed project. That's how custom plugins are designed to work, but it means running spoom deadcode on an untrusted checkout runs that checkout's Ruby code, and nothing says so.

We decided to keep the behavior as designed (running any tool in an untrusted folder is already risky). This PR just makes it visible.

Implementation

  • When custom plugin files exist, spoom deadcode prints a warning listing them before requiring them. Projects without custom plugins see no change in output.
  • Added a "Custom plugins" section to the README that explains how to write one and warns that they execute project code.

Tests

Updated test_deadcode_load_custom_plugins to assert the warning. test_deadcode_show_plugins_default still passes unchanged, which confirms there's no warning when no custom plugins exist.

@egiurleo
egiurleo requested a review from a team as a code owner October 16, 2026 16:44
`spoom deadcode` requires every `.spoom/deadcode/plugins/*.rb` file from
the analyzed project, which executes that project's Ruby code. This is
how custom plugins are designed to work, but it isn't obvious, so print
a warning listing the files before loading them and document the
behavior in the README.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@egiurleo
egiurleo force-pushed the deadcode-custom-plugins-warning branch from 204d145 to 94b59dc Compare October 16, 2026 16:53
@egiurleo
egiurleo merged commit 01cfb83 into main Oct 16, 2026
11 checks passed
@egiurleo
egiurleo deleted the deadcode-custom-plugins-warning branch October 16, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants