Skip to content

Commit 7662c7f

Browse files
authored
add missing bandit to GitHub CI and apply bandit fixes (#625)
1 parent b86efc7 commit 7662c7f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.github/workflows/ci-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
matrix:
2222
py-ver-major: [3]
2323
py-ver-minor: [6, 7, 8, 9, 10, 11]
24-
step: [lint, unit, mypy]
24+
step: [lint, bandit, unit, mypy]
2525
exclude:
2626
- py-ver-major: 3
2727
py-ver-minor: 6

schema_salad/cpp_codegen.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,21 @@ def safename2(name: Dict[str, str]) -> str:
6565
# into its class path and non class path
6666
def split_name(s: str) -> Tuple[str, str]:
6767
t = s.split("#")
68-
assert len(t) == 2
68+
if len(t) != 2:
69+
raise ValueError(
70+
"Expected field to be formatted as 'https://xyz.xyz/blub#cwl/class'."
71+
)
6972
return (t[0], t[1])
7073

7174

7275
# similar to split_name but for field names
7376
def split_field(s: str) -> Tuple[str, str, str]:
7477
(namespace, field) = split_name(s)
7578
t = field.split("/")
76-
assert len(t) == 2
79+
if len(t) != 2:
80+
raise ValueError(
81+
"Expected field to be formatted as 'https://xyz.xyz/blub#cwl/class'."
82+
)
7783
return (namespace, t[0], t[1])
7884

7985

@@ -596,8 +602,6 @@ def parse(self, items: List[Dict[str, Any]]) -> None:
596602
types = {i["name"]: i for i in items} # type: Dict[str, Any]
597603

598604
for stype in items:
599-
assert "type" in stype
600-
601605
if "type" in stype and stype["type"] == "documentation":
602606
continue
603607

0 commit comments

Comments
 (0)