Skip to content

feat: support glob patterns in ignore_paths configuration#1391

Merged
Saga4 merged 2 commits into
mainfrom
feat/ignore-paths-glob-patterns
Feb 5, 2026
Merged

feat: support glob patterns in ignore_paths configuration#1391
Saga4 merged 2 commits into
mainfrom
feat/ignore-paths-glob-patterns

Conversation

@mohammedahmed18
Copy link
Copy Markdown
Contributor

Summary

  • Add support for glob patterns in ignore_paths CLI option and configuration
  • Previously only literal paths were supported, now patterns like **/*.test.js, *.log, dist/* work
  • Patterns are expanded relative to the module root directory

Changes

  • Added is_glob_pattern() function to detect glob pattern characters (*, ?, [)
  • Added normalize_ignore_paths() function that handles both literal paths and glob patterns
  • Updated CLI argument processing to use the new function
  • Added comprehensive unit tests (20 tests covering various patterns and edge cases)

Usage Examples

CLI:

codeflash --ignore-paths "node_modules" "*.log" "**/*.test.js" "dist/*"

Config (pyproject.toml):

[tool.codeflash]
ignore_paths = ["node_modules", "**/*.test.js", "*.log", "dist"]

Test plan

  • Unit tests for is_glob_pattern() function
  • Unit tests for normalize_ignore_paths() function covering:
    • Empty list
    • Literal existing/non-existing paths
    • Single asterisk patterns (*.log)
    • Double asterisk patterns (**/*.py)
    • Directory content patterns (dir/*)
    • Question mark patterns (file?.txt)
    • Bracket patterns (file[12].txt)
    • Mixed literal and patterns
    • Deduplication
    • Nested directory patterns
    • Absolute and relative paths

🤖 Generated with Claude Code

Add support for glob patterns (e.g., `**/*.test.js`, `*.log`, `dist/*`)
in the `ignore_paths` CLI option and configuration. Previously only
literal paths were supported.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
GLOB_PATTERN_CHARS = frozenset("*?[")


def is_glob_pattern(path_str: str) -> bool:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, Can refactor code in similar function like get_valid_subdirs as well.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Feb 5, 2026

PR Review Summary

✅ Prek Checks

All linting and formatting checks passed successfully.

✅ Mypy Type Checks

No type errors found in the new code added by this PR.

  • New functions is_glob_pattern() and normalize_ignore_paths() have proper type annotations
  • Pre-existing mypy errors in code_utils.py are unrelated to this PR's changes

🔍 Code Review

No critical issues found. The implementation is clean and well-tested.

Observations:

  • New glob pattern support is properly implemented with comprehensive test coverage
  • The code correctly handles both literal paths and glob patterns
  • Deduplication logic ensures no duplicate paths in results
  • All 20 new unit tests pass successfully

Existing Comment:

  • A suggestion was made to apply similar refactoring to get_valid_subdirs() function (not a blocker)

📊 Test Coverage

Changed Files Coverage

File Main Coverage PR Coverage Change
codeflash/cli_cmds/cli.py 39% (246 stmts) 39% (241 stmts) No change
codeflash/code_utils/code_utils.py 65% (275 stmts) 68% (295 stmts) +3% ⬆️
Overall 53% 55% +2% ⬆️

New Code Coverage

  • 20 new unit tests added in tests/code_utils/test_normalize_ignore_paths.py
  • All tests pass successfully
  • New functions (is_glob_pattern, normalize_ignore_paths) are well-covered by tests
  • Test suite covers edge cases: empty lists, non-existent paths, various glob patterns, deduplication, absolute/relative paths

Test Results

  • 2300 tests passed (19 new tests added)
  • 33 skipped
  • 8 pre-existing failures in test_tracer.py (unrelated to this PR)

✅ Summary

This PR successfully adds glob pattern support to ignore_paths with excellent test coverage. The implementation is solid, all new tests pass, and coverage has improved. No critical issues found.


Last updated: 2026-02-05

@Saga4 Saga4 merged commit b741859 into main Feb 5, 2026
24 of 27 checks passed
@Saga4 Saga4 deleted the feat/ignore-paths-glob-patterns branch February 5, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants