rspec/rules/S1937/html/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

33 lines
834 B
Plaintext

== Why is this an issue?
Content that doesn't change or that doesn't change often should be included using a mechanism which won't try to interpret it. Specifically, ``++<%@ include file="..." %>++``, which includes the file in the JSP servlet translation phase (i.e. it happens once), should be used instead of ``++<jsp:include page="..." />++``, which includes the page on the file, when the content is being served to the user.
=== Noncompliant code example
[source,html]
----
<jsp:include page="header.jsp"> <!-- Noncompliant -->
----
=== Compliant solution
[source,html]
----
<%@ include file="header.jsp" %>
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use an include action instead of an include directive.
endif::env-github,rspecator-view[]