Revision of 22nd of November

Added buttons for technologies
Split up intro and dataset page
Fixed: create tag dir if missing
Hide tag sidebar by defautl
This commit is contained in:
Michael Chen 2022-11-23 11:48:09 +01:00
parent 30ca3b6a08
commit d3be8cbc3d
Signed by: cnml
GPG Key ID: 5845BF3F82D5F629

View File

@ -174,10 +174,16 @@ Owner: [{owner_name}](https://github.com/{owner_slug})
The repository has {plural(stars, 'star')} and was forked {plural(forks, 'time')}. The codebase consists of {plural(info['l'], 'line')} of code and makes use of the following technologies: The repository has {plural(stars, 'star')} and was forked {plural(forks, 'time')}. The codebase consists of {plural(info['l'], 'line')} of code and makes use of the following technologies:
{chr(10).join(f'- {tech}' for tech in info['tech'])} {chr(10).join(f'<a class="btn btn-primary" style="margin-bottom: 5px" role="button" href="tag_{get_tag_slug(tech)}.html">{tech}</a>' for tech in info['tech'])}
## Data Flow Diagram ## Data Flow Diagram
### DFD Model
{{% include note.html content="Download the [model file](../../dataset/{model_id}/{model_id}.py)" %}}
The images below were generated by executing the model file. The DFD is represented as a CodeableModels file.
### Statistics ### Statistics
The Application consists of a total of {plural(info['t'], 'element')}: The Application consists of a total of {plural(info['t'], 'element')}:
@ -192,8 +198,6 @@ Total Items | {info['t']}
### Diagram ### Diagram
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)
@ -205,14 +209,43 @@ def write_root_readme(dataset: dict[str, Any]):
print(f"Writing main readme file") print(f"Writing main readme file")
with open('index.md', 'w', encoding="utf-8") as f: with open('index.md', 'w', encoding="utf-8") as f:
f.write(f"""--- f.write(f"""---
title: code2DFD Dataset title: code2DFD Documentation
keywords: sample homepage keywords: code2DFD introduction
tags: [getting_started] tags: []
sidebar: datasetdoc_sidebar sidebar: datasetdoc_sidebar
permalink: index.html permalink: index.html
summary: Dataset of dataflow diagrams of microservice applications. summary: Dataset of dataflow diagrams of microservice applications.
--- ---
# code2DFD
{{% include image.html file="TUHH_logo-wortmarke_en_rgb.svg" alt="TUHH Logo" max-width="350" %}}
This project is developed by the Institute of Software Security at Hamburg University of Technology.
{{% include image.html file="company_logo_big.png" alt="SoftSec Institute Logo" max-width="350" %}}
This is a description. Duis proident aliqua laborum reprehenderit duis nostrud sint duis anim Lorem anim ut.
## DFD Items
Do culpa deserunt est excepteur amet. Non pariatur ea elit ad eiusmod veniam exercitation nulla. Commodo do adipisicing amet et. Voluptate laboris commodo dolor eu mollit ipsum. Amet reprehenderit velit eu culpa amet exercitation. Elit esse ullamco duis mollit quis. Eiusmod qui reprehenderit sunt cupidatat Lorem anim occaecat enim sint eiusmod tempor.
## Use-Cases
Veniam culpa nostrud id laborum deserunt consectetur consectetur voluptate. Sint aute cupidatat velit irure elit laboris anim labore esse labore. Quis ullamco ut consequat amet. Enim sit laboris deserunt veniam duis aliqua irure proident.
""")
print(f"Writing models readme file")
with open('dataset.md', 'w', encoding="utf-8") as f:
f.write(f"""---
title: code2DFD Dataset
keywords: dataset models
tags: []
sidebar: datasetdoc_sidebar
permalink: dataset.html
summary: Dataset of dataflow diagrams of microservice applications.
---
# Dataset of Dataflow Diagrams # Dataset of Dataflow Diagrams
This repository contains of {len(dataset)} manually created dataflow diagrams (DFDs) of microservice applications found on GitHub. The dataset is published as an additional contribution to "Automatic Extraction of Security-Rich Dataflow Diagrams for Microservice Applications written in Java" [Simon Schneider, Riccardo Scandariato]. Each folder in the [`dataset`](dataset/) directory contains one DFD in a [CodeableModels](https://github.com/uzdun/CodeableModels)-format that can be executed to generate PNG, SVG and TXT files for the DFD. Each model refers to stereotypes and metaclasses from the [metamodel](microservice_dfds_metamodel.py) which needs to be imported. This repository already contains rendered versions for each model, thus setup and rendering is only necessary once changes to the models are made. This repository contains of {len(dataset)} manually created dataflow diagrams (DFDs) of microservice applications found on GitHub. The dataset is published as an additional contribution to "Automatic Extraction of Security-Rich Dataflow Diagrams for Microservice Applications written in Java" [Simon Schneider, Riccardo Scandariato]. Each folder in the [`dataset`](dataset/) directory contains one DFD in a [CodeableModels](https://github.com/uzdun/CodeableModels)-format that can be executed to generate PNG, SVG and TXT files for the DFD. Each model refers to stereotypes and metaclasses from the [metamodel](microservice_dfds_metamodel.py) which needs to be imported. This repository already contains rendered versions for each model, thus setup and rendering is only necessary once changes to the models are made.
@ -226,21 +259,16 @@ Name | Source | LoC | Stars | Forks | DFD Items | Technologies
{chr(10).join(f"[{info['slug']}]({model_id}.html) | [GitHub](https://github.com/{info['slug']}) | {info['l']} | {info['stars']} | {info['forks']} | {info['t']} | {len(info['tech'])}" for model_id, info in dataset.items())} {chr(10).join(f"[{info['slug']}]({model_id}.html) | [GitHub](https://github.com/{info['slug']}) | {info['l']} | {info['stars']} | {info['forks']} | {info['t']} | {len(info['tech'])}" for model_id, info in dataset.items())}
<div class="datatable-end"></div> <div class="datatable-end"></div>
## DFD Items
Do culpa deserunt est excepteur amet. Non pariatur ea elit ad eiusmod veniam exercitation nulla. Commodo do adipisicing amet et. Voluptate laboris commodo dolor eu mollit ipsum. Amet reprehenderit velit eu culpa amet exercitation. Elit esse ullamco duis mollit quis. Eiusmod qui reprehenderit sunt cupidatat Lorem anim occaecat enim sint eiusmod tempor.
## Use-Cases
Veniam culpa nostrud id laborum deserunt consectetur consectetur voluptate. Sint aute cupidatat velit irure elit laboris anim labore esse labore. Quis ullamco ut consequat amet. Enim sit laboris deserunt veniam duis aliqua irure proident.
""") """)
def write_tag_readme(dataset: dict[str, Any]): def write_tag_readme(dataset: dict[str, Any]):
tag_dir = output_path / 'tags' tag_dir = output_path / 'tags'
known_tech = set(tech for model in dataset.values() for tech in model['tech']) known_tech = set(tech for model in dataset.values() for tech in model['tech'])
print(f"Writing tag data file") print(f"Writing tag data file")
with open('_data/tags.yml', 'r+') as f: tags_data_path = Path('_data')
tags_data_file = tags_data_path / 'tags.yml'
tags_data_path.mkdir(exist_ok=True, parents=True)
with tags_data_file.open('r+') as f:
tags = yaml.safe_load(f) tags = yaml.safe_load(f)
tags['allowed-tags'] = list(sorted(set(itertools.chain(tags['allowed-tags'], (get_tag_slug(tech) for tech in known_tech))))) tags['allowed-tags'] = list(sorted(set(itertools.chain(tags['allowed-tags'], (get_tag_slug(tech) for tech in known_tech)))))
f.seek(0) f.seek(0)
@ -251,6 +279,7 @@ def write_tag_readme(dataset: dict[str, Any]):
slug = get_tag_slug(tech) slug = get_tag_slug(tech)
info_file = tag_dir / f'tag_{slug}.md' info_file = tag_dir / f'tag_{slug}.md'
print(f"Writing tag file for {tech}") print(f"Writing tag file for {tech}")
tag_dir.mkdir(exist_ok=True, parents=True)
with open(info_file, 'w', encoding="utf-8") as f: with open(info_file, 'w', encoding="utf-8") as f:
f.write(f"""--- f.write(f"""---
title: "{tech}" title: "{tech}"
@ -258,6 +287,7 @@ tagName: {slug}
search: exclude search: exclude
permalink: tag_{slug}.html permalink: tag_{slug}.html
sidebar: datasetdoc_sidebar sidebar: datasetdoc_sidebar
hide_sidebar: true
folder: tags folder: tags
--- ---
{{% include taglogic.html %}} {{% include taglogic.html %}}