rspec/rules/S118/java/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

71 lines
1.4 KiB
Plaintext

== Why is this an issue?
Sharing some naming conventions is a key point to make it possible for a team to efficiently collaborate. This rule allows to check that all ``++abstract++`` class names match a provided regular expression. If a non-abstract class match the regular expression, an issue is raised to suggest to either make it abstract or to rename it.
=== Noncompliant code example
With the default regular expression: ``++^Abstract[A-Z][a-zA-Z0-9]*$++``:
[source,java]
----
abstract class MyClass { // Noncompliant
}
class AbstractLikeClass { // Noncompliant
}
----
=== Compliant solution
[source,java]
----
abstract class AbstractClass {
}
class LikeClass {
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Rename this abstract class name to match the regular expression ${format}
=== Parameters
.format
****
_String_
----
^Abstract[A-Z][a-zA-Z0-9]*$
----
Regular expression used to check the abstract class names against.
****
'''
== Comments And Links
(visible only on this page)
=== on 8 May 2013, 10:15:22 Freddy Mallet wrote:
Dedicated issue message when the regular expression matches a class name which is not abstract :
Make this class abstract or rename it, since it matches the regular expression ${format}
=== on 20 May 2013, 12:08:29 Fabrice Bellingard wrote:
Implementation: \http://jira.codehaus.org/browse/SONARJAVA-147
endif::env-github,rspecator-view[]