Refactor Tool defaults into standalone ToolSpec methods and is_likely_used function#1351
Merged
nathanjmcdougall merged 3 commits intomainfrom Mar 10, 2026
Merged
Conversation
…odule Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add standalone functions for Tool methods
Refactor Mar 10, 2026
Tool defaults into standalone ToolSpec methods and is_likely_used function
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
nathanjmcdougall
requested changes
Mar 10, 2026
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
nathanjmcdougall
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
usethis/_tool/spec.pywithToolMetaandToolSpec(moved frombase.py), addingis_declared_as_dep,get_pre_commit_repos,is_pre_commit_config_presenttoToolSpecis_presentmethod toConfigSpecinusethis/_tool/config.py(moved fromTool._is_config_spec_present)usethis/_tool/heuristics.pywith standaloneis_likely_used(tool_spec, config_spec)functionusethis/_tool/base.py: import fromspec.py, refactorTool.is_usedto useis_likely_used, updateis_config_presentto useConfigSpec.is_present, remove_is_config_spec_present/is_declared_as_dep/get_pre_commit_repos/is_pre_commit_config_presentfromToolusethis/_tool/impl/ruff.pyto useconfig_spec.is_present()instead ofself._is_config_spec_present(...)ToolMeta/ToolSpecre-exported frombase.pyfor backward compatibility.importlinterto addheuristicsandspeclayersis_likely_usedintests/usethis/_tool/test_heuristics.pyTestConfigSpecIsPresent::test_unmanaged_item_not_detectedcovering themanaged=Falsecontinue branch inConfigSpec.is_present()Original prompt
Toolmethods #1350🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.