rspec/rules/S3282/xml/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

62 lines
1.4 KiB
Plaintext

== Why is this an issue?
Exclusions for default interceptors can be declared either in xml or as class annotations. Since annotations are more visible to maintainers, they are preferred.
=== Noncompliant code example
[source,xml]
----
<assembly-descriptor>
<interceptor-binding>
<ejb-name>MyExcludedClass</ejb-name>
<exclude-default-interceptors>true</exclude-default-interceptors> <!-- Noncompliant -->
<exclude-class-interceptors>true</exclude-class-interceptors> <!-- Noncomopliant -->
<method>
<method-name>doTheThing</method-name>
</method>
</interceptor-binding>
</assembly-descriptor>
----
=== Compliant solution
[source,xml]
----
@ExcludeDefaultInterceptors
public class MyExcludedClass implements MessageListener
{
@ExcludeClassInterceptors
@ExcludeDefaultInterceptors
public void doTheThing() {
// ...
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Move this exclusion into the class as an annotation.
'''
== Comments And Links
(visible only on this page)
=== on 23 Jul 2015, 13:53:27 Ann Campbell wrote:
Rule origin: \https://groups.google.com/forum/#!topic/sonarqube/cYQdBhf00eo
Project is EJB if it contains JEE Beans (any one of javax.ejb.Singleton, MessageDriven, Stateless or Stateful) (@Local/@Remote interfaces are not mandatory)
endif::env-github,rspecator-view[]