Repository navigation
Conversation
…ts in global_settings.yml Allows users to define default include_patterns, exclude_patterns, and max_file_size once in ~/.cocoindex_code/global_settings.yml (UserSettings) so projects without custom patterns automatically inherit them. - Adds include_patterns, exclude_patterns, and max_file_size to UserSettings. - Serializes and validates user-level pattern lists and file sizes in _user_settings_to_dict and _user_settings_from_dict. - Updates _project_settings_from_dict and default_project_settings to inherit from UserSettings when project-level fields are omitted. - Ensures project-level definitions override user defaults cleanly instead of merging. - Adds comprehensive unit tests covering pattern inheritance, project overrides, and validation.
This branch has not been deployed
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.
Fixes #305
Description
Allows users to define default
include_patterns,exclude_patterns, andmax_file_sizeonce in~/.cocoindex_code/global_settings.yml(UserSettings) so that projects on the machine automatically inherit them without duplicating rules across every.cocoindex_code/settings.yml.Key Changes
UserSettingsdataclass: Addedinclude_patterns: list[str] | None = None,exclude_patterns: list[str] | None = None, andmax_file_size: int | None = None._user_settings_to_dictserializes pattern lists andmax_file_sizewhen configured._user_settings_from_dictvalidates that patterns are lists of strings and parses human-readable sizes (parse_file_size)._project_settings_from_dictandload_project_settingscheck project-level settings first; if a project omitsinclude_patterns,exclude_patterns, ormax_file_size, it inherits the user-level default (falling back to global defaults if neither is defined).default_project_settingsseeds fromUserSettingswhen available.tests/test_settings.pycovering user settings YAML round-trip, type validation for invalid patterns, project-level inheritance, and project-level override precedence.Verification
All 77 unit tests in
tests/test_settings.pypass cleanly (77 passed, 4 skipped).