Skip to content

Commit

Permalink
feat: railsignore - review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ajanitshimanga committed Oct 3, 2024
1 parent 3ed19dc commit 10fb5c6
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions nemoguardrails/rails/llm/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1213,16 +1213,13 @@ def _generate_rails_flows(flows):


def _is_file_ignored_by_railsignore(filename: str) -> bool:
# Default no skip
should_skip_file = False
ignore = False

# Load candidate patterns from railsignore
candidate_patterns = get_railsignore_patterns()

# Ignore colang, kb, python modules if specified in valid railsignore glob format
if filename.endswith(".py") or filename.endswith(".co") or filename.endswith(".kb"):
for pattern in candidate_patterns:
if fnmatch.fnmatch(filename, pattern):
should_skip_file = True
for pattern in candidate_patterns:
if fnmatch.fnmatch(filename, pattern):
ignore = True

return should_skip_file
return ignore

0 comments on commit 10fb5c6

Please sign in to comment.