Revision 16th of November
This commit is contained in:
parent
b6389f747f
commit
7b06820170
@ -93,11 +93,13 @@ properties:
|
|||||||
items:
|
items:
|
||||||
type: integer""")
|
type: integer""")
|
||||||
|
|
||||||
def check_security_rules(security_rules: dict[Any, Any]) -> dict[int, SecurityRule]:
|
def check_security_rules(security_rules: dict[Any, Any] | None) -> dict[int, SecurityRule]:
|
||||||
|
if security_rules is None:
|
||||||
|
raise Exception("Security rules file is empty!")
|
||||||
for n in range(1, 19):
|
for n in range(1, 19):
|
||||||
try:
|
try:
|
||||||
rule = security_rules.get(n, None)
|
rule = security_rules.get(n, None)
|
||||||
if rule is None: raise Exception('No result for rule {}'.format(n))
|
if rule is None: raise jsonschema.ValidationError('Rule {} is not evaluated'.format(n))
|
||||||
jsonschema.validate(rule, rule_schema)
|
jsonschema.validate(rule, rule_schema)
|
||||||
except jsonschema.ValidationError as e:
|
except jsonschema.ValidationError as e:
|
||||||
error("Security rule {n}: {msg} at $.{n}.{path}".format(n=n, msg=e.message, path=e.json_path))
|
error("Security rule {n}: {msg} at $.{n}.{path}".format(n=n, msg=e.message, path=e.json_path))
|
||||||
@ -139,7 +141,7 @@ def write_model_readmes(dataset: dict[str, Any]):
|
|||||||
info['forks'] = forks
|
info['forks'] = forks
|
||||||
info['owner_name'] = owner_name
|
info['owner_name'] = owner_name
|
||||||
info['owner_slug'] = owner_slug
|
info['owner_slug'] = owner_slug
|
||||||
security_rules_file = dir / 'security_rules.yaml'
|
security_rules_file = dataset_path / model_id / 'security_rules.yaml'
|
||||||
try:
|
try:
|
||||||
with open(security_rules_file, 'r') as f:
|
with open(security_rules_file, 'r') as f:
|
||||||
security_rules = yaml.safe_load(f)
|
security_rules = yaml.safe_load(f)
|
||||||
@ -147,6 +149,9 @@ def write_model_readmes(dataset: dict[str, Any]):
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
warning("Security rules file not found at {}".format(security_rules_file))
|
warning("Security rules file not found at {}".format(security_rules_file))
|
||||||
security_rules = {}
|
security_rules = {}
|
||||||
|
except Exception as e:
|
||||||
|
warning("Security rules file at {} is invalid: {}".format(security_rules_file, e))
|
||||||
|
security_rules = {}
|
||||||
print(f"Writing readme file {readme}")
|
print(f"Writing readme file {readme}")
|
||||||
dir.mkdir(exist_ok=True)
|
dir.mkdir(exist_ok=True)
|
||||||
with open(readme, 'w', encoding="utf-8") as f:
|
with open(readme, 'w', encoding="utf-8") as f:
|
||||||
@ -184,14 +189,14 @@ Total Items | {info['t']}
|
|||||||
|
|
||||||
### Diagram
|
### Diagram
|
||||||
|
|
||||||
The below diagram is generated from the corresponding [model file](/dataset/{model_id}/{model_id}.py).
|
The below diagram is generated from the corresponding [model file](../../dataset/{model_id}/{model_id}.py).
|
||||||
|
|
||||||
Formats:
|
Formats:
|
||||||
- [PlantUML Model](/dataset/{model_id}/{model_id}/{model_id}.txt)
|
- [PlantUML Model](../../dataset/{model_id}/{model_id}/{model_id}.txt)
|
||||||
- [SVG Vector Image](/dataset/{model_id}/{model_id}/{model_id}.svg)
|
- [SVG Vector Image](../../dataset/{model_id}/{model_id}/{model_id}.svg)
|
||||||
- [PNG Raster Image](/dataset/{model_id}/{model_id}/{model_id}.png)
|
- [PNG Raster Image](../../dataset/{model_id}/{model_id}/{model_id}.png)
|
||||||
|
|
||||||
![Data Flow Diagram](/dataset/{model_id}/{model_id}/{model_id}.svg)""")
|
![Data Flow Diagram](../../dataset/{model_id}/{model_id}/{model_id}.svg)""")
|
||||||
|
|
||||||
def write_root_readme(dataset: dict[str, Any]):
|
def write_root_readme(dataset: dict[str, Any]):
|
||||||
print(f"Writing main readme file")
|
print(f"Writing main readme file")
|
||||||
|
Loading…
Reference in New Issue
Block a user