Chore: Report betterer stats in ci-frontend-metrics (#47210)

* Chore: Report betterer stats to graphite

* PR feedback

* use camelCase from lodash instead
This commit is contained in:
Josh Hunt
2022-04-04 11:43:23 +01:00
committed by GitHub
parent b4346a5613
commit 8f1b208a35
4 changed files with 36 additions and 2 deletions

View File

@@ -8,6 +8,8 @@ CONTROLLERS="$(grep -r -oP 'class .*Ctrl' public/app/ | wc -l)"
STORIES_COUNT="$(find ./packages/grafana-ui/src/components -name "*.story.tsx" | wc -l)"
MDX_COUNT="$(find ./packages/grafana-ui/src/components -name "*.mdx" | wc -l)"
LEGACY_FORMS="$(grep -r -oP 'LegacyForms;' public/app | wc -l)"
# This is also included in the betterer stats, but we maintain it to keep metric history
ENZYME_TEST_COUNT="$(grep -l -R --include="*.test.*" "from 'enzyme'" public packages | wc -l)"
STRICT_LINT_RESULTS="$(yarn run eslint --rule '@typescript-eslint/no-explicit-any: ["error"]' --format unix --ext .ts,.tsx ./public || true)"
@@ -38,7 +40,15 @@ echo -e "High vulnerabilities: $HIGH_VULNERABILITIES"
echo -e "Critical vulnerabilities: $CRITICAL_VULNERABILITIES"
echo -e "Number of enzyme tests: $ENZYME_TEST_COUNT"
BETTERER_STATS=""
while read -r name value
do
BETTERER_STATS+=$'\n '
BETTERER_STATS+="\"grafana.ci-code.betterer.${name}\": \"${value}\","
done <<< "$(yarn betterer:stats)"
echo "Metrics: {
$BETTERER_STATS
\"grafana.ci-code.strictErrors\": \"${ERROR_COUNT}\",
\"grafana.ci-code.accessibilityErrors\": \"${ACCESSIBILITY_ERRORS}\",
\"grafana.ci-code.directives\": \"${DIRECTIVES}\",