Skip to content

Commit 50f17e4

Browse files
committed
Add requests to requirements.txt, change _process_file to process file in rubyDataSource. Also avoid calling process_file twice
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
1 parent 81dd565 commit 50f17e4

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,4 @@ traitlets==4.3.3
5151
wcwidth==0.1.7
5252
whitenoise==5.0.1
5353
zipp==0.6.0
54+
requests==2.23.0

vulnerabilities/importers/ruby.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ def updated_advisories(self) -> Set[Advisory]:
2525
files = self._updated_files.union(self._added_files)
2626
advisories = []
2727
for f in files:
28-
if self._process_file(f):
29-
advisories.append(self._process_file(f))
28+
processed_data = self.process_file(f)
29+
if processed_data:
30+
advisories.append(processed_data)
3031
return self.batch_advisories(advisories)
3132

32-
def _process_file(self, path) -> List[Advisory]:
33+
def process_file(self, path) -> List[Advisory]:
3334
with open(path) as f:
3435
record = yaml.safe_load(f)
3536
package_name = record.get(

vulnerabilities/tests/test_ruby.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def test_process_file(self, mock_write):
9797
found_advisories = set()
9898

9999
for p in MOCK_ADDED_FILES:
100-
found_advisories.add(self.data_src._process_file(p))
100+
found_advisories.add(self.data_src.process_file(p))
101101
assert found_advisories == expected_advisories
102102

103103
def test_categorize_versions(self):

0 commit comments

Comments
 (0)