Skip to content

Commit

Permalink
Fix #239: Link to module within list of violations (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
TWiStErRob authored Jul 31, 2022
1 parent 54c522c commit f338673
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions quality/src/main/resources/violations.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@
<xsl:for-each select=".//violation[not(details/@rule = preceding-sibling::violation/details/@rule)]">
<xsl:variable name="rule" select="details/@rule" />
<xsl:variable name="sameRuleViolations" select="../violation[details/@rule = $rule]" />
<xsl:variable name="id" select="concat(details/@category, '-', source/@reporter, '-', $rule)" />
<li data-id="toc-{$id}">
<xsl:variable name="ruleId" select="concat(details/@category, '-', source/@reporter, '-', $rule)" />
<li data-id="toc-{$ruleId}">
<span class="toc-count">
<xsl:value-of select="count($sameRuleViolations)" />
</span>
×
<a href="#{$id}">
<a href="#{$ruleId}">
<code class="rule">
<xsl:value-of select="$rule" />
</code>
Expand All @@ -123,14 +123,17 @@
">
<xsl:sort />
<xsl:variable name="module" select="." />
<xsl:variable name="moduleId" select="concat($ruleId, '-', $module)" />
<xsl:variable name="moduleCount" select="count($sameRuleViolations[location/@module = $module])" />
<span class="toc-count">
<xsl:value-of select="$moduleCount" />
</span>
×
<code class="module">
<xsl:value-of select="$module" />
</code>
<a href="#{$moduleId}">
<code class="module" data-id="toc-{$moduleId}">
<xsl:value-of select="$module" />
</code>
</a>
<xsl:if test="position() != last()" xml:space="preserve">, </xsl:if>
</xsl:for-each>
)
Expand Down Expand Up @@ -162,6 +165,11 @@
is also `true` and not `no node` coerced to `false`) -->
<a name="{details/@category}-{source/@reporter}-{details/@rule}" />
</xsl:if>
<xsl:if test="details/@rule != concat(preceding-sibling::violation[1]/details/@rule, '') or location/@module != concat(preceding-sibling::violation[1]/location/@module, '')">
<!-- concat in test makes sure the first violation (which has no preceding nodes)
is also `true` and not `no node` coerced to `false`) -->
<a name="{details/@category}-{source/@reporter}-{details/@rule}-{location/@module}" />
</xsl:if>
<div class="violation" xml:space="preserve">
<span class="title">
<!-- @formatter:off -->
Expand Down

0 comments on commit f338673

Please sign in to comment.