Skip to content

Commit

Permalink
Fix softwaresaved#42 Bug with Install Instructions / Requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanJField committed Aug 29, 2024
1 parent dc7d214 commit a4079ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion fuji_server/data/software_file.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
],
"parse": "file_name",
"pattern": [
"requirements\\.txt"
"requirements\\.txt",
"pyproject\\.toml"
]
},
"docs_directory": {
Expand Down
10 changes: 7 additions & 3 deletions fuji_server/evaluators/fair_evaluator_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def nestedDataContainsKeyword(self, data, key):
)
for d in values:
if isinstance(d, bytes):
d = d.decode("utf-8")
d = d.decode("utf-8", errors="replace")
if isinstance(d, str):
if key in d.lower():
return True
Expand Down Expand Up @@ -88,13 +88,17 @@ def scanForKeywords(self, keywords, locations):
content = self.fuji.github_data.get(location)
if content is not None:
if isinstance(content, bytes):
content = content.decode("utf-8")
content = content.decode("utf-8", errors="replace")
if isinstance(content, str):
if k in content.lower():
hit_dict[k] = True # found keyword in location
keys_to_check.remove(k) # stop looking, have found something for this key
else:
hit_dict[k] = self.nestedDataContainsKeyword(content, k)
if hit_dict[k] is True:
keys_to_check.remove(k) # Need to also stop looking
self.logger.info(
f"{self.metric_identifier} : Found {k} in {location}"
) # Info message for specific keys
return hit_dict

def testInstructions(self):
Expand Down
3 changes: 2 additions & 1 deletion fuji_server/yaml/metrics_v0.7_software.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ metrics:
required:
dependency_file:
- requirements.txt
- pyproject.toml
- target: https://f-uji.net/vocab/metadata/standards
modality: all
required:
Expand All @@ -367,7 +368,7 @@ metrics:
- deploy
created_by: FAIR4RS
date_created: 2024-01-18
date_updated: 2024-01-18
date_updated: 2024-08-28
version: 0.1
total_score: 2
- metric_identifier: FRSM-14-R1
Expand Down

0 comments on commit a4079ff

Please sign in to comment.