Move config_spec into ToolSpec#1430
Conversation
- Add config_spec() method to ToolSpec protocol in spec.py - Move config_spec() implementations from impl/base/ to impl/spec/ for: codespell, coverage_py, deptry, mkdocs, pyproject_fmt, pytest - Keep config_spec() override on impl/base/ for ruff (uses instance attrs) and import_linter (uses Tool methods) - Refactor is_likely_used() to only take ToolSpec (removed config_spec param) - Update Tool.is_used() to call simplified is_likely_used() - Update tests accordingly Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
config_spec into ToolSpec
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@copilot you said you did this: These override config_spec() on the Tool subclass because they depend on Tool-level state: Ruff — uses self.linter_detection / self.formatter_detection instance attrs But I want you to move the init method on RuffTool into RuffToolSpec so these ruff attrs are available at the spec level And I want you to move |
- Move RuffTool.__init__ to RuffToolSpec so linter_detection/formatter_detection attrs are available at the spec level - Move config_spec from RuffTool to RuffToolSpec - Move config_spec and helpers (_are_active_ini_contracts, _is_root_package_singular) from ImportLinterTool to ImportLinterToolSpec - Move get_active_config_file_managers and _get_active_config_file_managers_from_resolution from Tool to ToolSpec Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Done in b247646:
All config_spec implementations now live in |
config_spec()lived onTool, forcingis_likely_used()to take a separateConfigSpecparameter alongsideToolSpec. Moving it toToolSpecletsis_likely_usedwork with just aToolSpec.Protocol changes
config_spec()toToolSpec(default:ConfigSpec.empty())get_active_config_file_managersand_get_active_config_file_managers_from_resolutionfromTooltoToolSpecconfig_spec()fromToolis_likely_used(tool_spec: ToolSpec)— dropped theconfig_specparameter, now callstool_spec.config_spec()internallyAll implementations moved from
impl/base/→impl/spec/All
config_spec()implementations now live at the spec layer:__init__(withlinter_detection/formatter_detectionattrs) andconfig_spec()moved toRuffToolSpecconfig_spec()and helpers (_are_active_ini_contracts,_is_root_package_singular) moved toImportLinterToolSpecOriginal prompt
config_specintoToolSpec#1429📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.