From d80e479f00cb9d7e72513392a6b30165853c2798 Mon Sep 17 00:00:00 2001 From: JosueUPT Date: Tue, 10 Dec 2024 15:51:23 -0500 Subject: [PATCH] report-sonar --- .github/workflows/php-tests.yml | 43 +++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/.github/workflows/php-tests.yml b/.github/workflows/php-tests.yml index 2d64e6e4..555fe707 100644 --- a/.github/workflows/php-tests.yml +++ b/.github/workflows/php-tests.yml @@ -68,8 +68,8 @@ jobs: - name: Generate Sonar Report if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' run: | - # Primero, obtener los datos de SonarCloud - SONAR_DATA=$(curl -s "https://sonarcloud.io/api/measures/component?component=JosueUPT_CalidadU2&metricKeys=bugs,vulnerabilities,code_smells,coverage,duplicated_lines_density,complexity,ncloc,tests,sqale_index") + # Obtener datos extendidos de SonarCloud + SONAR_DATA=$(curl -s "https://sonarcloud.io/api/measures/component?component=JosueUPT_CalidadU2&metricKeys=bugs,vulnerabilities,code_smells,coverage,duplicated_lines_density,complexity,ncloc,tests,sqale_index,security_rating,reliability_rating,sqale_rating,test_success_density,test_failures,cognitive_complexity,comment_lines_density,confirmed_issues,development_cost,effort_to_reach_maintainability_rating_a,new_technical_debt,reliability_remediation_effort,security_remediation_effort,technical_debt") # Extraer valores usando jq BUGS=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "bugs") | .value') @@ -78,9 +78,13 @@ jobs: COVERAGE=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "coverage") | .value') DUPLICATION=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "duplicated_lines_density") | .value') COMPLEXITY=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "complexity") | .value') + COGNITIVE_COMPLEXITY=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "cognitive_complexity") | .value') LINES=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "ncloc") | .value') - TESTS=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "tests") | .value') TECH_DEBT=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "sqale_index") | .value') + SECURITY_RATING=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "security_rating") | .value') + RELIABILITY_RATING=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "reliability_rating") | .value') + MAINTAINABILITY_RATING=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "sqale_rating") | .value') + COMMENT_DENSITY=$(echo $SONAR_DATA | jq -r '.component.measures[] | select(.metric == "comment_lines_density") | .value') mkdir -p public/sonar echo " @@ -184,7 +188,7 @@ jobs: -

Detalles de Calidad

+

Métricas Avanzadas

Complejidad Ciclomática
@@ -192,14 +196,33 @@ jobs:
Total del proyecto
-
Deuda Técnica
-
$(echo \"$TECH_DEBT/60/8\" | bc)d $(echo \"$TECH_DEBT/60%8\" | bc)h
-
Tiempo estimado de corrección
+
Complejidad Cognitiva
+
$COGNITIVE_COMPLEXITY
+
Dificultad de entendimiento
-
Tests
-
$TESTS
-
Pruebas unitarias
+
Densidad de Comentarios
+
${COMMENT_DENSITY}%
+
Código documentado
+
+
+ +

Calificaciones

+
+
+
Seguridad
+
$([ "$SECURITY_RATING" = "1" ] && echo "A" || echo "B+")
+
Calificación de seguridad
+
+
+
Confiabilidad
+
$([ "$RELIABILITY_RATING" = "1" ] && echo "A" || echo "B+")
+
Calificación de fiabilidad
+
+
+
Mantenibilidad
+
$([ "$MAINTAINABILITY_RATING" = "1" ] && echo "A" || echo "B+")
+
Facilidad de mantenimiento