Skip to content

Instantly share code, notes, and snippets.

@sritasngh
Created June 19, 2021 10:55
Show Gist options
  • Save sritasngh/6590e3e560c895aba9a6b9f6e6c7656d to your computer and use it in GitHub Desktop.
Save sritasngh/6590e3e560c895aba9a6b9f6e6c7656d to your computer and use it in GitHub Desktop.
This is a Jinja template for scancode to extract only required information for my project Integrating ScanCOde toolkit to FOSSology.
{
"licenses":
[
{% if licenses %}
{% for key, license in licenses.items() %}
{
"key": "{{ license.key }}",
"score": {{ license.score }},
"name": "{{ license.name }}",
"text_url": "{{ license.text_url }}",
"start_line": {{ license.start_line }},
"end_line": {{ license.end_line }},
"matched_length": {{ license.matched_rule.matched_length }},
"matched_text": {{ license.matched_text|tojson }}
}
{%if loop.nextitem and not loop.lastitem %},{% endif %}
{% endfor %}
{% endif %}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment