Skip to content

Commit 6c35543

Browse files
committed
Add progress bar
1 parent 5ebd642 commit 6c35543

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
openpyxl
2-
PyYAML
2+
PyYAML
3+
tqdm

scanner.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
import importlib
44
import os
55
from typing import List, NamedTuple
6+
from tqdm import tqdm
67

78

89
class ScanResult(NamedTuple):
910
file_path: str
1011
line_number: int
1112
title: str
1213
message: str
13-
severity: str # New field for severity
14+
severity: str
1415

1516

1617
class Scanner:
@@ -28,14 +29,21 @@ def _load_checks(self):
2829

2930
def scan(self, path: str) -> List[ScanResult]:
3031
results = []
32+
files_to_scan = []
33+
34+
# Collect all files to scan
3135
if os.path.isfile(path):
32-
results.extend(self._scan_file(path))
36+
files_to_scan.append(path)
3337
elif os.path.isdir(path):
3438
for root, _, files in os.walk(path):
3539
for file in files:
3640
if any(file.endswith(ext) for ext in self.config.get_file_extensions()):
37-
file_path = os.path.join(root, file)
38-
results.extend(self._scan_file(file_path))
41+
files_to_scan.append(os.path.join(root, file))
42+
43+
# Scan files with progress bar
44+
for file_path in tqdm(files_to_scan, desc="Scanning files", unit="file"):
45+
results.extend(self._scan_file(file_path))
46+
3947
return results
4048

4149
def _scan_file(self, file_path: str) -> List[ScanResult]:
@@ -52,4 +60,4 @@ def _scan_file(self, file_path: str) -> List[ScanResult]:
5260
message=result.line_content,
5361
severity=check.severity
5462
))
55-
return results
63+
return results

0 commit comments

Comments
 (0)