Skip to content

Commit

Permalink
fix/clean-code
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanpulver committed Oct 24, 2024
1 parent db257de commit 0544d7c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
26 changes: 12 additions & 14 deletions safety/scan/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def scan(ctx: typer.Context,
"""
Scans a project (defaulted to the current directory) for supply-chain security and configuration issues
"""

if not ctx.obj.metadata.authenticated:
raise SafetyError("Authentication required. Please run 'safety auth login' to authenticate before using this command.")

Expand Down Expand Up @@ -313,8 +313,6 @@ def scan(ctx: typer.Context,
with console.status(wait_msg, spinner=DEFAULT_SPINNER) as status:
for path, analyzed_file in process_files(paths=file_paths,
config=config):
print("now here", analyzed_file.dependency_results.dependencies)
print("now here", analyzed_file.file_type)
count += len(analyzed_file.dependency_results.dependencies)

# Update exit code if vulnerabilities are found
Expand Down Expand Up @@ -372,7 +370,7 @@ def sort_vulns_by_score(vuln: Vulnerability) -> int:
detailed_output=detailed_output)

lines = []

if spec.remediation.recommended:
total_resolved_vulns += spec.remediation.vulnerabilities_found

Expand Down Expand Up @@ -442,18 +440,18 @@ def sort_vulns_by_score(vuln: Vulnerability) -> int:
telemetry=telemetry,
files=[],
projects=[ctx.obj.project])

total_issues_with_duplicates, total_ignored_issues = get_vulnerability_summary(report.as_v30())

print_summary(
console=console,
total_issues_with_duplicates=total_issues_with_duplicates,
console=console,
total_issues_with_duplicates=total_issues_with_duplicates,
total_ignored_issues=total_ignored_issues,
project=ctx.obj.project,
dependencies_count=count,
fixes_count=fixes_count,
resolved_vulns_per_fix=total_resolved_vulns,
is_detailed_output=detailed_output,
project=ctx.obj.project,
dependencies_count=count,
fixes_count=fixes_count,
resolved_vulns_per_fix=total_resolved_vulns,
is_detailed_output=detailed_output,
ignored_vulns_data=ignored_vulns_data
)

Expand Down Expand Up @@ -797,7 +795,7 @@ def get_vulnerability_summary(report: Dict[str, Any]) -> Tuple[int, int]:
Args:
report (ReportModel): The report containing vulnerability data.
Returns:
Tuple[int, int]: A tuple containing:
- Total number of issues (including duplicates)
Expand Down
5 changes: 0 additions & 5 deletions safety/scan/ecosystems/python/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ def read_virtual_environment_dependencies(f: InspectableFile) -> Generator[Pytho

def read_pyproject_toml_dependencies(file: Path) -> Generator[PythonDependency, None, None]:
data = toml.load(file)
print(data)
dependencies = []

# Handle 'build-system.requires'
Expand Down Expand Up @@ -304,12 +303,8 @@ def read_pyproject_toml_dependencies(file: Path) -> Generator[PythonDependency,
else:
dependencies.append(dep)

print("dependencies")
print(dependencies)
for dep in dependencies:
dep_name, dep_version = (dep.split("==") + [None])[:2]
print(dep_name)
print(dep_version)
yield PythonDependency(
name=dep_name,
version=dep_version,
Expand Down
1 change: 0 additions & 1 deletion safety/scan/finder/file_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ def __init__(
self.target = target
self.include_files = include_files

print("include_files", include_files)
# If no handlers are provided, initialize them from the ecosystem mapping
if not handlers:
handlers = set(ECOSYSTEM_HANDLER_MAPPING[ecosystem]()
Expand Down

0 comments on commit 0544d7c

Please sign in to comment.