swh:1:snp:f521c49ab17ef7db6ec70b2430e1ed203f50383f
Raw File
Tip revision: 63005e54d906a953d24af54c168ff8af1e732124 authored by Dmitri Naumov on 04 March 2021, 08:52:46 UTC
[T/App/U] Add GMSH2OGS snakemake ctest.
Tip revision: 63005e5
cppcheck_gen_hashes.py
# Inserts hashes of description + file path as GitLab code quality fingerprint
import hashlib
import json
import sys

data = None
with open(sys.argv[1]) as json_file:
    data = json.load(json_file)

for entry in data:
    desc = entry["description"]
    path = entry["location"]["path"]
    hash = hashlib.sha256((desc + path).encode("utf-8")).hexdigest()
    entry["fingerprint"] = hash

with open(sys.argv[1], "w") as outfile:
    json.dump(data, outfile)

print("Added cppcheck fingerprints to {}.".format(sys.argv[1]))
back to top