https://gitlab.opengeosys.org/ogs/ogs.git
Raw File
Tip revision: 3e92ede6312f26363994ea27d505ee1554298ad5 authored by rinkk on 26 March 2021, 17:06:58 UTC
[utils] added boundary extraction to vertical slice extraction tool
Tip revision: 3e92ede
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