Standardize private/public method naming conventions#439
Merged
Conversation
- Add naming conventions to modules.md: symbol (public), _symbol (private helper), __symbol (default value) - Rename private functions in Descriptions: compute_similarity → _compute_similarity, find_similar_descriptions → _find_similar_descriptions, format_description_candidates → _format_description_candidates - Rename private functions in Exceptions: extract_user_frames → _extract_user_frames, format_user_friendly_error → _format_user_friendly_error, ansi_color → _ansi_color, ansi_reset → _ansi_reset, print_ansi_styled → _print_ansi_styled - Update planning.md with improved checkpoint templates (MCP preferred, fallback commands) - Fix extension tests to use fake types per testing-creation.md §6 (prevents flaky tests when extensions are loaded elsewhere)
Member
Author
Summary of ChangesThis PR addresses the "Private/public method naming and distribution" item from PR #438's planned features. What was done
Impact
|
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.
Overview
This PR standardizes the naming conventions for private and public methods across CTBase.jl, following the newly documented conventions in
dev/philosophy/modules.md.Changes
Documentation Updates
dev/philosophy/modules.md— Added explicit naming conventions:symbol— public: exported viaexport; part of the documented API_symbol— private helper: unexported; internal implementation detail__symbol— default value: unexported; provides a replaceable semantic defaultdev/planning.md— Improved checkpoint templates:get_test_commandpreferred for running testsCode Refactoring
src/Descriptions/— Renamed private helper functions:compute_similarity→_compute_similarityfind_similar_descriptions→_find_similar_descriptionsformat_description_candidates→_format_description_candidatessrc/Exceptions/display.jl— Renamed private helper functions:extract_user_frames→_extract_user_framesformat_user_friendly_error→_format_user_friendly_erroransi_color→_ansi_coloransi_reset→_ansi_resetprint_ansi_styled→_print_ansi_styledsrc/Extensions/Extensions.jl— Confirmed__displayas a default value (double underscore convention)Test Updates
test/suite/descriptions/test_similarity.jl— Updated all calls to renamed functionstest/suite/exceptions/test_display.jl— Updated calls to renamed functionstest/suite/extensions/test_extensions_enriched.jl— Fixed extension stub testing:FakeDocumenterReferenceTag,FakeCoveragePostprocessingTag,FakeTestRunnerTag)testing-creation.md§6 to prevent flaky tests when extensions are loaded elsewhereUndefVarErrorchecks in favor of deterministic fake typesRationale
The naming convention clarification makes the intent of each symbol explicit:
_prefix) are internal implementation details__prefix) are semantic defaults that can be overridden by extensions or subtypesThis aligns with the broader effort (PR #438) to improve code organization and documentation across the control-toolbox ecosystem.
Testing
All affected test suites pass:
test/suite/descriptions/test_similarity.jltest/suite/exceptions/test_display.jltest/suite/extensions/test_extensions_enriched.jl