-
Notifications
You must be signed in to change notification settings - Fork 0
[WEB-4211] feat: skip specific folders to not parse #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -37,8 +37,9 @@ | |||||||||||||||||
| MAX_SEARCH_DEPTH = 10 # Maximum directory depth to search recursively | ||||||||||||||||||
| SKIP_DIRS = frozenset[str]({ | ||||||||||||||||||
| '.git', 'node_modules', 'venv', '__pycache__', '.venv', 'vendor', '.idea', '.vscode', 'Library', '.Trash', '.cache', | ||||||||||||||||||
| 'Photos', 'Music', 'Movies', 'Pictures', 'Videos' | ||||||||||||||||||
| 'Photos', 'Music', 'Movies', 'Pictures', 'Public', 'Templates', 'Videos' | ||||||||||||||||||
| }) | ||||||||||||||||||
|
greptile-apps[bot] marked this conversation as resolved.
Comment on lines
+38
to
+41
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| # System directories to skip when searching from root (macOS/Unix) | ||||||||||||||||||
| SKIP_SYSTEM_DIRS = { | ||||||||||||||||||
| '/System', '/Library', '/private', '/usr', '/bin', '/sbin', '/opt', | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,9 @@ | |
| from pathlib import Path | ||
| from typing import Optional, List, Dict | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Skip dirs obj is being shared b/w windows and mac os as of now, we should move out of this idea and create a different obj for windows all together.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense — platform-specific skip patterns give you more flexibility to diverge the behavior later (e.g., Windows-only paths like Tip: You can give me more context with .greptile/rules.md so I get this right next time. |
||
|
|
||
| from ...constants import MAX_SEARCH_DEPTH, SKIP_DIRS, WINDOWS_SKIP_USER_DIRS | ||
| from scripts.coding_discovery_tools.macos_extraction_helpers import SKIP_PATTERN as SKIPDIR_PATTERN | ||
|
|
||
| from ...constants import MAX_SEARCH_DEPTH, WINDOWS_SKIP_USER_DIRS | ||
| from ...windows_extraction_helpers import ( | ||
| is_running_as_admin, | ||
| read_file_content, | ||
|
|
@@ -182,7 +184,7 @@ def _walk_for_cursor_cli_settings( | |
| if not entry.is_dir(): | ||
| continue | ||
|
|
||
| if entry.name in SKIP_DIRS or entry.name in system_dirs: | ||
| if SKIPDIR_PATTERN.search(entry.name) is not None or entry.name in system_dirs: | ||
| continue | ||
|
|
||
| if entry.name == self.CURSOR_DIR_NAME: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,9 @@ | |
| from pathlib import Path | ||
| from typing import List, Dict, Optional, Tuple, Callable | ||
|
|
||
| from .constants import MAX_CONFIG_FILE_SIZE, SKIP_DIRS | ||
| from scripts.coding_discovery_tools.macos_extraction_helpers import SKIP_PATTERN | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| from .constants import MAX_CONFIG_FILE_SIZE | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
@@ -155,7 +157,7 @@ def should_skip_path(path: Path, system_dirs: Optional[set] = None) -> bool: | |
| True if path should be skipped, False otherwise | ||
| """ | ||
| # Skip common project directories (check all path parts for nested matches) | ||
| if any(part in SKIP_DIRS for part in path.parts): | ||
| if any(path for path in path.parts if SKIP_PATTERN.search(path) is not None): | ||
| return True | ||
|
|
||
| # Skip system directories if provided (Windows-specific) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frozenset[str](...)still raisesTypeErroron Python 3.8 because built-in collection generics are not subscriptable there. This file is imported by the extraction helpers before traversal starts, so a Python 3.8 runtime can fail at module import instead of running discovery. The runtime type parameter is not needed here, and the otherfrozensetconstants in this file already use the compatible form.