Skip to content

Commit

Permalink
CI for accessibility of HTML report
Browse files Browse the repository at this point in the history
  • Loading branch information
Halleck45 committed Nov 1, 2024
1 parent 6ee000b commit 9b93f08
Show file tree
Hide file tree
Showing 13 changed files with 89 additions and 46 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,15 @@ jobs:
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: Halleck45/ast-metrics
slug: Halleck45/ast-metrics

- name: Test the cli directly, generating HTML report
run: |
go run . analyze --non-interactive --report-html=reporthtml src
ls reporthtml|| (echo "No report generated" && exit 1) && (echo "Report generated" && exit 0)
- name: Run Lighthouse CI
uses: treosh/lighthouse-ci-action@v12
with:
configPath: "./lighthouserc.json"
temporaryPublicStorage: true
12 changes: 12 additions & 0 deletions lighthouserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"ci": {
"collect": {
"staticDistDir": "./reporthtml"
},
"assert": {
"assertions": {
"categories:accessibility": ["error", { "minScore": 0.98 }]
}
}
}
}
2 changes: 1 addition & 1 deletion src/Report/Html/templates/compare.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h5 class="leading-none text-3xl font-bold text-gray-900 pb-2">
<p class="text-base font-normal text-gray-500 ">
Modified files
</p>
<p class="border-t border-gray-200 mt-2 italic text-sm text-gray-400 pt-4 text-justify">
<p class="border-t border-gray-200 mt-2 italic text-sm text-gray-600 pt-4 text-justify">
{% if currentView.Comparaison.NbModifiedFilesIncludingNegligible + currentView.Comparaison.NbModifiedFiles != currentView.Comparaison.NbModifiedFiles %}
{{ currentView.Comparaison.NbModifiedFilesIncludingNegligible + currentView.Comparaison.NbModifiedFiles|stringifyNumber }} modifications in commits,
but only {{ currentView.Comparaison.NbModifiedFiles|stringifyNumber }} are significant.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
]
</script>

<div id="chart_bar_afferent_help" class="mb-2 italic text-sm text-gray-400 pt-4 bg-white text-center h-16 z-10 "></div>
<div id="chart_bar_afferent_help" class="mb-2 italic text-sm text-gray-600 pt-4 bg-white text-center h-16 z-10 "></div>

{% include "componentChartRadiusBar.html" with chart_name="afferent" chart_variable_name="afferent" chart_variable_label="Afferent coupling" chart_datasource_dom_element_identifier="chart_afferent_data" chart_help_dom_element_identifier="chart_bar_afferent_help" %}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
]
</script>

<div id="chart_bar_complexity_help" class="mb-2 italic text-sm text-gray-400 pt-4 bg-white text-center h-16 z-10 "></div>
<div id="chart_bar_complexity_help" class="mb-2 italic text-sm text-gray-600 pt-4 bg-white text-center h-16 z-10 "></div>

{% include "componentChartRadiusBar.html" with chart_name="complexity" chart_variable_name="cyclomatic" chart_variable_label="Complexity" chart_datasource_dom_element_identifier="chart_cyclo_data" chart_help_dom_element_identifier="chart_bar_complexity_help" %}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
]
</script>

<div id="chart_bar_efferent_help" class="mb-2 italic text-sm text-gray-400 pt-4 bg-white text-center h-16 z-10 "></div>
<div id="chart_bar_efferent_help" class="mb-2 italic text-sm text-gray-600 pt-4 bg-white text-center h-16 z-10 "></div>

{% include "componentChartRadiusBar.html" with chart_name="efferent" chart_variable_name="efferent" chart_variable_label="Efferent coupling" chart_datasource_dom_element_identifier="chart_efferent_data" chart_help_dom_element_identifier="chart_bar_efferent_help" %}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
]
</script>

<div id="chart_bar_instability_help" class="mb-2 italic text-sm text-gray-400 pt-4 bg-white text-center h-16 z-10 "></div>
<div id="chart_bar_instability_help" class="mb-2 italic text-sm text-gray-600 pt-4 bg-white text-center h-16 z-10 "></div>

{% include "componentChartRadiusBar.html" with chart_name="instability" chart_variable_name="instability" chart_variable_label="Instability" chart_datasource_dom_element_identifier="chart_instability_data" chart_help_dom_element_identifier="chart_bar_instability_help" %}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
]
</script>

<div id="chart_bar_maintainability_help" class="mb-2 italic text-sm text-gray-400 pt-4 bg-white text-center h-16 z-10 "></div>
<div id="chart_bar_maintainability_help" class="mb-2 italic text-sm text-gray-600 pt-4 bg-white text-center h-16 z-10 "></div>

{% include "componentChartRadiusBar.html" with chart_name="maintainability" chart_variable_name="value" chart_variable_label="Maintainability" chart_datasource_dom_element_identifier="chart_maintainability_data" chart_help_dom_element_identifier="chart_bar_maintainability_help" %}
2 changes: 1 addition & 1 deletion src/Report/Html/templates/componentDependencyDiagram.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script type="application/json" id="data_dependency_diagram">
{{ currentView.PackageRelations|jsonForChartDependency}}
</script>
<div id="chart_dependency_diagram_help" class="mb-2 italic text-sm text-gray-400 pt-4 bg-white text-center h-16 z-10 "></div>
<div id="chart_dependency_diagram_help" class="mb-2 italic text-sm text-gray-600 pt-4 bg-white text-center h-16 z-10 "></div>

<div id="chart_dependency_diagram" class="mt-2"></div>

Expand Down
14 changes: 7 additions & 7 deletions src/Report/Html/templates/componentTableCompareBranch.html
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<table class="sortable w-full mt-2 min-w-full divide-y divide-gray-200 ">
<thead class="uppercase bg-gray-50 ">
<tr>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<!-- Git status -->
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">File</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">File</th>
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Maintainability index is based on the complexity of operators, operands, and cyclomatic complexity.">
Maint.
</acronym>
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Cyclomatic complexity is the number of decision points in a program">
Cyclomatic
</acronym>
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Lines of code (LOC)">
LOC
</acronym>
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Efferent coupling: number of external dependencies">
C<sub>e</sub>
</acronym>
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Afferent coupling: number of times the component is used by other components">
C<sub>a</sub>
</acronym>
Expand Down
22 changes: 11 additions & 11 deletions src/Report/Html/templates/componentTableRisks.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,53 @@
<thead class="uppercase bg-gray-50 ">
<tr>
{% if detailled == true %}
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">Lang.</th>
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">Lang.</th>
{% endif %}
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">Component</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">Component</th>
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Risk score is calculated as the average risk of the component.">
Risk
</acronym>
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Maintainability index is based on the complexity of operators, operands, and cyclomatic complexity.">
Maint.
</acronym>
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Number of recents commits (12 month)">
Commits
</acronym>
</th>
{% if detailled == true %}
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Cyclomatic complexity is the number of decision points in a program">
Cyclomatic
</acronym>
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Halstead effort is calculated as the average effort required to implement a software programe.">
Effort
</acronmy>
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Lines of code (LOC)">
LOC
</acronym>
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Efferent coupling: number of external dependencies">
C<sub>e</sub>
</acronym>
</th>
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="Afferent coupling: number of times the component is used by other components">
C<sub>a</sub>
</acronym>
</th>
</th>
<th class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<th scope="col" class="py-2 px-4 text-sm font-normal text-left rtl:text-right text-gray-500 ">
<acronym title="0 (stable) to 1 (unstable) - The ratio of efferent coupling (Ce) to total coupling (Ce + Ca)">
Instability
</acronym>
Expand Down
Loading

0 comments on commit 9b93f08

Please sign in to comment.