Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanpulver committed Nov 25, 2024
1 parent 004aaad commit 5ecc1d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 6 additions & 8 deletions cli_isolated/main.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
from pathlib import Path
from safety_schemas.models import FileType
from read_dependency_files import read_dependency_files
from read_dependency_files import process_files
from vulnerability_checker import check_vulnerabilities

# Initialize input files
file_path = Path("/Users/dylanpulver/Repos/pyup/safety/test_requirements.txt")
file_type = FileType.REQUIREMENTS_TXT

# String buffer to accumulate results
output_buffer = []
# output_buffer = []

# Process files and check for vulnerabilities
for path, inspectable_file in read_dependency_files([file_path], [file_type]):
output_buffer.append(f"Processed file: {path}")
file_model, file_output = check_vulnerabilities(path, inspectable_file)
output_buffer.append(file_output)
for path, inspectable_file in process_files([file_path], [file_type]):
# output_buffer.append(f"Processed file: {path}")
# file_model, file_output = check_vulnerabilities(path, inspectable_file)
# output_buffer.append(file_output)

# Print the final results
print("\n".join(output_buffer))
3 changes: 2 additions & 1 deletion cli_isolated/read_dependency_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from safety_schemas.models import FileType, ConfigModel
from inspectable_file_context import InspectableFileContext

def read_dependency_files(file_paths: List[Path], file_types: List[FileType], config=None):
def process_files(file_paths: List[Path], file_types: List[FileType], config=None):
"""
Reads and processes a list of dependency files, parsing their content into structured models.
Expand Down Expand Up @@ -31,3 +31,4 @@ def read_dependency_files(file_paths: List[Path], file_types: List[FileType], co
yield file_path, inspectable_file
else:
print(f"Unable to process file: {file_path}")

0 comments on commit 5ecc1d0

Please sign in to comment.