Skip to content

Commit e41821e

Browse files
feat: railsignore - finalizing review changes
1 parent 11b7292 commit e41821e

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

nemoguardrails/utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def get_railsignore_path(path: Optional[str] = None) -> Optional[Path]:
341341
return None
342342

343343

344-
def get_railsignore_patterns(railsignore_path) -> Set[str]:
344+
def get_railsignore_patterns(railsignore_path: Path) -> Set[str]:
345345
"""
346346
Helper to retrieve all specified patterns in railsignore.
347347
Returns:
@@ -352,8 +352,6 @@ def get_railsignore_patterns(railsignore_path) -> Set[str]:
352352
if railsignore_path is None:
353353
return ignored_patterns
354354

355-
# railsignore_path = get_railsignore_path()
356-
357355
# File doesn't exist or is empty
358356
if not railsignore_path.exists() or not os.path.getsize(railsignore_path):
359357
return ignored_patterns
@@ -377,13 +375,13 @@ def get_railsignore_patterns(railsignore_path) -> Set[str]:
377375
return ignored_patterns
378376

379377

380-
def is_ignored_by_railsignore(filename, ignore_patterns) -> bool:
378+
def is_ignored_by_railsignore(filename: str, ignore_patterns: str) -> bool:
379+
"""Helper to verify if a filename should be ignored by a railsignore pattern"""
381380
ignore = False
382381

383-
# Load candidate patterns from railsignore
384-
385382
for pattern in ignore_patterns:
386383
if fnmatch.fnmatch(filename, pattern):
387384
ignore = True
385+
break
388386

389387
return ignore

0 commit comments

Comments
 (0)