INNER CODE UNIT · Python
find_api_files
qodex-ai/apimesh · file_scanner.py:34
def find_api_files(file_paths, framework):
patterns = config.routing_patterns_map.get(framework)
if not patterns:
print(f"Warning: No routing patterns configured for framework '{framework or 'unknown'}'. Scanning all supported files.")
return list(file_paths)
api_files = []
for file_path in file_paths:
try:
with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()
if any(re.search(pattern, content) for pattern in patterns):
if framework == "ruby_on_rails":
if file_path.endswith('.rb'):
api_files.append(file_path)
else:
api_files.append(file_path)
except (UnicodeDecodeError, FileNotFoundError):
continue