render.sh

This commit is contained in:
AF 2023-06-18 10:39:57 +00:00
parent c3b7fff4a8
commit f4c9076ccc
4 changed files with 11 additions and 3 deletions

View File

@ -3,7 +3,7 @@ RUN cargo install rust-code-analysis-cli
WORKDIR /code/
RUN git clone https://gitea.parrrate.ru/PTV/radn-rs.git
WORKDIR /code/radn-rs/
RUN git fetch && git checkout a89fd3416cb1eb9b0d34fc514d79cbf85b0e856a
RUN git fetch && git checkout e8142ba869bffa60d9a3a809d1c7e2093afd8ba5
COPY metrics.py /code/metrics.py
RUN python3 /code/metrics.py
FROM python:3.11

View File

@ -8,7 +8,7 @@ def filter_schema(obj, schema):
return {key: filter_schema(obj[key], value) for key, value in schema.items()}
entry_schema = {"metrics": {"halstead": {"bugs": True, "difficulty": True}}}
entry_schema = {"name": True, "metrics": {"halstead": {"bugs": True, "difficulty": True}}}
commits = check_output(['git', 'log', '--pretty=%H'], text=True).splitlines()
entries = []

View File

@ -13,7 +13,11 @@ with open('metrics.json', 'r') as file:
units = []
for i, entry in entries:
units.append((i, entry["metrics"]["halstead"]["difficulty"] or 0.0, entry["metrics"]["halstead"]["bugs"] or 0.0))
x = i
y = entry["metrics"]["halstead"]["difficulty"] or 0.0
y += (hash(entry["name"]) % 201 - 100) / 500
c = entry["metrics"]["halstead"]["bugs"] or 0.0
units.append((x, y, c))
X, Y, C = np.array(units).transpose()
plt.scatter(-X, Y, s=2.0, c=C)
plt.savefig('/code/metrics.png')

4
render.sh Executable file
View File

@ -0,0 +1,4 @@
clear
docker compose up -d --build metrics
docker cp radn-metrics:/code/metrics.png ./metrics/metrics.png
docker compose stop metrics