mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 20:45:33 -08:00
4.9 KiB
4.9 KiB
Caller Search
Part of plan2code-dead-code: read in Step 4 before the caller search, and given to every helper that searches. Never invoked as a skill.
A candidate is dead only when nothing in the whole project reaches it. Search the whole project, never only the folder the run covers, and search for more than the plain name: the lists below are what else can reach an item in each language group. Include tests, scripts, config files, docs that act as config (an OpenAPI file, a route table, a cron file) and generated glue (bindings, stubs, registration files).
Every language
- The plain name, as a whole word, in every text file, not only in source files of the same language.
- The name inside strings and templates: config keys, JSON and YAML values, SQL, HTML attributes, environment files.
- Build files, CI configs,
Dockerfile,Makefile, package scripts and shell scripts that call a file or a function by name. - A file candidate: its path and its file name without the extension, anywhere.
- Record what each search found in
callers, even when it found nothing ("no match outside its own file").
JavaScript and TypeScript
- Re-exports:
export * from,export { x } from, and the barrel files (index.js,index.ts) that pass a name on. - Dynamic
import()with a string or template path, andrequire()with a computed path. package.jsonexports,main,module,binandtypes; a workspace's other packages that import this one.- Framework conventions that load by file name: route folders (
pages/,app/,routes/),*.config.*files, test setup files. - Names reached by string:
obj[name], event names,customElements.define, decorators.
Python
__all__lists, andfrom module import *that brings them in.getattr,importlib.import_module,__import__and string paths such as"package.module:func".- Decorators that register a function (routes, CLI commands, signal handlers, pytest fixtures used by name).
- Entry points in
pyproject.toml,setup.cfgandsetup.py(console_scripts, plugin groups), andmanage.pyor framework settings that name a module.
Rust
pub usere-exports and the crate's public API inlib.rs.- Macros that expand to a call (
macro_rules!bodies, derive and attribute macros). #[cfg(...)]and feature flags: an item used only under a feature or a target is still used.moddeclarations,#[path]attributes,build.rs, and binaries undersrc/bin/or[[bin]]inCargo.toml.
Go
- Exported names (capitalized) used from another package or module in the workspace.
- Interface satisfaction: a method with no direct caller may make a type meet an interface used elsewhere.
init()functions, blank imports (import _ "pkg") that run them, and//go:generatelines.- Build tags and file-name suffixes (
_linux.go,_test.go), and reflection (reflect,MethodByName, struct tags read at runtime).
Java and Kotlin
- Reflection:
Class.forName,getMethod,getDeclaredField, and names in strings. - Annotations that register or call:
@Bean,@Component,@Controller,@RequestMapping,@Test,@JsonCreator,@Subscribe,mainmethods. - Spring and other dependency injection: XML configs,
application.propertiesandapplication.yml, component scanning by package. META-INF/servicesfiles,AndroidManifest.xml, Gradle and Maven files that name a class, and Kotlin@JvmStaticorcompanion objectmembers called from Java.
C#
- Reflection:
Type.GetType,GetMethod,Activator.CreateInstance,nameofused as a key. - Attributes that register or call:
[HttpGet],[Route],[Fact],[Test],[JsonConstructor],[DllImport]. - Dependency injection registration (
AddScoped,AddTransient,AddSingleton, assembly scanning) andappsettings.json. - Serialization: properties set only by a serializer, and
.csproj,.xamland.razorfiles that name a type or handler.
Ruby
send,public_send,method,define_methodandrespond_to?with a symbol or string.constantize,const_getand class names built from strings.- Rails autoloading and conventions: controllers and actions reached through
config/routes.rb, callbacks (before_action,after_save), helpers, jobs, mailers, views that call a helper, and concerns. - Rake tasks,
Gemfileand gemspecexecutables, and initializers.
PHP
- Composer autoload (
psr-4,classmap,files) andbinentries incomposer.json. class_exists,method_exists,call_user_func, variable functions ($fn()) andnew $class.- Routes and container config: framework route files, service container definitions (YAML, XML, PHP arrays), event listeners and middleware lists.
- Templates (Blade, Twig) that call a function or helper by name, and attributes such as
#[Route].
Any other language
Search the plain name, strings and config as in "Every language", say which of the language's dynamic features you could not cover, and leave the finding at Check first.